aboutsummaryrefslogtreecommitdiffstats
path: root/arch/unicore32/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-09 12:58:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-09 12:58:12 -0400
commit63b12bdb0d21aca527996fb2c547387bfd3e14b8 (patch)
tree6ab83b2a1c289f30fea18b88f04138ee69c37c6f /arch/unicore32/kernel
parentad1f5caf34390bb20fdbb4eaf71b0494e89936f0 (diff)
parent059ade650ae57cfd371af690fdba887af04aded8 (diff)
Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc
Pull arch signal handling cleanup from Richard Weinberger: "This patch series moves all remaining archs to the get_signal(), signal_setup_done() and sigsp() functions. Currently these archs use open coded variants of the said functions. Further, unused parameters get removed from get_signal_to_deliver(), tracehook_signal_handler() and signal_delivered(). At the end of the day we save around 500 lines of code." * 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc: (43 commits) powerpc: Use sigsp() openrisc: Use sigsp() mn10300: Use sigsp() mips: Use sigsp() microblaze: Use sigsp() metag: Use sigsp() m68k: Use sigsp() m32r: Use sigsp() hexagon: Use sigsp() frv: Use sigsp() cris: Use sigsp() c6x: Use sigsp() blackfin: Use sigsp() avr32: Use sigsp() arm64: Use sigsp() arc: Use sigsp() sas_ss_flags: Remove nested ternary if Rip out get_signal_to_deliver() Clean up signal_delivered() tracehook_signal_handler: Remove sig, info, ka and regs ...
Diffstat (limited to 'arch/unicore32/kernel')
-rw-r--r--arch/unicore32/kernel/signal.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c
index 6905f0ebdc77..780d77388dec 100644
--- a/arch/unicore32/kernel/signal.c
+++ b/arch/unicore32/kernel/signal.c
@@ -238,10 +238,10 @@ static int setup_return(struct pt_regs *regs, struct k_sigaction *ka,
238 return 0; 238 return 0;
239} 239}
240 240
241static int setup_frame(int usig, struct k_sigaction *ka, 241static int setup_frame(struct ksignal *ksig, sigset_t *set,
242 sigset_t *set, struct pt_regs *regs) 242 struct pt_regs *regs)
243{ 243{
244 struct sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame)); 244 struct sigframe __user *frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
245 int err = 0; 245 int err = 0;
246 246
247 if (!frame) 247 if (!frame)
@@ -254,29 +254,29 @@ static int setup_frame(int usig, struct k_sigaction *ka,
254 254
255 err |= setup_sigframe(frame, regs, set); 255 err |= setup_sigframe(frame, regs, set);
256 if (err == 0) 256 if (err == 0)
257 err |= setup_return(regs, ka, frame->retcode, frame, usig); 257 err |= setup_return(regs, &ksig->ka, frame->retcode, frame, usig);
258 258
259 return err; 259 return err;
260} 260}
261 261
262static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 262static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
263 sigset_t *set, struct pt_regs *regs) 263 struct pt_regs *regs)
264{ 264{
265 struct rt_sigframe __user *frame = 265 struct rt_sigframe __user *frame =
266 get_sigframe(ka, regs, sizeof(*frame)); 266 get_sigframe(&ksig->ka, regs, sizeof(*frame));
267 int err = 0; 267 int err = 0;
268 268
269 if (!frame) 269 if (!frame)
270 return 1; 270 return 1;
271 271
272 err |= copy_siginfo_to_user(&frame->info, info); 272 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
273 273
274 err |= __put_user(0, &frame->sig.uc.uc_flags); 274 err |= __put_user(0, &frame->sig.uc.uc_flags);
275 err |= __put_user(NULL, &frame->sig.uc.uc_link); 275 err |= __put_user(NULL, &frame->sig.uc.uc_link);
276 err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp); 276 err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp);
277 err |= setup_sigframe(&frame->sig, regs, set); 277 err |= setup_sigframe(&frame->sig, regs, set);
278 if (err == 0) 278 if (err == 0)
279 err |= setup_return(regs, ka, frame->sig.retcode, frame, usig); 279 err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig);
280 280
281 if (err == 0) { 281 if (err == 0) {
282 /* 282 /*
@@ -299,13 +299,13 @@ static inline void setup_syscall_restart(struct pt_regs *regs)
299/* 299/*
300 * OK, we're invoking a handler 300 * OK, we're invoking a handler
301 */ 301 */
302static void handle_signal(unsigned long sig, struct k_sigaction *ka, 302static void handle_signal(struct ksignal *ksig, struct pt_regs *regs,
303 siginfo_t *info, struct pt_regs *regs, int syscall) 303 int syscall)
304{ 304{
305 struct thread_info *thread = current_thread_info(); 305 struct thread_info *thread = current_thread_info();
306 struct task_struct *tsk = current; 306 struct task_struct *tsk = current;
307 sigset_t *oldset = sigmask_to_save(); 307 sigset_t *oldset = sigmask_to_save();
308 int usig = sig; 308 int usig = ksig->sig;
309 int ret; 309 int ret;
310 310
311 /* 311 /*
@@ -318,7 +318,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
318 regs->UCreg_00 = -EINTR; 318 regs->UCreg_00 = -EINTR;
319 break; 319 break;
320 case -ERESTARTSYS: 320 case -ERESTARTSYS:
321 if (!(ka->sa.sa_flags & SA_RESTART)) { 321 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
322 regs->UCreg_00 = -EINTR; 322 regs->UCreg_00 = -EINTR;
323 break; 323 break;
324 } 324 }
@@ -338,22 +338,17 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
338 /* 338 /*
339 * Set up the stack frame 339 * Set up the stack frame
340 */ 340 */
341 if (ka->sa.sa_flags & SA_SIGINFO) 341 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
342 ret = setup_rt_frame(usig, ka, info, oldset, regs); 342 ret = setup_rt_frame(ksig, oldset, regs);
343 else 343 else
344 ret = setup_frame(usig, ka, oldset, regs); 344 ret = setup_frame(ksig, oldset, regs);
345 345
346 /* 346 /*
347 * Check that the resulting registers are actually sane. 347 * Check that the resulting registers are actually sane.
348 */ 348 */
349 ret |= !valid_user_regs(regs); 349 ret |= !valid_user_regs(regs);
350 350
351 if (ret != 0) { 351 signal_setup_done(ret, ksig, 0);
352 force_sigsegv(sig, tsk);
353 return;
354 }
355
356 signal_delivered(sig, info, ka, regs, 0);
357} 352}
358 353
359/* 354/*
@@ -367,9 +362,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
367 */ 362 */
368static void do_signal(struct pt_regs *regs, int syscall) 363static void do_signal(struct pt_regs *regs, int syscall)
369{ 364{
370 struct k_sigaction ka; 365 struct ksignal ksig;
371 siginfo_t info;
372 int signr;
373 366
374 /* 367 /*
375 * We want the common case to go fast, which 368 * We want the common case to go fast, which
@@ -380,9 +373,8 @@ static void do_signal(struct pt_regs *regs, int syscall)
380 if (!user_mode(regs)) 373 if (!user_mode(regs))
381 return; 374 return;
382 375
383 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 376 if (get_signsl(&ksig)) {
384 if (signr > 0) { 377 handle_signal(&ksig, regs, syscall);
385 handle_signal(signr, &ka, &info, regs, syscall);
386 return; 378 return;
387 } 379 }
388 380