summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-05-16 21:11:22 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-05-16 21:11:22 +0000
commit76357e74b51c1e82b9c7bf25aa00dd8d38359854 (patch)
treee033e746322cf6955d8ef97c2da6c4257afd634a /sys
parent9a3de556680432e50b57a65fbc16306e09ab7301 (diff)
Add systrace support to all the remaining architectures.
Tested by various people on various platforms, I'm willing to fix any breakage this causes. ok niels@ deraadt@ and mickey@ (after his comments were applied)
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/conf.c6
-rw-r--r--sys/arch/alpha/alpha/trap.c12
-rw-r--r--sys/arch/amiga/amiga/conf.c6
-rw-r--r--sys/arch/amiga/amiga/trap.c13
-rw-r--r--sys/arch/hp300/hp300/conf.c6
-rw-r--r--sys/arch/hp300/hp300/trap.c12
-rw-r--r--sys/arch/hppa/hppa/conf.c17
-rw-r--r--sys/arch/hppa/hppa/trap.c13
-rw-r--r--sys/arch/i386/i386/conf.c3
-rw-r--r--sys/arch/mac68k/mac68k/conf.c6
-rw-r--r--sys/arch/mac68k/mac68k/trap.c12
-rw-r--r--sys/arch/macppc/macppc/conf.c6
-rw-r--r--sys/arch/mvme68k/mvme68k/conf.c6
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c12
-rw-r--r--sys/arch/mvme88k/mvme88k/conf.c6
-rw-r--r--sys/arch/mvme88k/mvme88k/trap.c12
-rw-r--r--sys/arch/mvmeppc/mvmeppc/conf.c6
-rw-r--r--sys/arch/powerpc/powerpc/trap.c16
-rw-r--r--sys/arch/sparc/sparc/conf.c6
-rw-r--r--sys/arch/sparc/sparc/trap.c12
-rw-r--r--sys/arch/sparc64/sparc64/conf.c6
-rw-r--r--sys/arch/sparc64/sparc64/trap.c12
-rw-r--r--sys/arch/sun3/sun3/conf.c5
-rw-r--r--sys/arch/sun3/sun3/trap.c12
-rw-r--r--sys/arch/vax/vax/conf.c6
-rw-r--r--sys/arch/vax/vax/trap.c12
-rw-r--r--sys/sys/conf.h4
27 files changed, 187 insertions, 58 deletions
diff --git a/sys/arch/alpha/alpha/conf.c b/sys/arch/alpha/alpha/conf.c
index 0f6eca1321f..fc468aa275d 100644
--- a/sys/arch/alpha/alpha/conf.c
+++ b/sys/arch/alpha/alpha/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.37 2002/01/23 05:21:03 ericj Exp $ */
+/* $OpenBSD: conf.c,v 1.38 2002/05/16 21:11:10 miod Exp $ */
/* $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $ */
/*-
@@ -145,6 +145,8 @@ cdev_decl(pci);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -197,7 +199,7 @@ struct cdevsw cdevsw[] =
cdev_lpt_init(NULPT,ulpt), /* 47: USB printer */
cdev_ugen_init(NUGEN,ugen), /* 48: USB generic driver */
cdev_tty_init(NUCOM, ucom), /* 49: USB tty */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index 281696867f2..383576c598f 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.34 2002/04/29 00:30:36 pvalchev Exp $ */
+/* $OpenBSD: trap.c,v 1.35 2002/05/16 21:11:10 miod Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -110,6 +110,9 @@
#endif
#include <sys/ptrace.h>
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <machine/cpu.h>
@@ -704,7 +707,12 @@ syscall(code, framep)
if (error == 0) {
rval[0] = 0;
rval[1] = 0;
- error = (*callp->sy_call)(p, args + hidden, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, args + hidden, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, args + hidden, rval);
}
switch (error) {
diff --git a/sys/arch/amiga/amiga/conf.c b/sys/arch/amiga/amiga/conf.c
index b22c4875688..a073235db15 100644
--- a/sys/arch/amiga/amiga/conf.c
+++ b/sys/arch/amiga/amiga/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.34 2002/03/14 01:26:28 millert Exp $ */
+/* $OpenBSD: conf.c,v 1.35 2002/05/16 21:11:13 miod Exp $ */
/* $NetBSD: conf.c,v 1.42 1997/01/07 11:35:03 mrg Exp $ */
/*-
@@ -118,6 +118,8 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -171,7 +173,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 47 */
cdev_notdef(), /* 48 */
cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/amiga/amiga/trap.c b/sys/arch/amiga/amiga/trap.c
index 679ddd9efe2..c45f5bb41a3 100644
--- a/sys/arch/amiga/amiga/trap.c
+++ b/sys/arch/amiga/amiga/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.32 2002/03/25 18:09:13 niklas Exp $ */
+/* $OpenBSD: trap.c,v 1.33 2002/05/16 21:11:13 miod Exp $ */
/* $NetBSD: trap.c,v 1.56 1997/07/16 00:01:47 is Exp $ */
/*
@@ -57,6 +57,10 @@
#endif
#include <sys/user.h>
+
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <uvm/uvm_pmap.h>
@@ -889,7 +893,12 @@ syscall(code, frame)
goto bad;
rval[0] = 0;
rval[1] = frame.f_regs[D1];
- error = (*callp->sy_call)(p, args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, args, rval);
switch (error) {
case 0:
/*
diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c
index 01dff99f623..e16687b646e 100644
--- a/sys/arch/hp300/hp300/conf.c
+++ b/sys/arch/hp300/hp300/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.28 2001/12/11 23:19:02 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.29 2002/05/16 21:11:13 miod Exp $ */
/* $NetBSD: conf.c,v 1.39 1997/05/12 08:17:53 thorpej Exp $ */
/*-
@@ -131,6 +131,8 @@ cdev_decl(xfs_dev);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -183,7 +185,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 47 */
cdev_notdef(), /* 48 */
cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c
index 62884a42eb1..6e1a631927c 100644
--- a/sys/arch/hp300/hp300/trap.c
+++ b/sys/arch/hp300/hp300/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.36 2002/03/14 01:26:31 millert Exp $ */
+/* $OpenBSD: trap.c,v 1.37 2002/05/16 21:11:13 miod Exp $ */
/* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */
/*
@@ -95,6 +95,9 @@
#include <machine/reg.h>
#include <machine/intr.h>
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <uvm/uvm_pmap.h>
@@ -1127,7 +1130,12 @@ syscall(code, frame)
goto bad;
rval[0] = 0;
rval[1] = frame.f_regs[D1];
- error = (*callp->sy_call)(p, args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, args, rval);
switch (error) {
case 0:
frame.f_regs[D0] = rval[0];
diff --git a/sys/arch/hppa/hppa/conf.c b/sys/arch/hppa/hppa/conf.c
index 39fb915a6f3..de328f9cc2a 100644
--- a/sys/arch/hppa/hppa/conf.c
+++ b/sys/arch/hppa/hppa/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.17 2002/03/16 00:34:56 mickey Exp $ */
+/* $OpenBSD: conf.c,v 1.18 2002/05/16 21:11:14 miod Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -114,6 +114,8 @@ cdev_decl(com);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -155,12 +157,13 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 32 */
#endif
cdev_altq_init(NALTQ,altq), /* 33: ALTQ control interface */
- cdev_lkm_dummy(),
- cdev_lkm_dummy(),
- cdev_lkm_dummy(),
- cdev_lkm_dummy(),
- cdev_lkm_dummy(),
- cdev_lkm_dummy(),
+ cdev_systrace_init(NSYSTRACE,systrace) /* 34: system call tracing */
+ cdev_lkm_dummy(), /* 35 */
+ cdev_lkm_dummy(), /* 36 */
+ cdev_lkm_dummy(), /* 37 */
+ cdev_lkm_dummy(), /* 38 */
+ cdev_lkm_dummy(), /* 39 */
+ cdev_lkm_dummy(), /* 40 */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index d74614e1e03..d060904ec74 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.41 2002/03/16 01:13:42 mickey Exp $ */
+/* $OpenBSD: trap.c,v 1.42 2002/05/16 21:11:14 miod Exp $ */
/*
* Copyright (c) 1998-2001 Michael Shalayeff
@@ -42,6 +42,9 @@
#include <net/netisr.h>
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm.h>
#include <machine/autoconf.h>
@@ -496,7 +499,13 @@ syscall(frame, args)
rval[0] = 0;
rval[1] = 0;
- switch (error = (*callp->sy_call)(p, args, rval)) {
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, args, rval);
+ switch (error) {
case 0:
p = curproc; /* changes on exec() */
frame = p->p_md.md_regs;
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c
index 0ea403c77cb..eb2fe1d13c2 100644
--- a/sys/arch/i386/i386/conf.c
+++ b/sys/arch/i386/i386/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.89 2002/05/16 16:16:52 provos Exp $ */
+/* $OpenBSD: conf.c,v 1.90 2002/05/16 21:11:14 miod Exp $ */
/* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */
/*
@@ -142,7 +142,6 @@ cdev_decl(mm);
cdev_decl(wd);
cdev_decl(crypto);
#include "systrace.h"
-cdev_decl(systrace);
#include "pty.h"
#include "com.h"
#include "pccom.h"
diff --git a/sys/arch/mac68k/mac68k/conf.c b/sys/arch/mac68k/mac68k/conf.c
index eef0ca21468..254a1a4a2a4 100644
--- a/sys/arch/mac68k/mac68k/conf.c
+++ b/sys/arch/mac68k/mac68k/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.28 2002/04/21 23:35:52 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.29 2002/05/16 21:11:15 miod Exp $ */
/* $NetBSD: conf.c,v 1.41 1997/02/11 07:35:49 scottr Exp $ */
/*
@@ -113,6 +113,8 @@ cdev_decl(xfs_dev);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -165,7 +167,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 47 */
cdev_notdef(), /* 48 */
cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c
index ce27b71adf7..65b04845af1 100644
--- a/sys/arch/mac68k/mac68k/trap.c
+++ b/sys/arch/mac68k/mac68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.36 2002/04/27 01:52:13 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.37 2002/05/16 21:11:15 miod Exp $ */
/* $NetBSD: trap.c,v 1.68 1998/12/22 08:47:07 scottr Exp $ */
/*
@@ -71,6 +71,9 @@
#include <m68k/fpe/fpu_emulate.h>
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <uvm/uvm_pmap.h>
@@ -1065,7 +1068,12 @@ syscall(code, frame)
goto bad;
rval[0] = 0;
rval[1] = frame.f_regs[D1];
- error = (*callp->sy_call)(p, args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, args, rval);
switch (error) {
case 0:
frame.f_regs[D0] = rval[0];
diff --git a/sys/arch/macppc/macppc/conf.c b/sys/arch/macppc/macppc/conf.c
index 0eb0a48b578..0e9e35e4b8b 100644
--- a/sys/arch/macppc/macppc/conf.c
+++ b/sys/arch/macppc/macppc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.9 2001/12/12 19:19:17 jason Exp $ */
+/* $OpenBSD: conf.c,v 1.10 2002/05/16 21:11:15 miod Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -151,6 +151,8 @@ cdev_decl(pci);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] = {
cdev_cn_init(1,cn), /* 0: virtual console */
cdev_ctty_init(1,ctty), /* 1: controlling terminal */
@@ -202,7 +204,7 @@ struct cdevsw cdevsw[] = {
cdev_crypto_init(NCRYPTO,crypto), /* 47: /dev/crypto */
cdev_notdef(), /* 48 */
cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/mvme68k/mvme68k/conf.c b/sys/arch/mvme68k/mvme68k/conf.c
index c447e18687e..2b54af82448 100644
--- a/sys/arch/mvme68k/mvme68k/conf.c
+++ b/sys/arch/mvme68k/mvme68k/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.28 2002/04/28 14:48:29 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.29 2002/05/16 21:11:15 miod Exp $ */
/*-
* Copyright (c) 1995 Theo de Raadt
@@ -163,6 +163,8 @@ cdev_decl(xd);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -219,7 +221,7 @@ struct cdevsw cdevsw[] =
cdev_lkm_dummy(), /* 47 */
cdev_lkm_dummy(), /* 48 */
cdev_lkm_dummy(), /* 49 */
- cdev_lkm_dummy(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
index 4763ab45aa8..750dbf02141 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.44 2002/04/28 14:47:54 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.45 2002/05/16 21:11:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -97,6 +97,9 @@
extern struct emul emul_sunos;
#endif
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <uvm/uvm_pmap.h>
@@ -1071,7 +1074,12 @@ syscall(code, frame)
goto bad;
rval[0] = 0;
rval[1] = frame.f_regs[D1];
- error = (*callp->sy_call)(p, args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, args, rval);
switch (error) {
case 0:
frame.f_regs[D0] = rval[0];
diff --git a/sys/arch/mvme88k/mvme88k/conf.c b/sys/arch/mvme88k/mvme88k/conf.c
index 493045bc2da..70628981874 100644
--- a/sys/arch/mvme88k/mvme88k/conf.c
+++ b/sys/arch/mvme88k/mvme88k/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.21 2002/04/28 15:17:09 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.22 2002/05/16 21:11:16 miod Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -106,6 +106,8 @@ cdev_decl(lptwo);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct bdevsw bdevsw[] =
{
bdev_notdef(), /* 0 */
@@ -197,7 +199,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 47 */
cdev_notdef(), /* 48 */
cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cde_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c
index ac40778ebcc..76bf7e8858f 100644
--- a/sys/arch/mvme88k/mvme88k/trap.c
+++ b/sys/arch/mvme88k/mvme88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.35 2002/03/26 01:00:27 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.36 2002/05/16 21:11:16 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -53,6 +53,9 @@
#include <sys/systm.h>
#include <sys/ktrace.h>
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <machine/asm_macro.h> /* enable/disable interrupts */
@@ -1317,7 +1320,12 @@ m88100_syscall(register_t code, struct m88100_saved_state *tf)
#endif
rval[0] = 0;
rval[1] = 0;
- error = (*callp->sy_call)(p, &args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, &args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, &args, rval);
/*
* system call will look like:
* ld r10, r31, 32; r10,r11,r12 might be garbage.
diff --git a/sys/arch/mvmeppc/mvmeppc/conf.c b/sys/arch/mvmeppc/mvmeppc/conf.c
index 89070db43c3..3a341985fb3 100644
--- a/sys/arch/mvmeppc/mvmeppc/conf.c
+++ b/sys/arch/mvmeppc/mvmeppc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.10 2001/12/11 23:19:02 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.11 2002/05/16 21:11:17 miod Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -121,6 +121,8 @@ cdev_decl(ksyms);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] = {
cdev_cn_init(1,cn), /* 0: virtual console */
cdev_ctty_init(1,ctty), /* 1: controlling terminal */
@@ -176,7 +178,7 @@ struct cdevsw cdevsw[] = {
cdev_notdef(), /* 47 */
cdev_notdef(), /* 48 */
cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 6300e4d3a71..1729b29acef 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.47 2002/05/15 22:49:16 drahn Exp $ */
+/* $OpenBSD: trap.c,v 1.48 2002/05/16 21:11:17 miod Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -52,6 +52,9 @@
#include <machine/trap.h>
#include <machine/db_machdep.h>
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <ddb/db_extern.h>
@@ -442,11 +445,18 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr);
rval[1] = frame->fixreg[FIRSTARG + 1];
#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, params);
+ scdebug_call(p, code, params);
#endif
- switch (error = (*callp->sy_call)(p, params, rval)) {
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, params,
+ rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, params, rval);
+ switch (error) {
case 0:
frame->fixreg[0] = error;
frame->fixreg[FIRSTARG] = rval[0];
diff --git a/sys/arch/sparc/sparc/conf.c b/sys/arch/sparc/sparc/conf.c
index 49d4cac45d0..372382f52be 100644
--- a/sys/arch/sparc/sparc/conf.c
+++ b/sys/arch/sparc/sparc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.31 2001/12/11 23:19:02 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.32 2002/05/16 21:11:17 miod Exp $ */
/* $NetBSD: conf.c,v 1.40 1996/04/11 19:20:03 thorpej Exp $ */
/*
@@ -132,6 +132,8 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -188,7 +190,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 47 */
cdev_notdef(), /* 48 */
cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c
index 653ac487b94..d0d57e22c43 100644
--- a/sys/arch/sparc/sparc/trap.c
+++ b/sys/arch/sparc/sparc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.37 2002/03/26 01:00:30 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.38 2002/05/16 21:11:18 miod Exp $ */
/* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */
/*
@@ -65,6 +65,9 @@
#include <sys/ktrace.h>
#endif
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <sparc/sparc/asm.h>
@@ -1100,7 +1103,12 @@ syscall(code, tf, pc)
#endif
rval[0] = 0;
rval[1] = tf->tf_out[1];
- error = (*callp->sy_call)(p, &args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, &args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, &args, rval);
switch (error) {
case 0:
diff --git a/sys/arch/sparc64/sparc64/conf.c b/sys/arch/sparc64/sparc64/conf.c
index 16133e3f147..cc1ba43e763 100644
--- a/sys/arch/sparc64/sparc64/conf.c
+++ b/sys/arch/sparc64/sparc64/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.29 2002/03/15 20:46:11 jason Exp $ */
+/* $OpenBSD: conf.c,v 1.30 2002/05/16 21:11:18 miod Exp $ */
/* $NetBSD: conf.c,v 1.17 2001/03/26 12:33:26 lukem Exp $ */
/*
@@ -132,6 +132,8 @@ cdev_decl(xfs_dev);
#include "ksyms.h"
#include "inet.h"
+#include "systrace.h"
+
struct bdevsw bdevsw[] =
{
bdev_notdef(), /* 0 */
@@ -215,7 +217,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 47 */
cdev_notdef(), /* 48 */
cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 2abccb51f90..98b919289b5 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.18 2002/03/26 01:00:30 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.19 2002/05/16 21:11:18 miod Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -67,6 +67,9 @@
#include <sys/ktrace.h>
#endif
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <machine/cpu.h>
@@ -1360,7 +1363,12 @@ syscall(tf, code, pc)
#endif
rval[0] = 0;
rval[1] = tf->tf_out[1];
- error = (*callp->sy_call)(p, &args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, &args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, &args, rval);
switch (error) {
vaddr_t dest;
diff --git a/sys/arch/sun3/sun3/conf.c b/sys/arch/sun3/sun3/conf.c
index 2a9917fab18..3f1ebfef1d4 100644
--- a/sys/arch/sun3/sun3/conf.c
+++ b/sys/arch/sun3/sun3/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.31 2001/12/11 23:19:02 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.32 2002/05/16 21:11:18 miod Exp $ */
/* $NetBSD: conf.c,v 1.51 1996/11/04 16:16:09 gwr Exp $ */
/*-
@@ -113,6 +113,8 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -205,6 +207,7 @@ struct cdevsw cdevsw[] =
cdev_ch_init(NCH,ch), /* 83: SCSI autochanger */
cdev_ses_init(NSES,ses), /* 84: SCSI SES or SAF-TE device */
cdev_altq_init(NALTQ,altq), /* 85: ALTQ control interface */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 86: system call tracing */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
diff --git a/sys/arch/sun3/sun3/trap.c b/sys/arch/sun3/sun3/trap.c
index 0605c2ecf8e..492957233be 100644
--- a/sys/arch/sun3/sun3/trap.c
+++ b/sys/arch/sun3/sun3/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.32 2002/03/14 01:26:47 millert Exp $ */
+/* $OpenBSD: trap.c,v 1.33 2002/05/16 21:11:18 miod Exp $ */
/* $NetBSD: trap.c,v 1.63-1.65ish 1997/01/16 15:41:40 gwr Exp $ */
/*
@@ -58,6 +58,9 @@
#include <sys/ktrace.h>
#endif
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <uvm/uvm_pmap.h>
@@ -704,7 +707,12 @@ syscall(code, frame)
goto bad;
rval[0] = 0;
rval[1] = frame.f_regs[D1];
- error = (*callp->sy_call)(p, args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ error = systrace_redirect(code, p, args, rval);
+ else
+#endif
+ error = (*callp->sy_call)(p, args, rval);
switch (error) {
case 0:
frame.f_regs[D0] = rval[0];
diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c
index 2ad52c41d5e..1f265f7a9e5 100644
--- a/sys/arch/vax/vax/conf.c
+++ b/sys/arch/vax/vax/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.33 2002/03/14 01:26:48 millert Exp $ */
+/* $OpenBSD: conf.c,v 1.34 2002/05/16 21:11:19 miod Exp $ */
/* $NetBSD: conf.c,v 1.44 1999/10/27 16:38:54 ragge Exp $ */
/*-
@@ -404,6 +404,8 @@ cdev_decl(xfs_dev);
#include <altq/altqconf.h>
+#include "systrace.h"
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -455,7 +457,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 46 was Datakit */
cdev_notdef(), /* 47 */
cdev_notdef(), /* 48 */
- cdev_notdef(), /* 49 */
+ cdev_systrace_init(NSYSTRACE,systrace), /* 49: system call tracing */
cdev_ksyms_init(NKSYMS,ksyms), /* 50: Kernel symbols device */
cdev_cnstore_init(NCRX,crx), /* 51: Console RX50 at 8200 */
cdev_notdef(), /* 52: was: KDB50/RA?? */
diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c
index d9291ea47c1..19d5f75218b 100644
--- a/sys/arch/vax/vax/trap.c
+++ b/sys/arch/vax/vax/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.23 2002/05/16 07:37:44 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.24 2002/05/16 21:11:19 miod Exp $ */
/* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -40,6 +40,9 @@
#include <sys/signalvar.h>
#include <sys/exec.h>
+#include "systrace.h"
+#include <dev/systrace.h>
+
#include <uvm/uvm_extern.h>
#include <machine/mtpr.h>
@@ -435,7 +438,12 @@ if(startsysc)printf("trap syscall %s pc %lx, psl %lx, sp %lx, pid %d, frame %p\n
if (KTRPOINT(p, KTR_SYSCALL))
ktrsyscall(p, frame->code, callp->sy_argsize, args);
#endif
- err = (*callp->sy_call)(curproc, args, rval);
+#if NSYSTRACE > 0
+ if (ISSET(p->p_flag, P_SYSTRACE))
+ err = systrace_redirect(frame->code, curproc, args, rval);
+ else
+#endif
+ err = (*callp->sy_call)(curproc, args, rval);
exptr = curproc->p_addr->u_pcb.framep;
#ifdef TRAPDEBUG
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 3e5bba3cde3..ac83db19eab 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.53 2002/05/16 16:16:51 provos Exp $ */
+/* $OpenBSD: conf.h,v 1.54 2002/05/16 21:11:19 miod Exp $ */
/* $NetBSD: conf.h,v 1.33 1996/05/03 20:03:32 christos Exp $ */
/*-
@@ -567,4 +567,6 @@ cdev_decl(wsmux);
#endif
cdev_decl(svr4_net);
+cdev_decl(systrace);
+
#endif