aboutsummaryrefslogtreecommitdiffstats
path: root/arch/score/kernel/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/score/kernel/signal.c')
-rw-r--r--arch/score/kernel/signal.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c
index a00fba32b0eb..1651807774ad 100644
--- a/arch/score/kernel/signal.c
+++ b/arch/score/kernel/signal.c
@@ -173,15 +173,15 @@ badframe:
173 return 0; 173 return 0;
174} 174}
175 175
176static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, 176static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
177 int signr, sigset_t *set, siginfo_t *info) 177 sigset_t *set)
178{ 178{
179 struct rt_sigframe __user *frame; 179 struct rt_sigframe __user *frame;
180 int err = 0; 180 int err = 0;
181 181
182 frame = get_sigframe(ka, regs, sizeof(*frame)); 182 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
183 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 183 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
184 goto give_sigsegv; 184 return -EFAULT;
185 185
186 /* 186 /*
187 * Set up the return code ... 187 * Set up the return code ...
@@ -194,7 +194,7 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
194 err |= __put_user(0x80008002, frame->rs_code + 1); 194 err |= __put_user(0x80008002, frame->rs_code + 1);
195 flush_cache_sigtramp((unsigned long) frame->rs_code); 195 flush_cache_sigtramp((unsigned long) frame->rs_code);
196 196
197 err |= copy_siginfo_to_user(&frame->rs_info, info); 197 err |= copy_siginfo_to_user(&frame->rs_info, &ksig->info);
198 err |= __put_user(0, &frame->rs_uc.uc_flags); 198 err |= __put_user(0, &frame->rs_uc.uc_flags);
199 err |= __put_user(NULL, &frame->rs_uc.uc_link); 199 err |= __put_user(NULL, &frame->rs_uc.uc_link);
200 err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[0]); 200 err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[0]);
@@ -202,26 +202,23 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
202 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); 202 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
203 203
204 if (err) 204 if (err)
205 goto give_sigsegv; 205 return -EFAULT;
206 206
207 regs->regs[0] = (unsigned long) frame; 207 regs->regs[0] = (unsigned long) frame;
208 regs->regs[3] = (unsigned long) frame->rs_code; 208 regs->regs[3] = (unsigned long) frame->rs_code;
209 regs->regs[4] = signr; 209 regs->regs[4] = ksig->sig;
210 regs->regs[5] = (unsigned long) &frame->rs_info; 210 regs->regs[5] = (unsigned long) &frame->rs_info;
211 regs->regs[6] = (unsigned long) &frame->rs_uc; 211 regs->regs[6] = (unsigned long) &frame->rs_uc;
212 regs->regs[29] = (unsigned long) ka->sa.sa_handler; 212 regs->regs[29] = (unsigned long) ksig->ka.sa.sa_handler;
213 regs->cp0_epc = (unsigned long) ka->sa.sa_handler; 213 regs->cp0_epc = (unsigned long) ksig->ka.sa.sa_handler;
214 214
215 return 0; 215 return 0;
216
217give_sigsegv:
218 force_sigsegv(signr, current);
219 return -EFAULT;
220} 216}
221 217
222static void handle_signal(unsigned long sig, siginfo_t *info, 218static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
223 struct k_sigaction *ka, struct pt_regs *regs)
224{ 219{
220 int ret;
221
225 if (regs->is_syscall) { 222 if (regs->is_syscall) {
226 switch (regs->regs[4]) { 223 switch (regs->regs[4]) {
227 case ERESTART_RESTARTBLOCK: 224 case ERESTART_RESTARTBLOCK:
@@ -229,7 +226,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
229 regs->regs[4] = EINTR; 226 regs->regs[4] = EINTR;
230 break; 227 break;
231 case ERESTARTSYS: 228 case ERESTARTSYS:
232 if (!(ka->sa.sa_flags & SA_RESTART)) { 229 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
233 regs->regs[4] = EINTR; 230 regs->regs[4] = EINTR;
234 break; 231 break;
235 } 232 }
@@ -245,17 +242,14 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
245 /* 242 /*
246 * Set up the stack frame 243 * Set up the stack frame
247 */ 244 */
248 if (setup_rt_frame(ka, regs, sig, sigmask_to_save(), info) < 0) 245 ret = setup_rt_frame(ksig, regs, sigmask_to_save());
249 return;
250 246
251 signal_delivered(sig, info, ka, regs, 0); 247 signal_setup_done(ret, ksig, 0);
252} 248}
253 249
254static void do_signal(struct pt_regs *regs) 250static void do_signal(struct pt_regs *regs)
255{ 251{
256 struct k_sigaction ka; 252 struct ksignal ksig;
257 siginfo_t info;
258 int signr;
259 253
260 /* 254 /*
261 * We want the common case to go fast, which is why we may in certain 255 * We want the common case to go fast, which is why we may in certain
@@ -265,10 +259,9 @@ static void do_signal(struct pt_regs *regs)
265 if (!user_mode(regs)) 259 if (!user_mode(regs))
266 return; 260 return;
267 261
268 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 262 if (get_signal(&ksig)) {
269 if (signr > 0) {
270 /* Actually deliver the signal. */ 263 /* Actually deliver the signal. */
271 handle_signal(signr, &info, &ka, regs); 264 handle_signal(&ksig, regs);
272 return; 265 return;
273 } 266 }
274 267