diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-07-30 06:55:30 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-08-01 15:39:33 -0400 |
commit | ab99c733ae73cce31f2a2434f7099564e5a73d95 (patch) | |
tree | c9eb381f05688b8b4e79d2ffe495b4d4b302f2d4 /arch/sh/kernel/signal_32.c | |
parent | c459dbf294b4a3d70490a468a7ca3907fb2c2f57 (diff) |
sh: Make syscall tracer use tracehook notifiers, add TIF_NOTIFY_RESUME.
This follows the changes in commits:
7d6d637dac2050f30a1b57b0a3dc5de4a10616ba
4f72c4279eab1e5f3ed1ac4e55d4527617582392
on powerpc. Adding in TIF_NOTIFY_RESUME, and cleaning up the syscall
tracing to be more generic. This is an incremental step to turning
on tracehook, as well as unifying more of the ptrace and signal code
across the 32/64 split.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/signal_32.c')
-rw-r--r-- | arch/sh/kernel/signal_32.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index 4bbbde895a5..51689d29ad4 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/binfmts.h> | 24 | #include <linux/binfmts.h> |
25 | #include <linux/freezer.h> | 25 | #include <linux/freezer.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/tracehook.h> | ||
27 | #include <asm/system.h> | 28 | #include <asm/system.h> |
28 | #include <asm/ucontext.h> | 29 | #include <asm/ucontext.h> |
29 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
@@ -507,14 +508,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
507 | switch (regs->regs[0]) { | 508 | switch (regs->regs[0]) { |
508 | case -ERESTART_RESTARTBLOCK: | 509 | case -ERESTART_RESTARTBLOCK: |
509 | case -ERESTARTNOHAND: | 510 | case -ERESTARTNOHAND: |
511 | no_system_call_restart: | ||
510 | regs->regs[0] = -EINTR; | 512 | regs->regs[0] = -EINTR; |
511 | break; | 513 | break; |
512 | 514 | ||
513 | case -ERESTARTSYS: | 515 | case -ERESTARTSYS: |
514 | if (!(ka->sa.sa_flags & SA_RESTART)) { | 516 | if (!(ka->sa.sa_flags & SA_RESTART)) |
515 | regs->regs[0] = -EINTR; | 517 | goto no_system_call_restart; |
516 | break; | ||
517 | } | ||
518 | /* fallthrough */ | 518 | /* fallthrough */ |
519 | case -ERESTARTNOINTR: | 519 | case -ERESTARTNOINTR: |
520 | regs->regs[0] = save_r0; | 520 | regs->regs[0] = save_r0; |
@@ -589,12 +589,15 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
589 | * clear the TIF_RESTORE_SIGMASK flag */ | 589 | * clear the TIF_RESTORE_SIGMASK flag */ |
590 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 590 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
591 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 591 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
592 | |||
593 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
594 | test_thread_flag(TIF_SINGLESTEP)); | ||
592 | } | 595 | } |
593 | 596 | ||
594 | return; | 597 | return; |
595 | } | 598 | } |
596 | 599 | ||
597 | no_signal: | 600 | no_signal: |
598 | /* Did we come from a system call? */ | 601 | /* Did we come from a system call? */ |
599 | if (regs->tra >= 0) { | 602 | if (regs->tra >= 0) { |
600 | /* Restart the system call - no handlers present */ | 603 | /* Restart the system call - no handlers present */ |
@@ -618,9 +621,14 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
618 | } | 621 | } |
619 | 622 | ||
620 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, | 623 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, |
621 | __u32 thread_info_flags) | 624 | unsigned long thread_info_flags) |
622 | { | 625 | { |
623 | /* deal with pending signal delivery */ | 626 | /* deal with pending signal delivery */ |
624 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) | 627 | if (thread_info_flags & _TIF_SIGPENDING) |
625 | do_signal(regs, save_r0); | 628 | do_signal(regs, save_r0); |
629 | |||
630 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | ||
631 | clear_thread_flag(TIF_NOTIFY_RESUME); | ||
632 | tracehook_notify_resume(regs); | ||
633 | } | ||
626 | } | 634 | } |