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/vm86_32.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/vm86_32.c')
-rw-r--r-- | arch/x86/kernel/vm86_32.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c index 8fa6ba7c9233..d7ac84e7fc1c 100644 --- a/arch/x86/kernel/vm86_32.c +++ b/arch/x86/kernel/vm86_32.c | |||
@@ -197,8 +197,9 @@ out: | |||
197 | static int do_vm86_irq_handling(int subfunction, int irqnumber); | 197 | static int do_vm86_irq_handling(int subfunction, int irqnumber); |
198 | static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk); | 198 | static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk); |
199 | 199 | ||
200 | ptregscall int sys_vm86old(struct pt_regs *regs, struct vm86_struct __user *v86) | 200 | int sys_vm86old(struct pt_regs *regs) |
201 | { | 201 | { |
202 | struct vm86_struct __user *v86 = (struct vm86_struct __user *)regs->bx; | ||
202 | struct kernel_vm86_struct info; /* declare this _on top_, | 203 | struct kernel_vm86_struct info; /* declare this _on top_, |
203 | * this avoids wasting of stack space. | 204 | * this avoids wasting of stack space. |
204 | * This remains on the stack until we | 205 | * This remains on the stack until we |
@@ -226,7 +227,7 @@ out: | |||
226 | } | 227 | } |
227 | 228 | ||
228 | 229 | ||
229 | ptregscall int sys_vm86(struct pt_regs *regs, unsigned long cmd, unsigned long arg) | 230 | int sys_vm86(struct pt_regs *regs) |
230 | { | 231 | { |
231 | struct kernel_vm86_struct info; /* declare this _on top_, | 232 | struct kernel_vm86_struct info; /* declare this _on top_, |
232 | * this avoids wasting of stack space. | 233 | * this avoids wasting of stack space. |
@@ -238,12 +239,12 @@ ptregscall int sys_vm86(struct pt_regs *regs, unsigned long cmd, unsigned long a | |||
238 | struct vm86plus_struct __user *v86; | 239 | struct vm86plus_struct __user *v86; |
239 | 240 | ||
240 | tsk = current; | 241 | tsk = current; |
241 | switch (cmd) { | 242 | switch (regs->bx) { |
242 | case VM86_REQUEST_IRQ: | 243 | case VM86_REQUEST_IRQ: |
243 | case VM86_FREE_IRQ: | 244 | case VM86_FREE_IRQ: |
244 | case VM86_GET_IRQ_BITS: | 245 | case VM86_GET_IRQ_BITS: |
245 | case VM86_GET_AND_RESET_IRQ: | 246 | case VM86_GET_AND_RESET_IRQ: |
246 | ret = do_vm86_irq_handling(cmd, (int)arg); | 247 | ret = do_vm86_irq_handling(regs->bx, (int)regs->cx); |
247 | goto out; | 248 | goto out; |
248 | case VM86_PLUS_INSTALL_CHECK: | 249 | case VM86_PLUS_INSTALL_CHECK: |
249 | /* | 250 | /* |
@@ -260,7 +261,7 @@ ptregscall int sys_vm86(struct pt_regs *regs, unsigned long cmd, unsigned long a | |||
260 | ret = -EPERM; | 261 | ret = -EPERM; |
261 | if (tsk->thread.saved_sp0) | 262 | if (tsk->thread.saved_sp0) |
262 | goto out; | 263 | goto out; |
263 | v86 = (struct vm86plus_struct __user *)arg; | 264 | v86 = (struct vm86plus_struct __user *)regs->cx; |
264 | tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, | 265 | tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, |
265 | offsetof(struct kernel_vm86_struct, regs32) - | 266 | offsetof(struct kernel_vm86_struct, regs32) - |
266 | sizeof(info.regs)); | 267 | sizeof(info.regs)); |