Skip to content

Commit

Permalink
sparc: Use tracehook routines in syscall_trace().
Browse files Browse the repository at this point in the history
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jul 28, 2008
1 parent 7682258 commit 1c133b4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
12 changes: 10 additions & 2 deletions arch/sparc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1337,6 +1342,7 @@ syscall_is_too_hard:
call %l7
mov %i5, %o5

3:
st %o0, [%sp + STACKFRAME_SZ + PT_I0]

ret_sys_call:
Expand Down Expand Up @@ -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]
Expand Down
26 changes: 11 additions & 15 deletions arch/sparc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
}

0 comments on commit 1c133b4

Please sign in to comment.