Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode/usermode add required trace_enter/trace_ex...



details:   https://anonhg.NetBSD.org/src/rev/eeafcd161a6a
branches:  trunk
changeset: 772047:eeafcd161a6a
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Dec 15 11:23:52 2011 +0000

description:
add required trace_enter/trace_exit calls in syscall() to make ktrace work

diffstat:

 sys/arch/usermode/usermode/syscall.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 301935c0c833 -r eeafcd161a6a sys/arch/usermode/usermode/syscall.c
--- a/sys/arch/usermode/usermode/syscall.c      Thu Dec 15 11:13:25 2011 +0000
+++ b/sys/arch/usermode/usermode/syscall.c      Thu Dec 15 11:23:52 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.17 2011/12/12 19:59:21 reinoud Exp $ */
+/* $NetBSD: syscall.c,v 1.18 2011/12/15 11:23:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.17 2011/12/12 19:59:21 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.18 2011/12/15 11:23:52 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -129,8 +129,18 @@
 
        md_syscall_inc_pc(ucp, opcode);
 
-       if (!error) 
-               error = (*callp->sy_call)(l, args, rval);
+       if (!error) {
+               if (!__predict_false(p->p_trace_enabled)
+                   || __predict_false(callp->sy_flags & SYCALL_INDIRECT)
+                   || (error = trace_enter(code, args, callp->sy_narg)) == 0) {
+                       error = (*callp->sy_call)(l, args, rval);
+               }
+
+               if (__predict_false(p->p_trace_enabled)
+                   && !__predict_false(callp->sy_flags & SYCALL_INDIRECT)) {
+                       trace_exit(code, rval, error);
+               }
+       }
 
        syscall_retvals_print(l, curlwp, code, nargs, args, error, rval);
 



Home | Main Index | Thread Index | Old Index