diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-10-10 15:33:20 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-10-10 15:33:57 -0400 |
commit | 753c4dd6a2fa2af81f5d809d610d29f2d9dd9bc1 (patch) | |
tree | c6c1869a58357945e501b2eba3485ca154ee2f07 /arch/s390/kernel/entry64.S | |
parent | d86730bb9597b02bff59a3a5a01c0094d71a265f (diff) |
[S390] ptrace changes
* System call parameter and result access functions
* Add tracehook calls
* Split syscall_trace into two functions do_syscall_trace_enter and
do_syscall_trace_exit
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/entry64.S')
-rw-r--r-- | arch/s390/kernel/entry64.S | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index fee10177dbfc..d7ce150453f2 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -52,9 +52,9 @@ SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE | |||
52 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER | 52 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER |
53 | STACK_SIZE = 1 << STACK_SHIFT | 53 | STACK_SIZE = 1 << STACK_SHIFT |
54 | 54 | ||
55 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ | 55 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
56 | _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) | 56 | _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) |
57 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ | 57 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
58 | _TIF_MCCK_PENDING) | 58 | _TIF_MCCK_PENDING) |
59 | 59 | ||
60 | #define BASED(name) name-system_call(%r13) | 60 | #define BASED(name) name-system_call(%r13) |
@@ -310,6 +310,8 @@ sysc_work: | |||
310 | jo sysc_reschedule | 310 | jo sysc_reschedule |
311 | tm __TI_flags+7(%r9),_TIF_SIGPENDING | 311 | tm __TI_flags+7(%r9),_TIF_SIGPENDING |
312 | jnz sysc_sigpending | 312 | jnz sysc_sigpending |
313 | tm __TI_flags+7(%r9),_TIF_NOTIFY_RESUME | ||
314 | jnz sysc_notify_resume | ||
313 | tm __TI_flags+7(%r9),_TIF_RESTART_SVC | 315 | tm __TI_flags+7(%r9),_TIF_RESTART_SVC |
314 | jo sysc_restart | 316 | jo sysc_restart |
315 | tm __TI_flags+7(%r9),_TIF_SINGLE_STEP | 317 | tm __TI_flags+7(%r9),_TIF_SINGLE_STEP |
@@ -345,6 +347,14 @@ sysc_sigpending: | |||
345 | j sysc_work_loop | 347 | j sysc_work_loop |
346 | 348 | ||
347 | # | 349 | # |
350 | # _TIF_NOTIFY_RESUME is set, call do_notify_resume | ||
351 | # | ||
352 | sysc_notify_resume: | ||
353 | la %r2,SP_PTREGS(%r15) # load pt_regs | ||
354 | larl %r14,sysc_work_loop | ||
355 | jg do_notify_resume # call do_notify_resume | ||
356 | |||
357 | # | ||
348 | # _TIF_RESTART_SVC is set, set up registers and restart svc | 358 | # _TIF_RESTART_SVC is set, set up registers and restart svc |
349 | # | 359 | # |
350 | sysc_restart: | 360 | sysc_restart: |
@@ -367,20 +377,19 @@ sysc_singlestep: | |||
367 | jg do_single_step # branch to do_sigtrap | 377 | jg do_single_step # branch to do_sigtrap |
368 | 378 | ||
369 | # | 379 | # |
370 | # call syscall_trace before and after system call | 380 | # call tracehook_report_syscall_entry/tracehook_report_syscall_exit before |
371 | # special linkage: %r12 contains the return address for trace_svc | 381 | # and after the system call |
372 | # | 382 | # |
373 | sysc_tracesys: | 383 | sysc_tracesys: |
374 | la %r2,SP_PTREGS(%r15) # load pt_regs | 384 | la %r2,SP_PTREGS(%r15) # load pt_regs |
375 | la %r3,0 | 385 | la %r3,0 |
376 | srl %r7,2 | 386 | srl %r7,2 |
377 | stg %r7,SP_R2(%r15) | 387 | stg %r7,SP_R2(%r15) |
378 | brasl %r14,syscall_trace | 388 | brasl %r14,do_syscall_trace_enter |
379 | lghi %r0,NR_syscalls | 389 | lghi %r0,NR_syscalls |
380 | clg %r0,SP_R2(%r15) | 390 | clgr %r0,%r2 |
381 | jnh sysc_tracenogo | 391 | jnh sysc_tracenogo |
382 | lg %r7,SP_R2(%r15) # strace might have changed the | 392 | slag %r7,%r2,2 # *4 |
383 | sll %r7,2 # system call | ||
384 | lgf %r8,0(%r7,%r10) | 393 | lgf %r8,0(%r7,%r10) |
385 | sysc_tracego: | 394 | sysc_tracego: |
386 | lmg %r3,%r6,SP_R3(%r15) | 395 | lmg %r3,%r6,SP_R3(%r15) |
@@ -391,9 +400,8 @@ sysc_tracenogo: | |||
391 | tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) | 400 | tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) |
392 | jz sysc_return | 401 | jz sysc_return |
393 | la %r2,SP_PTREGS(%r15) # load pt_regs | 402 | la %r2,SP_PTREGS(%r15) # load pt_regs |
394 | la %r3,1 | ||
395 | larl %r14,sysc_return # return point is sysc_return | 403 | larl %r14,sysc_return # return point is sysc_return |
396 | jg syscall_trace | 404 | jg do_syscall_trace_exit |
397 | 405 | ||
398 | # | 406 | # |
399 | # a new process exits the kernel with ret_from_fork | 407 | # a new process exits the kernel with ret_from_fork |
@@ -672,6 +680,8 @@ io_work_loop: | |||
672 | jo io_reschedule | 680 | jo io_reschedule |
673 | tm __TI_flags+7(%r9),_TIF_SIGPENDING | 681 | tm __TI_flags+7(%r9),_TIF_SIGPENDING |
674 | jnz io_sigpending | 682 | jnz io_sigpending |
683 | tm __TI_flags+7(%r9),_TIF_NOTIFY_RESUME | ||
684 | jnz io_notify_resume | ||
675 | j io_restore | 685 | j io_restore |
676 | io_work_done: | 686 | io_work_done: |
677 | 687 | ||
@@ -712,6 +722,18 @@ io_sigpending: | |||
712 | TRACE_IRQS_OFF | 722 | TRACE_IRQS_OFF |
713 | j io_work_loop | 723 | j io_work_loop |
714 | 724 | ||
725 | # | ||
726 | # _TIF_NOTIFY_RESUME or is set, call do_notify_resume | ||
727 | # | ||
728 | io_notify_resume: | ||
729 | TRACE_IRQS_ON | ||
730 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts | ||
731 | la %r2,SP_PTREGS(%r15) # load pt_regs | ||
732 | brasl %r14,do_notify_resume # call do_notify_resume | ||
733 | stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts | ||
734 | TRACE_IRQS_OFF | ||
735 | j io_work_loop | ||
736 | |||
715 | /* | 737 | /* |
716 | * External interrupt handler routine | 738 | * External interrupt handler routine |
717 | */ | 739 | */ |