diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2008-11-11 22:09:29 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-12 06:28:01 -0500 |
commit | 4a61204856e8b28e9f5489a7875cb3a60afd1e43 (patch) | |
tree | 6593c26bd66a417df89ae4db707f21393adc43a7 /arch | |
parent | 15002fa9bf3a79ac9dcafba7ff308586936088b2 (diff) |
x86: signal_32: introduce retcode and rt_retcode
Impact: cleanup
Introduce retcode and rt_retcode to replace setting up frame->retcode.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/signal_32.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c index 27a5c8174322..514171ac0d03 100644 --- a/arch/x86/kernel/signal_32.c +++ b/arch/x86/kernel/signal_32.c | |||
@@ -45,6 +45,28 @@ | |||
45 | # define FIX_EFLAGS __FIX_EFLAGS | 45 | # define FIX_EFLAGS __FIX_EFLAGS |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | static const struct { | ||
49 | u16 poplmovl; | ||
50 | u32 val; | ||
51 | u16 int80; | ||
52 | } __attribute__((packed)) retcode = { | ||
53 | 0xb858, /* popl %eax; movl $..., %eax */ | ||
54 | __NR_sigreturn, | ||
55 | 0x80cd, /* int $0x80 */ | ||
56 | }; | ||
57 | |||
58 | static const struct { | ||
59 | u8 movl; | ||
60 | u32 val; | ||
61 | u16 int80; | ||
62 | u8 pad; | ||
63 | } __attribute__((packed)) rt_retcode = { | ||
64 | 0xb8, /* movl $..., %eax */ | ||
65 | __NR_rt_sigreturn, | ||
66 | 0x80cd, /* int $0x80 */ | ||
67 | 0 | ||
68 | }; | ||
69 | |||
48 | /* | 70 | /* |
49 | * Atomically swap in the new signal mask, and wait for a signal. | 71 | * Atomically swap in the new signal mask, and wait for a signal. |
50 | */ | 72 | */ |
@@ -427,9 +449,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, | |||
427 | * reasons and because gdb uses it as a signature to notice | 449 | * reasons and because gdb uses it as a signature to notice |
428 | * signal handler stack frames. | 450 | * signal handler stack frames. |
429 | */ | 451 | */ |
430 | err |= __put_user(0xb858, (short __user *)(frame->retcode+0)); | 452 | err |= __put_user(*((u64 *)&retcode), (u64 *)frame->retcode); |
431 | err |= __put_user(__NR_sigreturn, (int __user *)(frame->retcode+2)); | ||
432 | err |= __put_user(0x80cd, (short __user *)(frame->retcode+6)); | ||
433 | 453 | ||
434 | if (err) | 454 | if (err) |
435 | return -EFAULT; | 455 | return -EFAULT; |
@@ -498,9 +518,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
498 | * reasons and because gdb uses it as a signature to notice | 518 | * reasons and because gdb uses it as a signature to notice |
499 | * signal handler stack frames. | 519 | * signal handler stack frames. |
500 | */ | 520 | */ |
501 | err |= __put_user(0xb8, (char __user *)(frame->retcode+0)); | 521 | err |= __put_user(*((u64 *)&rt_retcode), (u64 *)frame->retcode); |
502 | err |= __put_user(__NR_rt_sigreturn, (int __user *)(frame->retcode+1)); | ||
503 | err |= __put_user(0x80cd, (short __user *)(frame->retcode+5)); | ||
504 | 522 | ||
505 | if (err) | 523 | if (err) |
506 | return -EFAULT; | 524 | return -EFAULT; |