diff options
author | Brian Gerst <brgerst@gmail.com> | 2009-02-11 16:43:58 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2009-02-11 17:00:56 -0500 |
commit | b12bdaf11f935d7be030207e3c77faeaeab8ded3 (patch) | |
tree | e41f325f01614f7cf2eb78350fbd7440afe39cf8 /arch/x86/kernel/signal.c | |
parent | 1c0040047d5499599cc231ca3f105be3ceff8562 (diff) |
x86: use regparm(3) for passed-in pt_regs pointer
Some syscalls need to access the pt_regs structure, either to copy
user register state or to modifiy it. This patch adds stubs to load
the address of the pt_regs struct into the %eax register, and changes
the syscalls to take the pointer as an argument instead of relying on
the assumption that the pt_regs structure overlaps the function
arguments.
Drop the use of regparm(1) due to concern about gcc bugs, and to move
in the direction of the eventual removal of regparm(0) for asmlinkage.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/signal.c')
-rw-r--r-- | arch/x86/kernel/signal.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index d7a158367e38..ccfb27412f0f 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -549,23 +549,27 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, | |||
549 | #endif /* CONFIG_X86_32 */ | 549 | #endif /* CONFIG_X86_32 */ |
550 | 550 | ||
551 | #ifdef CONFIG_X86_32 | 551 | #ifdef CONFIG_X86_32 |
552 | ptregscall int | 552 | int sys_sigaltstack(struct pt_regs *regs) |
553 | sys_sigaltstack(struct pt_regs *regs, const stack_t __user *uss, | 553 | { |
554 | stack_t __user *uoss) | 554 | const stack_t __user *uss = (const stack_t __user *)regs->bx; |
555 | stack_t __user *uoss = (stack_t __user *)regs->cx; | ||
556 | |||
557 | return do_sigaltstack(uss, uoss, regs->sp); | ||
558 | } | ||
555 | #else /* !CONFIG_X86_32 */ | 559 | #else /* !CONFIG_X86_32 */ |
556 | asmlinkage long | 560 | asmlinkage long |
557 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 561 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
558 | struct pt_regs *regs) | 562 | struct pt_regs *regs) |
559 | #endif /* CONFIG_X86_32 */ | ||
560 | { | 563 | { |
561 | return do_sigaltstack(uss, uoss, regs->sp); | 564 | return do_sigaltstack(uss, uoss, regs->sp); |
562 | } | 565 | } |
566 | #endif /* CONFIG_X86_32 */ | ||
563 | 567 | ||
564 | /* | 568 | /* |
565 | * Do a signal return; undo the signal stack. | 569 | * Do a signal return; undo the signal stack. |
566 | */ | 570 | */ |
567 | #ifdef CONFIG_X86_32 | 571 | #ifdef CONFIG_X86_32 |
568 | ptregscall unsigned long sys_sigreturn(struct pt_regs *regs) | 572 | unsigned long sys_sigreturn(struct pt_regs *regs) |
569 | { | 573 | { |
570 | struct sigframe __user *frame; | 574 | struct sigframe __user *frame; |
571 | unsigned long ax; | 575 | unsigned long ax; |
@@ -629,13 +633,16 @@ badframe: | |||
629 | } | 633 | } |
630 | 634 | ||
631 | #ifdef CONFIG_X86_32 | 635 | #ifdef CONFIG_X86_32 |
632 | ptregscall int sys_rt_sigreturn(struct pt_regs *regs) | 636 | int sys_rt_sigreturn(struct pt_regs *regs) |
637 | { | ||
638 | return do_rt_sigreturn(regs); | ||
639 | } | ||
633 | #else /* !CONFIG_X86_32 */ | 640 | #else /* !CONFIG_X86_32 */ |
634 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) | 641 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) |
635 | #endif /* CONFIG_X86_32 */ | ||
636 | { | 642 | { |
637 | return do_rt_sigreturn(regs); | 643 | return do_rt_sigreturn(regs); |
638 | } | 644 | } |
645 | #endif /* CONFIG_X86_32 */ | ||
639 | 646 | ||
640 | /* | 647 | /* |
641 | * OK, we're invoking a handler: | 648 | * OK, we're invoking a handler: |