aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/signal.c')
-rw-r--r--arch/sh/kernel/signal.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 5213f5bc6ce0..379c88bf5d9a 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -23,6 +23,7 @@
23#include <linux/elf.h> 23#include <linux/elf.h>
24#include <linux/personality.h> 24#include <linux/personality.h>
25#include <linux/binfmts.h> 25#include <linux/binfmts.h>
26#include <linux/freezer.h>
26 27
27#include <asm/ucontext.h> 28#include <asm/ucontext.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
@@ -37,7 +38,7 @@
37asmlinkage int 38asmlinkage int
38sys_sigsuspend(old_sigset_t mask, 39sys_sigsuspend(old_sigset_t mask,
39 unsigned long r5, unsigned long r6, unsigned long r7, 40 unsigned long r5, unsigned long r6, unsigned long r7,
40 struct pt_regs regs) 41 struct pt_regs __regs)
41{ 42{
42 mask &= _BLOCKABLE; 43 mask &= _BLOCKABLE;
43 spin_lock_irq(&current->sighand->siglock); 44 spin_lock_irq(&current->sighand->siglock);
@@ -52,7 +53,7 @@ sys_sigsuspend(old_sigset_t mask,
52 return -ERESTARTNOHAND; 53 return -ERESTARTNOHAND;
53} 54}
54 55
55asmlinkage int 56asmlinkage int
56sys_sigaction(int sig, const struct old_sigaction __user *act, 57sys_sigaction(int sig, const struct old_sigaction __user *act,
57 struct old_sigaction __user *oact) 58 struct old_sigaction __user *oact)
58{ 59{
@@ -87,9 +88,11 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
87asmlinkage int 88asmlinkage int
88sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 89sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
89 unsigned long r6, unsigned long r7, 90 unsigned long r6, unsigned long r7,
90 struct pt_regs regs) 91 struct pt_regs __regs)
91{ 92{
92 return do_sigaltstack(uss, uoss, regs.regs[15]); 93 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
94
95 return do_sigaltstack(uss, uoss, regs->regs[15]);
93} 96}
94 97
95 98
@@ -98,7 +101,11 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
98 */ 101 */
99 102
100#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */ 103#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */
101#define TRAP16 0xc310 /* Syscall w/no args (NR in R3) */ 104#if defined(CONFIG_CPU_SH2)
105#define TRAP_NOARG 0xc320 /* Syscall w/no args (NR in R3) */
106#else
107#define TRAP_NOARG 0xc310 /* Syscall w/no args (NR in R3) */
108#endif
102#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */ 109#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */
103 110
104struct sigframe 111struct sigframe
@@ -194,9 +201,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_p
194 201
195asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, 202asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
196 unsigned long r6, unsigned long r7, 203 unsigned long r6, unsigned long r7,
197 struct pt_regs regs) 204 struct pt_regs __regs)
198{ 205{
199 struct sigframe __user *frame = (struct sigframe __user *)regs.regs[15]; 206 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
207 struct sigframe __user *frame = (struct sigframe __user *)regs->regs[15];
200 sigset_t set; 208 sigset_t set;
201 int r0; 209 int r0;
202 210
@@ -216,7 +224,7 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
216 recalc_sigpending(); 224 recalc_sigpending();
217 spin_unlock_irq(&current->sighand->siglock); 225 spin_unlock_irq(&current->sighand->siglock);
218 226
219 if (restore_sigcontext(&regs, &frame->sc, &r0)) 227 if (restore_sigcontext(regs, &frame->sc, &r0))
220 goto badframe; 228 goto badframe;
221 return r0; 229 return r0;
222 230
@@ -227,9 +235,10 @@ badframe:
227 235
228asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, 236asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
229 unsigned long r6, unsigned long r7, 237 unsigned long r6, unsigned long r7,
230 struct pt_regs regs) 238 struct pt_regs __regs)
231{ 239{
232 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.regs[15]; 240 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
241 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->regs[15];
233 sigset_t set; 242 sigset_t set;
234 stack_t st; 243 stack_t st;
235 int r0; 244 int r0;
@@ -246,14 +255,14 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
246 recalc_sigpending(); 255 recalc_sigpending();
247 spin_unlock_irq(&current->sighand->siglock); 256 spin_unlock_irq(&current->sighand->siglock);
248 257
249 if (restore_sigcontext(&regs, &frame->uc.uc_mcontext, &r0)) 258 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
250 goto badframe; 259 goto badframe;
251 260
252 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) 261 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
253 goto badframe; 262 goto badframe;
254 /* It is more difficult to avoid calling this function than to 263 /* It is more difficult to avoid calling this function than to
255 call it and ignore errors. */ 264 call it and ignore errors. */
256 do_sigaltstack(&st, NULL, regs.regs[15]); 265 do_sigaltstack(&st, NULL, regs->regs[15]);
257 266
258 return r0; 267 return r0;
259 268
@@ -350,7 +359,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
350 } else { 359 } else {
351 /* Generate return code (system call to sigreturn) */ 360 /* Generate return code (system call to sigreturn) */
352 err |= __put_user(MOVW(7), &frame->retcode[0]); 361 err |= __put_user(MOVW(7), &frame->retcode[0]);
353 err |= __put_user(TRAP16, &frame->retcode[1]); 362 err |= __put_user(TRAP_NOARG, &frame->retcode[1]);
354 err |= __put_user(OR_R0_R0, &frame->retcode[2]); 363 err |= __put_user(OR_R0_R0, &frame->retcode[2]);
355 err |= __put_user(OR_R0_R0, &frame->retcode[3]); 364 err |= __put_user(OR_R0_R0, &frame->retcode[3]);
356 err |= __put_user(OR_R0_R0, &frame->retcode[4]); 365 err |= __put_user(OR_R0_R0, &frame->retcode[4]);
@@ -430,7 +439,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
430 } else { 439 } else {
431 /* Generate return code (system call to rt_sigreturn) */ 440 /* Generate return code (system call to rt_sigreturn) */
432 err |= __put_user(MOVW(7), &frame->retcode[0]); 441 err |= __put_user(MOVW(7), &frame->retcode[0]);
433 err |= __put_user(TRAP16, &frame->retcode[1]); 442 err |= __put_user(TRAP_NOARG, &frame->retcode[1]);
434 err |= __put_user(OR_R0_R0, &frame->retcode[2]); 443 err |= __put_user(OR_R0_R0, &frame->retcode[2]);
435 err |= __put_user(OR_R0_R0, &frame->retcode[3]); 444 err |= __put_user(OR_R0_R0, &frame->retcode[3]);
436 err |= __put_user(OR_R0_R0, &frame->retcode[4]); 445 err |= __put_user(OR_R0_R0, &frame->retcode[4]);