diff options
| author | Kyle McMartin <kyle@mcmartin.ca> | 2009-07-05 14:36:16 -0400 |
|---|---|---|
| committer | Kyle McMartin <kyle@ihatethathostname.lab.bos.redhat.com> | 2009-09-27 23:07:22 -0400 |
| commit | 2798af1abb5d560b926fd07ec58c5dcc6d3484d8 (patch) | |
| tree | 1c3d953ce653784ed8055fad82ef34499c036f27 | |
| parent | 5837d42f8ae9874fd93928c6784b2224f0edd4c9 (diff) | |
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: Kyle McMartin <kyle@mcmartin.ca>
| -rw-r--r-- | arch/parisc/kernel/ptrace.c | 25 | ||||
| -rw-r--r-- | arch/parisc/kernel/syscall.S | 22 |
2 files changed, 25 insertions, 22 deletions
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 2118ed02e886..08f6d2cbf0e0 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
| @@ -264,20 +264,19 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
| 264 | } | 264 | } |
| 265 | #endif | 265 | #endif |
| 266 | 266 | ||
| 267 | long do_syscall_trace_enter(struct pt_regs *regs) | ||
| 268 | { | ||
| 269 | if (test_thread_flag(TIF_SYSCALL_TRACE) && | ||
| 270 | tracehook_report_syscall_entry(regs)) | ||
| 271 | return -1L; | ||
| 272 | |||
| 273 | return regs->gr[20]; | ||
| 274 | } | ||
| 267 | 275 | ||
| 268 | void syscall_trace(int why) | 276 | void do_syscall_trace_exit(struct pt_regs *regs) |
| 269 | { | 277 | { |
| 270 | struct pt_regs *regs = ¤t->thread.regs; | 278 | int stepping = !!(current->ptrace & (PT_SINGLESTEP|PT_BLOCKSTEP)); |
| 271 | 279 | ||
| 272 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 280 | if (stepping || test_thread_flag(TIF_SYSCALL_TRACE)) |
| 273 | return; | 281 | tracehook_report_syscall_exit(regs, stepping); |
| 274 | /* | ||
| 275 | * Report the system call for tracing. Entry tracing can | ||
| 276 | * decide to abort the call. We handle that by setting an | ||
| 277 | * invalid syscall number (-1) to force an ENOSYS error. | ||
| 278 | */ | ||
| 279 | if (why) | ||
| 280 | tracehook_report_syscall_exit(regs, 0); | ||
| 281 | else if (tracehook_report_syscall_entry(regs)) | ||
| 282 | regs->gr[20] = -1; /* force ENOSYS */ | ||
| 283 | } | 282 | } |
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index 07de1bbb69a5..f5f96021caa0 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S | |||
| @@ -288,19 +288,23 @@ tracesys: | |||
| 288 | STREG %r18,PT_GR18(%r2) | 288 | STREG %r18,PT_GR18(%r2) |
| 289 | /* Finished saving things for the debugger */ | 289 | /* Finished saving things for the debugger */ |
| 290 | 290 | ||
| 291 | ldi 0,%r26 /* syscall entry */ | 291 | copy %r2,%r26 |
| 292 | ldil L%syscall_trace,%r1 | 292 | ldil L%do_syscall_trace_enter,%r1 |
| 293 | ldil L%tracesys_next,%r2 | 293 | ldil L%tracesys_next,%r2 |
| 294 | be R%syscall_trace(%sr7,%r1) | 294 | be R%do_syscall_trace_enter(%sr7,%r1) |
| 295 | ldo R%tracesys_next(%r2),%r2 | 295 | ldo R%tracesys_next(%r2),%r2 |
| 296 | 296 | ||
| 297 | tracesys_next: | 297 | tracesys_next: |
| 298 | /* do_syscall_trace_enter either returned the syscallno, or -1L, | ||
| 299 | * so we skip restoring the PT_GR20 below, since we pulled it from | ||
| 300 | * task->thread.regs.gr[20] above. | ||
| 301 | */ | ||
| 302 | copy %ret0,%r20 | ||
| 298 | ldil L%sys_call_table,%r1 | 303 | ldil L%sys_call_table,%r1 |
| 299 | ldo R%sys_call_table(%r1), %r19 | 304 | ldo R%sys_call_table(%r1), %r19 |
| 300 | 305 | ||
| 301 | ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ | 306 | ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ |
| 302 | LDREG TI_TASK(%r1), %r1 | 307 | LDREG TI_TASK(%r1), %r1 |
| 303 | LDREG TASK_PT_GR20(%r1), %r20 | ||
| 304 | LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */ | 308 | LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */ |
| 305 | LDREG TASK_PT_GR25(%r1), %r25 | 309 | LDREG TASK_PT_GR25(%r1), %r25 |
| 306 | LDREG TASK_PT_GR24(%r1), %r24 | 310 | LDREG TASK_PT_GR24(%r1), %r24 |
| @@ -337,8 +341,8 @@ tracesys_exit: | |||
| 337 | #ifdef CONFIG_64BIT | 341 | #ifdef CONFIG_64BIT |
| 338 | ldo -16(%r30),%r29 /* Reference param save area */ | 342 | ldo -16(%r30),%r29 /* Reference param save area */ |
| 339 | #endif | 343 | #endif |
| 340 | ldi 1,%r26 /* syscall exit */ | 344 | ldo TASK_REGS(%r1),%r26 |
| 341 | bl syscall_trace, %r2 | 345 | bl do_syscall_trace_exit,%r2 |
| 342 | STREG %r28,TASK_PT_GR28(%r1) /* save return value now */ | 346 | STREG %r28,TASK_PT_GR28(%r1) /* save return value now */ |
| 343 | ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ | 347 | ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ |
| 344 | LDREG TI_TASK(%r1), %r1 | 348 | LDREG TI_TASK(%r1), %r1 |
| @@ -359,8 +363,8 @@ tracesys_sigexit: | |||
| 359 | #ifdef CONFIG_64BIT | 363 | #ifdef CONFIG_64BIT |
| 360 | ldo -16(%r30),%r29 /* Reference param save area */ | 364 | ldo -16(%r30),%r29 /* Reference param save area */ |
| 361 | #endif | 365 | #endif |
| 362 | bl syscall_trace, %r2 | 366 | bl do_syscall_trace_exit,%r2 |
| 363 | ldi 1,%r26 /* syscall exit */ | 367 | ldo TASK_REGS(%r1),%r26 |
| 364 | 368 | ||
| 365 | ldil L%syscall_exit_rfi,%r1 | 369 | ldil L%syscall_exit_rfi,%r1 |
| 366 | be,n R%syscall_exit_rfi(%sr7,%r1) | 370 | be,n R%syscall_exit_rfi(%sr7,%r1) |
