aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300/kernel/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/h8300/kernel/signal.c')
-rw-r--r--arch/h8300/kernel/signal.c72
1 files changed, 8 insertions, 64 deletions
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
index 0e81b96c642f..a65ff3b76326 100644
--- a/arch/h8300/kernel/signal.c
+++ b/arch/h8300/kernel/signal.c
@@ -47,56 +47,6 @@
47#include <asm/ucontext.h> 47#include <asm/ucontext.h>
48 48
49/* 49/*
50 * Atomically swap in the new signal mask, and wait for a signal.
51 */
52asmlinkage int
53sys_sigsuspend(int unused1, int unused2, old_sigset_t mask)
54{
55 sigset_t blocked;
56 siginitset(&blocked, mask);
57 return sigsuspend(&blocked);
58}
59
60asmlinkage int
61sys_sigaction(int sig, const struct old_sigaction *act,
62 struct old_sigaction *oact)
63{
64 struct k_sigaction new_ka, old_ka;
65 int ret;
66
67 if (act) {
68 old_sigset_t mask;
69 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
70 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
71 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
72 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
73 __get_user(mask, &act->sa_mask))
74 return -EFAULT;
75 siginitset(&new_ka.sa.sa_mask, mask);
76 }
77
78 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
79
80 if (!ret && oact) {
81 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
82 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
83 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
84 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
85 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
86 return -EFAULT;
87 }
88
89 return ret;
90}
91
92asmlinkage int
93sys_sigaltstack(const stack_t *uss, stack_t *uoss)
94{
95 return do_sigaltstack(uss, uoss, rdusp());
96}
97
98
99/*
100 * Do a signal return; undo the signal stack. 50 * Do a signal return; undo the signal stack.
101 * 51 *
102 * Keep the return code on the stack quadword aligned! 52 * Keep the return code on the stack quadword aligned!
@@ -136,9 +86,9 @@ struct rt_sigframe
136} __attribute__((aligned(2),packed)); 86} __attribute__((aligned(2),packed));
137 87
138static inline int 88static inline int
139restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, 89restore_sigcontext(struct sigcontext *usc, int *pd0)
140 int *pd0)
141{ 90{
91 struct pt_regs *regs = current_pt_regs();
142 int err = 0; 92 int err = 0;
143 unsigned int ccr; 93 unsigned int ccr;
144 unsigned int usp; 94 unsigned int usp;
@@ -167,9 +117,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc,
167 return err; 117 return err;
168} 118}
169 119
170asmlinkage int do_sigreturn(unsigned long __unused,...) 120asmlinkage int sys_sigreturn(void)
171{ 121{
172 struct pt_regs *regs = (struct pt_regs *) (&__unused - 1);
173 unsigned long usp = rdusp(); 122 unsigned long usp = rdusp();
174 struct sigframe *frame = (struct sigframe *)(usp - 4); 123 struct sigframe *frame = (struct sigframe *)(usp - 4);
175 sigset_t set; 124 sigset_t set;
@@ -185,7 +134,7 @@ asmlinkage int do_sigreturn(unsigned long __unused,...)
185 134
186 set_current_blocked(&set); 135 set_current_blocked(&set);
187 136
188 if (restore_sigcontext(regs, &frame->sc, &er0)) 137 if (restore_sigcontext(&frame->sc, &er0))
189 goto badframe; 138 goto badframe;
190 return er0; 139 return er0;
191 140
@@ -194,9 +143,8 @@ badframe:
194 return 0; 143 return 0;
195} 144}
196 145
197asmlinkage int do_rt_sigreturn(unsigned long __unused,...) 146asmlinkage int sys_rt_sigreturn(void)
198{ 147{
199 struct pt_regs *regs = (struct pt_regs *) &__unused;
200 unsigned long usp = rdusp(); 148 unsigned long usp = rdusp();
201 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4); 149 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4);
202 sigset_t set; 150 sigset_t set;
@@ -209,10 +157,10 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused,...)
209 157
210 set_current_blocked(&set); 158 set_current_blocked(&set);
211 159
212 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0)) 160 if (restore_sigcontext(&frame->uc.uc_mcontext, &er0))
213 goto badframe; 161 goto badframe;
214 162
215 if (do_sigaltstack(&frame->uc.uc_stack, NULL, usp) == -EFAULT) 163 if (restore_altstack(&frame->uc.uc_stack))
216 goto badframe; 164 goto badframe;
217 165
218 return er0; 166 return er0;
@@ -358,11 +306,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
358 /* Create the ucontext. */ 306 /* Create the ucontext. */
359 err |= __put_user(0, &frame->uc.uc_flags); 307 err |= __put_user(0, &frame->uc.uc_flags);
360 err |= __put_user(0, &frame->uc.uc_link); 308 err |= __put_user(0, &frame->uc.uc_link);
361 err |= __put_user((void *)current->sas_ss_sp, 309 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
362 &frame->uc.uc_stack.ss_sp);
363 err |= __put_user(sas_ss_flags(rdusp()),
364 &frame->uc.uc_stack.ss_flags);
365 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
366 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 310 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
367 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); 311 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
368 if (err) 312 if (err)