]> xenbits.xensource.com Git - people/ssmith/netchannel2-pvops.git/commitdiff
x86: unify sys_iopl
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Wed, 23 Sep 2009 23:35:24 +0000 (16:35 -0700)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Thu, 24 Sep 2009 00:39:35 +0000 (17:39 -0700)
The 32 and 64-bit versions of sys_iopl were needlessly different:
 - The 32-bit version ignored its function argument and directly
   fetched the parameter from struct regs, presumably code dating
   from the neolithic era.
 - The 64-bit version never called set_iopl_mask().  Usually this
   is a no-op for 64-bit, but it is also a pvop, which meant that
   that iopl never worked for 64-bit guests under Xen.
 - Both versions use the archaic style of getting pt_regs passed
   to them.  We can get the current pt_regs with task_pt_regs, which
   avoids worrying about the fine details of stack layout.

We can use the body of the 32-bit function with a few small
adjustments to the function definition.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
arch/x86/include/asm/syscalls.h
arch/x86/kernel/ioport.c

index 372b76edd63f69053c76bcf7501eb71c35bb8f93..5336ce249c99d989115f9d18cb6c8c2c73f4cd83 100644 (file)
@@ -33,11 +33,11 @@ long sys_rt_sigreturn(struct pt_regs *);
 asmlinkage int sys_set_thread_area(struct user_desc __user *);
 asmlinkage int sys_get_thread_area(struct user_desc __user *);
 
-/* X86_32 only */
-#ifdef CONFIG_X86_32
 /* kernel/ioport.c */
-long sys_iopl(struct pt_regs *);
+asmlinkage long sys_iopl(unsigned int);
 
+/* X86_32 only */
+#ifdef CONFIG_X86_32
 /* kernel/process_32.c */
 int sys_clone(struct pt_regs *);
 int sys_execve(struct pt_regs *);
@@ -70,8 +70,6 @@ int sys_vm86(struct pt_regs *);
 #else /* CONFIG_X86_32 */
 
 /* X86_64 only */
-/* kernel/ioport.c */
-asmlinkage long sys_iopl(unsigned int, struct pt_regs *);
 
 /* kernel/process_64.c */
 asmlinkage long sys_clone(unsigned long, unsigned long,
index 99c4d308f16b0db61ca0821adca78d3bec2e8b96..bad4f22f11462e5d71ac7428c36ca99aa7e405ed 100644 (file)
@@ -119,11 +119,10 @@ static int do_iopl(unsigned int level, struct pt_regs *regs)
        return 0;
 }
 
-#ifdef CONFIG_X86_32
-long sys_iopl(struct pt_regs *regs)
+asmlinkage long sys_iopl(unsigned int level)
 {
-       unsigned int level = regs->bx;
        struct thread_struct *t = &current->thread;
+       struct pt_regs *regs = task_pt_regs(current);
        int rc;
 
        rc = do_iopl(level, regs);
@@ -135,9 +134,3 @@ long sys_iopl(struct pt_regs *regs)
 out:
        return rc;
 }
-#else
-asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
-{
-       return do_iopl(level, regs);
-}
-#endif