Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch SH5 systrace(5) glue.



details:   https://anonhg.NetBSD.org/src/rev/ac25b23873f0
branches:  trunk
changeset: 534010:ac25b23873f0
user:      scw <scw%NetBSD.org@localhost>
date:      Fri Jul 12 20:43:12 2002 +0000

description:
SH5 systrace(5) glue.

diffstat:

 sys/arch/evbsh5/conf/CAYMAN    |   7 ++++---
 sys/arch/evbsh5/conf/SIMULATOR |   7 ++++---
 sys/arch/sh5/sh5/conf.c        |   8 +++++++-
 sys/arch/sh5/sh5/syscall.c     |  29 +++++++++++++----------------
 4 files changed, 28 insertions(+), 23 deletions(-)

diffs (156 lines):

diff -r 14705f698ca7 -r ac25b23873f0 sys/arch/evbsh5/conf/CAYMAN
--- a/sys/arch/evbsh5/conf/CAYMAN       Fri Jul 12 20:41:55 2002 +0000
+++ b/sys/arch/evbsh5/conf/CAYMAN       Fri Jul 12 20:43:12 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: CAYMAN,v 1.2 2002/07/12 19:33:28 scw Exp $
+#      $NetBSD: CAYMAN,v 1.3 2002/07/12 20:43:12 scw Exp $
 
 #
 # Config file for SuperH "CAYMAN" SH-5 Evaluation board
@@ -10,7 +10,7 @@
 
 options        INCLUDE_CONFIG_FILE
 
-#ident         "CAYMAN-$Revision: 1.2 $"
+#ident         "CAYMAN-$Revision: 1.3 $"
 
 options        CPU_STB1
 
@@ -21,7 +21,8 @@
 options        DEBUG
 #options       DDB
 
-options        KTRACE
+options        KTRACE          # system call tracing via ktrace(1)
+options        SYSTRACE        # system call vetting via systrace(1)
 
 file-system    FFS
 file-system    NFS
diff -r 14705f698ca7 -r ac25b23873f0 sys/arch/evbsh5/conf/SIMULATOR
--- a/sys/arch/evbsh5/conf/SIMULATOR    Fri Jul 12 20:41:55 2002 +0000
+++ b/sys/arch/evbsh5/conf/SIMULATOR    Fri Jul 12 20:43:12 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: SIMULATOR,v 1.4 2002/07/12 20:41:55 scw Exp $
+#      $NetBSD: SIMULATOR,v 1.5 2002/07/12 20:43:12 scw Exp $
 
 # NetBSD/sh5 on the simple `chess' based simulator.
 #
@@ -11,7 +11,7 @@
 
 options        INCLUDE_CONFIG_FILE
 
-#ident         "SIMULATOR-$Revision: 1.4 $"
+#ident         "SIMULATOR-$Revision: 1.5 $"
 
 options        CPU_STB1
 
@@ -22,7 +22,8 @@
 options        DEBUG
 #options       DDB
 
-options        KTRACE
+options        KTRACE          # system call tracing via ktrace(1)
+options        SYSTRACE        # system call vetting via systrace(1)
 
 file-system    FFS
 file-system    NFS
diff -r 14705f698ca7 -r ac25b23873f0 sys/arch/sh5/sh5/conf.c
--- a/sys/arch/sh5/sh5/conf.c   Fri Jul 12 20:41:55 2002 +0000
+++ b/sys/arch/sh5/sh5/conf.c   Fri Jul 12 20:43:12 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.c,v 1.1 2002/07/05 13:32:03 scw Exp $     */
+/*     $NetBSD: conf.c,v 1.2 2002/07/12 20:43:12 scw Exp $     */
 
 /*
  * Copyright (c) 1994, 1995 Charles M. Hannum.  All rights reserved.
@@ -29,6 +29,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_systrace.h"
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/buf.h>
@@ -193,6 +194,11 @@
        cdev_esh_init(NESH, esh_fp),    /* 50: HIPPI (esh) raw device */
        cdev_notdef(),                  /* 51 */
        cdev_clockctl_init(NCLOCKCTL, clockctl),/* 52: clockctl pseudo device */
+#ifdef SYSTRACE
+        cdev_systrace_init(1, systrace),/* 53: system call tracing */
+#else
+       cdev_notdef(),                  /* 53: system call tracing */
+#endif
 };
 int    nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
 
diff -r 14705f698ca7 -r ac25b23873f0 sys/arch/sh5/sh5/syscall.c
--- a/sys/arch/sh5/sh5/syscall.c        Fri Jul 12 20:41:55 2002 +0000
+++ b/sys/arch/sh5/sh5/syscall.c        Fri Jul 12 20:43:12 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syscall.c,v 1.2 2002/07/05 14:05:58 scw Exp $  */
+/*     $NetBSD: syscall.c,v 1.3 2002/07/12 20:43:12 scw Exp $  */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -131,6 +131,7 @@
 
 #include "opt_syscall_debug.h"
 #include "opt_ktrace.h"
+#include "opt_systrace.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -143,6 +144,9 @@
 #ifdef KTRACE
 #include <sys/ktrace.h>
 #endif
+#ifdef SYSTRACE
+#include <sys/systrace.h>
+#endif
 
 #include <machine/cpu.h>
 #include <machine/trap.h>
@@ -162,6 +166,11 @@
                p->p_md.md_syscall = syscall_fancy;
        else
 #endif
+#ifdef SYSTRACE
+       if (ISSET(p->p_flag, P_SYSTRACE))
+               p->p_md.md_syscall = syscall_fancy;
+       else
+#endif
                p->p_md.md_syscall = syscall_plain;
 }
 
@@ -328,13 +337,8 @@
 
        args += hidden;
 
-#ifdef KTRACE
-       if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p, code, args);
-#endif
-#ifdef SYSCALL_DEBUG
-       scdebug_call(p, code, args);
-#endif
+       if ((error = trace_enter(p, code, args, rval)) != 0)
+               goto bad;
 
        rval[0] = 0;
        rval[1] = tf->tf_caller.r3;
@@ -360,14 +364,7 @@
                break;
        }
 
-#ifdef SYSCALL_DEBUG
-       scdebug_ret(p, code, error, rval)
-#endif
-
-#ifdef KTRACE
-       if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p, code, error, rval[0]);
-#endif
+       trace_exit(p, code, args, rval, error);
 }
 
 int



Home | Main Index | Thread Index | Old Index