aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-27 06:38:53 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-27 20:33:37 -0400
commit5a157d5bf8288eaa86ec269a966559594ddd542e (patch)
tree0597106130ba8cb31878d13a03b32fb9d1dc8944 /arch/sparc
parent1c133b4b3d58bf88293eeea0d9d090777333bf48 (diff)
sparc: Create and use TIF_NOTIFY_RESUME.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/include/asm/thread_info_32.h7
-rw-r--r--arch/sparc/kernel/rtrap.S5
-rw-r--r--arch/sparc/kernel/signal.c14
3 files changed, 22 insertions, 4 deletions
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index 2cf9db044055..cbb892d0dff0 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -130,7 +130,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
130 * thread information flag bit numbers 130 * thread information flag bit numbers
131 */ 131 */
132#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 132#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
133/* flag bit 1 is available */ 133#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
134#define TIF_SIGPENDING 2 /* signal pending */ 134#define TIF_SIGPENDING 2 /* signal pending */
135#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 135#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
136#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ 136#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
@@ -142,12 +142,17 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
142 142
143/* as above, but as bit values */ 143/* as above, but as bit values */
144#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 144#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
145#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
145#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 146#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
146#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 147#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
147#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 148#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
148#define _TIF_USEDFPU (1<<TIF_USEDFPU) 149#define _TIF_USEDFPU (1<<TIF_USEDFPU)
149#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 150#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
150 151
152#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
153 _TIF_SIGPENDING | \
154 _TIF_RESTORE_SIGMASK)
155
151#endif /* __KERNEL__ */ 156#endif /* __KERNEL__ */
152 157
153#endif /* _ASM_THREAD_INFO_H */ 158#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap.S
index 891f460b7b96..4da2e1f66290 100644
--- a/arch/sparc/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap.S
@@ -69,12 +69,13 @@ ret_trap_lockless_ipi:
69 69
70 ld [%curptr + TI_FLAGS], %g2 70 ld [%curptr + TI_FLAGS], %g2
71signal_p: 71signal_p:
72 andcc %g2, (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %g0 72 andcc %g2, _TIF_DO_NOTIFY_RESUME_MASK, %g0
73 bz,a ret_trap_continue 73 bz,a ret_trap_continue
74 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr 74 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
75 75
76 mov %g2, %o2
76 mov %l5, %o1 77 mov %l5, %o1
77 call do_signal 78 call do_notify_resume
78 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr 79 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr
79 80
80 /* Fall through. */ 81 /* Fall through. */
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 3fd1df9f9ba7..bee6ba34e021 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -18,6 +18,7 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/binfmts.h> /* do_coredum */ 19#include <linux/binfmts.h> /* do_coredum */
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/tracehook.h>
21 22
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
@@ -513,7 +514,7 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
513 * want to handle. Thus you cannot kill init even with a SIGKILL even by 514 * want to handle. Thus you cannot kill init even with a SIGKILL even by
514 * mistake. 515 * mistake.
515 */ 516 */
516asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0) 517static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
517{ 518{
518 struct k_sigaction ka; 519 struct k_sigaction ka;
519 int restart_syscall; 520 int restart_syscall;
@@ -579,6 +580,17 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0)
579 } 580 }
580} 581}
581 582
583void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
584 unsigned long thread_info_flags)
585{
586 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
587 do_signal(regs, orig_i0);
588 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
589 clear_thread_flag(TIF_NOTIFY_RESUME);
590 tracehook_notify_resume(regs);
591 }
592}
593
582asmlinkage int 594asmlinkage int
583do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr, 595do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr,
584 unsigned long sp) 596 unsigned long sp)