Commit 2798af1a authored by Kyle McMartin's avatar Kyle McMartin Committed by Kyle McMartin

parisc: split syscall_trace into two halves

Instead of fiddling with gr[20], restructure code to return whether
or not to -ENOSYS. (Also do a bit of fiddling to let them take
pt_regs directly instead of re-computing it.)
Signed-off-by: default avatarKyle McMartin <kyle@mcmartin.ca>
parent 5837d42f
......@@ -264,20 +264,19 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
}
#endif
long do_syscall_trace_enter(struct pt_regs *regs)
{
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
tracehook_report_syscall_entry(regs))
return -1L;
return regs->gr[20];
}
void syscall_trace(int why)
void do_syscall_trace_exit(struct pt_regs *regs)
{
struct pt_regs *regs = &current->thread.regs;
int stepping = !!(current->ptrace & (PT_SINGLESTEP|PT_BLOCKSTEP));
if (!test_thread_flag(TIF_SYSCALL_TRACE))
return;
/*
* Report the system call for tracing. Entry tracing can
* decide to abort the call. We handle that by setting an
* invalid syscall number (-1) to force an ENOSYS error.
*/
if (why)
tracehook_report_syscall_exit(regs, 0);
else if (tracehook_report_syscall_entry(regs))
regs->gr[20] = -1; /* force ENOSYS */
if (stepping || test_thread_flag(TIF_SYSCALL_TRACE))
tracehook_report_syscall_exit(regs, stepping);
}
......@@ -288,19 +288,23 @@ tracesys:
STREG %r18,PT_GR18(%r2)
/* Finished saving things for the debugger */
ldi 0,%r26 /* syscall entry */
ldil L%syscall_trace,%r1
copy %r2,%r26
ldil L%do_syscall_trace_enter,%r1
ldil L%tracesys_next,%r2
be R%syscall_trace(%sr7,%r1)
be R%do_syscall_trace_enter(%sr7,%r1)
ldo R%tracesys_next(%r2),%r2
tracesys_next:
/* do_syscall_trace_enter either returned the syscallno, or -1L,
* so we skip restoring the PT_GR20 below, since we pulled it from
* task->thread.regs.gr[20] above.
*/
copy %ret0,%r20
ldil L%sys_call_table,%r1
ldo R%sys_call_table(%r1), %r19
ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */
LDREG TI_TASK(%r1), %r1
LDREG TASK_PT_GR20(%r1), %r20
LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */
LDREG TASK_PT_GR25(%r1), %r25
LDREG TASK_PT_GR24(%r1), %r24
......@@ -337,8 +341,8 @@ tracesys_exit:
#ifdef CONFIG_64BIT
ldo -16(%r30),%r29 /* Reference param save area */
#endif
ldi 1,%r26 /* syscall exit */
bl syscall_trace, %r2
ldo TASK_REGS(%r1),%r26
bl do_syscall_trace_exit,%r2
STREG %r28,TASK_PT_GR28(%r1) /* save return value now */
ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */
LDREG TI_TASK(%r1), %r1
......@@ -359,8 +363,8 @@ tracesys_sigexit:
#ifdef CONFIG_64BIT
ldo -16(%r30),%r29 /* Reference param save area */
#endif
bl syscall_trace, %r2
ldi 1,%r26 /* syscall exit */
bl do_syscall_trace_exit,%r2
ldo TASK_REGS(%r1),%r26
ldil L%syscall_exit_rfi,%r1
be,n R%syscall_exit_rfi(%sr7,%r1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment