diff options
author | Roland McGrath <roland@redhat.com> | 2008-07-27 02:52:52 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-28 02:30:50 -0400 |
commit | 7d6d637dac2050f30a1b57b0a3dc5de4a10616ba (patch) | |
tree | 5108cacaf5e204d58bc07afb1d67c73144f1bf55 | |
parent | f1ba12856b7a7d43e495e216bc91e6bbf7aac383 (diff) |
powerpc: Add TIF_NOTIFY_RESUME support for tracehook
This adds TIF_NOTIFY_RESUME support for powerpc. When set,
we call tracehook_notify_resume() on the way to user mode.
This overloads do_signal() to do the work, but changes its
arguments to it has the TIF_* bits handy in a register and
drops the useless first argument that was always zero.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/kernel/entry_32.S | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/signal.c | 13 | ||||
-rw-r--r-- | include/asm-powerpc/signal.h | 3 | ||||
-rw-r--r-- | include/asm-powerpc/thread_info.h | 5 |
5 files changed, 20 insertions, 8 deletions
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index e6fca6a9014d..1cbbf7033641 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -1060,8 +1060,8 @@ do_user_signal: /* r10 contains MSR_KERNEL here */ | |||
1060 | SAVE_NVGPRS(r1) | 1060 | SAVE_NVGPRS(r1) |
1061 | rlwinm r3,r3,0,0,30 | 1061 | rlwinm r3,r3,0,0,30 |
1062 | stw r3,_TRAP(r1) | 1062 | stw r3,_TRAP(r1) |
1063 | 2: li r3,0 | 1063 | 2: addi r3,r1,STACK_FRAME_OVERHEAD |
1064 | addi r4,r1,STACK_FRAME_OVERHEAD | 1064 | mr r4,r9 |
1065 | bl do_signal | 1065 | bl do_signal |
1066 | REST_NVGPRS(r1) | 1066 | REST_NVGPRS(r1) |
1067 | b recheck | 1067 | b recheck |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 79c089e97ce4..2d802e97097c 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -643,8 +643,7 @@ user_work: | |||
643 | b .ret_from_except_lite | 643 | b .ret_from_except_lite |
644 | 644 | ||
645 | 1: bl .save_nvgprs | 645 | 1: bl .save_nvgprs |
646 | li r3,0 | 646 | addi r3,r1,STACK_FRAME_OVERHEAD |
647 | addi r4,r1,STACK_FRAME_OVERHEAD | ||
648 | bl .do_signal | 647 | bl .do_signal |
649 | b .ret_from_except | 648 | b .ret_from_except |
650 | 649 | ||
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index e74aa0ed4e9e..a54405ebd7b0 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c | |||
@@ -112,7 +112,7 @@ static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | int do_signal(sigset_t *oldset, struct pt_regs *regs) | 115 | static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs) |
116 | { | 116 | { |
117 | siginfo_t info; | 117 | siginfo_t info; |
118 | int signr; | 118 | int signr; |
@@ -188,6 +188,17 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
188 | return ret; | 188 | return ret; |
189 | } | 189 | } |
190 | 190 | ||
191 | void do_signal(struct pt_regs *regs, unsigned long thread_info_flags) | ||
192 | { | ||
193 | if (thread_info_flags & _TIF_SIGPENDING) | ||
194 | do_signal_pending(NULL, regs); | ||
195 | |||
196 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | ||
197 | clear_thread_flag(TIF_NOTIFY_RESUME); | ||
198 | tracehook_notify_resume(regs); | ||
199 | } | ||
200 | } | ||
201 | |||
191 | long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 202 | long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
192 | unsigned long r5, unsigned long r6, unsigned long r7, | 203 | unsigned long r5, unsigned long r6, unsigned long r7, |
193 | unsigned long r8, struct pt_regs *regs) | 204 | unsigned long r8, struct pt_regs *regs) |
diff --git a/include/asm-powerpc/signal.h b/include/asm-powerpc/signal.h index a8c7babf4950..a7360cdd99eb 100644 --- a/include/asm-powerpc/signal.h +++ b/include/asm-powerpc/signal.h | |||
@@ -122,8 +122,7 @@ typedef struct sigaltstack { | |||
122 | 122 | ||
123 | #ifdef __KERNEL__ | 123 | #ifdef __KERNEL__ |
124 | struct pt_regs; | 124 | struct pt_regs; |
125 | extern int do_signal(sigset_t *oldset, struct pt_regs *regs); | 125 | extern void do_signal(struct pt_regs *regs, unsigned long thread_info_flags); |
126 | extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); | ||
127 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | 126 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) |
128 | #endif /* __KERNEL__ */ | 127 | #endif /* __KERNEL__ */ |
129 | 128 | ||
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h index a9db562df69a..9665a26a253a 100644 --- a/include/asm-powerpc/thread_info.h +++ b/include/asm-powerpc/thread_info.h | |||
@@ -108,6 +108,7 @@ static inline struct thread_info *current_thread_info(void) | |||
108 | #define TIF_SECCOMP 10 /* secure computing */ | 108 | #define TIF_SECCOMP 10 /* secure computing */ |
109 | #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ | 109 | #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ |
110 | #define TIF_NOERROR 12 /* Force successful syscall return */ | 110 | #define TIF_NOERROR 12 /* Force successful syscall return */ |
111 | #define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ | ||
111 | #define TIF_FREEZE 14 /* Freezing for suspend */ | 112 | #define TIF_FREEZE 14 /* Freezing for suspend */ |
112 | #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ | 113 | #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ |
113 | #define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */ | 114 | #define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */ |
@@ -125,12 +126,14 @@ static inline struct thread_info *current_thread_info(void) | |||
125 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 126 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
126 | #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) | 127 | #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) |
127 | #define _TIF_NOERROR (1<<TIF_NOERROR) | 128 | #define _TIF_NOERROR (1<<TIF_NOERROR) |
129 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
128 | #define _TIF_FREEZE (1<<TIF_FREEZE) | 130 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
129 | #define _TIF_RUNLATCH (1<<TIF_RUNLATCH) | 131 | #define _TIF_RUNLATCH (1<<TIF_RUNLATCH) |
130 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) | 132 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) |
131 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) | 133 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) |
132 | 134 | ||
133 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED) | 135 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ |
136 | _TIF_NOTIFY_RESUME) | ||
134 | #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) | 137 | #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) |
135 | 138 | ||
136 | /* Bits in local_flags */ | 139 | /* Bits in local_flags */ |