Commit-ID: 8dbb1d168eb8be6bf43d123fdfb3ba3b03762e62 Gitweb: http://git.kernel.org/tip/8dbb1d168eb8be6bf43d123fdfb3ba3b03762e62 Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx> AuthorDate: Wed, 23 Sep 2009 16:35:24 -0700 Committer: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx> CommitDate: Wed, 23 Sep 2009 17:35:36 -0700 x86: unify sys_iopl 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@xxxxxxxxxx> --- arch/x86/include/asm/syscalls.h | 8 +++----- arch/x86/kernel/ioport.c | 11 ++--------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index 372b76e..5336ce2 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h @@ -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, diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c index 99c4d30..bad4f22 100644 --- a/arch/x86/kernel/ioport.c +++ b/arch/x86/kernel/ioport.c @@ -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 = ¤t->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 -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html