diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2008-09-05 19:28:38 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-06 08:54:04 -0400 |
commit | 13ad7725e9955ac68fff670a039da99ab33e86a0 (patch) | |
tree | 2160d235ee35b47870d9ab12a9a7ba5a90f23a41 /arch/x86/kernel/signal_32.c | |
parent | 1d13024e624d0e2e47f117b383917249a41ef5ce (diff) |
x86_32: signal: move signal number conversion to upper layer
Bring signal number conversion in __setup_frame() and __setup_rt_frame()
up into the common part setup_frame().
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/signal_32.c')
-rw-r--r-- | arch/x86/kernel/signal_32.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c index 48982f7ce886..b668efc18eae 100644 --- a/arch/x86/kernel/signal_32.c +++ b/arch/x86/kernel/signal_32.c | |||
@@ -344,7 +344,6 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, | |||
344 | struct sigframe __user *frame; | 344 | struct sigframe __user *frame; |
345 | void __user *restorer; | 345 | void __user *restorer; |
346 | int err = 0; | 346 | int err = 0; |
347 | int usig; | ||
348 | void __user *fpstate = NULL; | 347 | void __user *fpstate = NULL; |
349 | 348 | ||
350 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); | 349 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
@@ -352,13 +351,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, | |||
352 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 351 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
353 | goto give_sigsegv; | 352 | goto give_sigsegv; |
354 | 353 | ||
355 | usig = current_thread_info()->exec_domain | 354 | err = __put_user(sig, &frame->sig); |
356 | && current_thread_info()->exec_domain->signal_invmap | ||
357 | && sig < 32 | ||
358 | ? current_thread_info()->exec_domain->signal_invmap[sig] | ||
359 | : sig; | ||
360 | |||
361 | err = __put_user(usig, &frame->sig); | ||
362 | if (err) | 355 | if (err) |
363 | goto give_sigsegv; | 356 | goto give_sigsegv; |
364 | 357 | ||
@@ -422,7 +415,6 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
422 | struct rt_sigframe __user *frame; | 415 | struct rt_sigframe __user *frame; |
423 | void __user *restorer; | 416 | void __user *restorer; |
424 | int err = 0; | 417 | int err = 0; |
425 | int usig; | ||
426 | void __user *fpstate = NULL; | 418 | void __user *fpstate = NULL; |
427 | 419 | ||
428 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); | 420 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
@@ -430,13 +422,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
430 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 422 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
431 | goto give_sigsegv; | 423 | goto give_sigsegv; |
432 | 424 | ||
433 | usig = current_thread_info()->exec_domain | 425 | err |= __put_user(sig, &frame->sig); |
434 | && current_thread_info()->exec_domain->signal_invmap | ||
435 | && sig < 32 | ||
436 | ? current_thread_info()->exec_domain->signal_invmap[sig] | ||
437 | : sig; | ||
438 | |||
439 | err |= __put_user(usig, &frame->sig); | ||
440 | err |= __put_user(&frame->info, &frame->pinfo); | 426 | err |= __put_user(&frame->info, &frame->pinfo); |
441 | err |= __put_user(&frame->uc, &frame->puc); | 427 | err |= __put_user(&frame->uc, &frame->puc); |
442 | err |= copy_siginfo_to_user(&frame->info, info); | 428 | err |= copy_siginfo_to_user(&frame->info, info); |
@@ -482,7 +468,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
482 | /* Set up registers for signal handler */ | 468 | /* Set up registers for signal handler */ |
483 | regs->sp = (unsigned long)frame; | 469 | regs->sp = (unsigned long)frame; |
484 | regs->ip = (unsigned long)ka->sa.sa_handler; | 470 | regs->ip = (unsigned long)ka->sa.sa_handler; |
485 | regs->ax = (unsigned long)usig; | 471 | regs->ax = (unsigned long)sig; |
486 | regs->dx = (unsigned long)&frame->info; | 472 | regs->dx = (unsigned long)&frame->info; |
487 | regs->cx = (unsigned long)&frame->uc; | 473 | regs->cx = (unsigned long)&frame->uc; |
488 | 474 | ||
@@ -506,12 +492,19 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
506 | sigset_t *set, struct pt_regs *regs) | 492 | sigset_t *set, struct pt_regs *regs) |
507 | { | 493 | { |
508 | int ret; | 494 | int ret; |
495 | int usig; | ||
496 | |||
497 | usig = current_thread_info()->exec_domain | ||
498 | && current_thread_info()->exec_domain->signal_invmap | ||
499 | && sig < 32 | ||
500 | ? current_thread_info()->exec_domain->signal_invmap[sig] | ||
501 | : sig; | ||
509 | 502 | ||
510 | /* Set up the stack frame */ | 503 | /* Set up the stack frame */ |
511 | if (ka->sa.sa_flags & SA_SIGINFO) | 504 | if (ka->sa.sa_flags & SA_SIGINFO) |
512 | ret = __setup_rt_frame(sig, ka, info, set, regs); | 505 | ret = __setup_rt_frame(usig, ka, info, set, regs); |
513 | else | 506 | else |
514 | ret = __setup_frame(sig, ka, set, regs); | 507 | ret = __setup_frame(usig, ka, set, regs); |
515 | 508 | ||
516 | return ret; | 509 | return ret; |
517 | } | 510 | } |