diff options
Diffstat (limited to 'arch/blackfin/kernel/signal.c')
-rw-r--r-- | arch/blackfin/kernel/signal.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index 9d90c18fab23..d536f35d1f43 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2004-2009 Analog Devices Inc. | 2 | * Copyright 2004-2010 Analog Devices Inc. |
3 | * | 3 | * |
4 | * Licensed under the GPL-2 or later | 4 | * Licensed under the GPL-2 or later |
5 | */ | 5 | */ |
@@ -12,10 +12,12 @@ | |||
12 | #include <linux/binfmts.h> | 12 | #include <linux/binfmts.h> |
13 | #include <linux/freezer.h> | 13 | #include <linux/freezer.h> |
14 | #include <linux/uaccess.h> | 14 | #include <linux/uaccess.h> |
15 | #include <linux/tracehook.h> | ||
15 | 16 | ||
16 | #include <asm/cacheflush.h> | 17 | #include <asm/cacheflush.h> |
17 | #include <asm/ucontext.h> | 18 | #include <asm/ucontext.h> |
18 | #include <asm/fixed_code.h> | 19 | #include <asm/fixed_code.h> |
20 | #include <asm/syscall.h> | ||
19 | 21 | ||
20 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 22 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
21 | 23 | ||
@@ -49,6 +51,9 @@ rt_restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *p | |||
49 | unsigned long usp = 0; | 51 | unsigned long usp = 0; |
50 | int err = 0; | 52 | int err = 0; |
51 | 53 | ||
54 | /* Always make any pending restarted system calls return -EINTR */ | ||
55 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
56 | |||
52 | #define RESTORE(x) err |= __get_user(regs->x, &sc->sc_##x) | 57 | #define RESTORE(x) err |= __get_user(regs->x, &sc->sc_##x) |
53 | 58 | ||
54 | /* restore passed registers */ | 59 | /* restore passed registers */ |
@@ -205,16 +210,6 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | |||
205 | regs->r1 = (unsigned long)(&frame->info); | 210 | regs->r1 = (unsigned long)(&frame->info); |
206 | regs->r2 = (unsigned long)(&frame->uc); | 211 | regs->r2 = (unsigned long)(&frame->uc); |
207 | 212 | ||
208 | /* | ||
209 | * Clear the trace flag when entering the signal handler, but | ||
210 | * notify any tracer that was single-stepping it. The tracer | ||
211 | * may want to single-step inside the handler too. | ||
212 | */ | ||
213 | if (regs->syscfg & TRACE_BITS) { | ||
214 | regs->syscfg &= ~TRACE_BITS; | ||
215 | ptrace_notify(SIGTRAP); | ||
216 | } | ||
217 | |||
218 | return 0; | 213 | return 0; |
219 | 214 | ||
220 | give_sigsegv: | 215 | give_sigsegv: |
@@ -246,6 +241,11 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) | |||
246 | regs->r0 = regs->orig_r0; | 241 | regs->r0 = regs->orig_r0; |
247 | regs->pc -= 2; | 242 | regs->pc -= 2; |
248 | break; | 243 | break; |
244 | |||
245 | case -ERESTART_RESTARTBLOCK: | ||
246 | regs->p0 = __NR_restart_syscall; | ||
247 | regs->pc -= 2; | ||
248 | break; | ||
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
@@ -314,6 +314,9 @@ asmlinkage void do_signal(struct pt_regs *regs) | |||
314 | * clear the TIF_RESTORE_SIGMASK flag */ | 314 | * clear the TIF_RESTORE_SIGMASK flag */ |
315 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 315 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
316 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 316 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
317 | |||
318 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
319 | test_thread_flag(TIF_SINGLESTEP)); | ||
317 | } | 320 | } |
318 | 321 | ||
319 | return; | 322 | return; |
@@ -332,3 +335,20 @@ asmlinkage void do_signal(struct pt_regs *regs) | |||
332 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | 335 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); |
333 | } | 336 | } |
334 | } | 337 | } |
338 | |||
339 | /* | ||
340 | * notification of userspace execution resumption | ||
341 | */ | ||
342 | asmlinkage void do_notify_resume(struct pt_regs *regs) | ||
343 | { | ||
344 | if (test_thread_flag(TIF_SIGPENDING) || test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
345 | do_signal(regs); | ||
346 | |||
347 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { | ||
348 | clear_thread_flag(TIF_NOTIFY_RESUME); | ||
349 | tracehook_notify_resume(regs); | ||
350 | if (current->replacement_session_keyring) | ||
351 | key_replace_session_keyring(); | ||
352 | } | ||
353 | } | ||
354 | |||