sparc: Use tracehook routines in syscall_trace().
authorDavid S. Miller <davem@davemloft.net>
Sun, 27 Jul 2008 10:13:13 +0000 (03:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jul 2008 00:33:14 +0000 (17:33 -0700)
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/entry.S
arch/sparc/kernel/ptrace.c

index 2f96256..e8cdf71 100644 (file)
@@ -1196,8 +1196,9 @@ sys_rt_sigreturn:
        be      1f
         nop
 
+       add     %sp, STACKFRAME_SZ, %o0
        call    syscall_trace
-        nop
+        mov    1, %o1
 
 1:
        /* We are returning to a signal handler. */
@@ -1287,8 +1288,12 @@ linux_fast_syscall:
         mov    %i3, %o3
 
 linux_syscall_trace:
+       add     %sp, STACKFRAME_SZ, %o0
        call    syscall_trace
-        nop
+        mov    0, %o1
+       cmp     %o0, 0
+       bne     3f
+        mov    -ENOSYS, %o0
        mov     %i0, %o0
        mov     %i1, %o1
        mov     %i2, %o2
@@ -1337,6 +1342,7 @@ syscall_is_too_hard:
        call    %l7
         mov    %i5, %o5
 
+3:
        st      %o0, [%sp + STACKFRAME_SZ + PT_I0]
 
 ret_sys_call:
@@ -1374,6 +1380,8 @@ ret_sys_call:
         st     %l2, [%sp + STACKFRAME_SZ + PT_NPC]
 
 linux_syscall_trace2:
+       add     %sp, STACKFRAME_SZ, %o0
+       mov     1, %o1
        call    syscall_trace
         add    %l1, 0x4, %l2                   /* npc = npc+4 */
        st      %l1, [%sp + STACKFRAME_SZ + PT_PC]
index 81f3b92..20699c7 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/signal.h>
 #include <linux/regset.h>
 #include <linux/elf.h>
+#include <linux/tracehook.h>
 
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -450,21 +451,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        return ret;
 }
 
-asmlinkage void syscall_trace(void)
+asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p)
 {
-       if (!test_thread_flag(TIF_SYSCALL_TRACE))
-               return;
-       if (!(current->ptrace & PT_PTRACED))
-               return;
-       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-                                ? 0x80 : 0));
-       /*
-        * this isn't the same as continuing with a signal, but it will do
-        * for normal use.  strace only continues with a signal if the
-        * stopping signal is not SIGTRAP.  -brl
-        */
-       if (current->exit_code) {
-               send_sig (current->exit_code, current, 1);
-               current->exit_code = 0;
+       int ret = 0;
+
+       if (test_thread_flag(TIF_SYSCALL_TRACE)) {
+               if (syscall_exit_p)
+                       tracehook_report_syscall_exit(regs, 0);
+               else
+                       ret = tracehook_report_syscall_entry(regs);
        }
+
+       return ret;
 }