aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorBrian Gerst <brgerst@gmail.com>2009-12-09 19:01:52 -0500
committerH. Peter Anvin <hpa@zytor.com>2009-12-09 19:28:10 -0500
commit27f59559d63375a4d59e7c720a439d9f0b47edad (patch)
tree7990a73f63b67ea6123f9be4767aad82911877c4 /arch/x86/kernel
parente258e4e0b495e6ecbd073d6bef1eafb62a58919a (diff)
x86: Merge sys_iopl
Change 32-bit sys_iopl to PTREGSCALL1, and merge with 64-bit. Signed-off-by: Brian Gerst <brgerst@gmail.com> LKML-Reference: <1260403316-5679-3-git-send-email-brgerst@gmail.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/entry_32.S2
-rw-r--r--arch/x86/kernel/ioport.c28
2 files changed, 6 insertions, 24 deletions
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 34dbfa909dd7..ab7fcef37453 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -758,7 +758,7 @@ ptregs_##name: \
758 addl $4,%esp; \ 758 addl $4,%esp; \
759 ret 759 ret
760 760
761PTREGSCALL0(iopl) 761PTREGSCALL1(iopl)
762PTREGSCALL0(fork) 762PTREGSCALL0(fork)
763PTREGSCALL0(clone) 763PTREGSCALL0(clone)
764PTREGSCALL0(vfork) 764PTREGSCALL0(vfork)
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 99c4d308f16b..85ecc7c57ba6 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -103,9 +103,10 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
103 * on system-call entry - see also fork() and the signal handling 103 * on system-call entry - see also fork() and the signal handling
104 * code. 104 * code.
105 */ 105 */
106static int do_iopl(unsigned int level, struct pt_regs *regs) 106long sys_iopl(unsigned int level, struct pt_regs *regs)
107{ 107{
108 unsigned int old = (regs->flags >> 12) & 3; 108 unsigned int old = (regs->flags >> 12) & 3;
109 struct thread_struct *t = &current->thread;
109 110
110 if (level > 3) 111 if (level > 3)
111 return -EINVAL; 112 return -EINVAL;
@@ -115,29 +116,10 @@ static int do_iopl(unsigned int level, struct pt_regs *regs)
115 return -EPERM; 116 return -EPERM;
116 } 117 }
117 regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12); 118 regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12);
118
119 return 0;
120}
121
122#ifdef CONFIG_X86_32 119#ifdef CONFIG_X86_32
123long sys_iopl(struct pt_regs *regs)
124{
125 unsigned int level = regs->bx;
126 struct thread_struct *t = &current->thread;
127 int rc;
128
129 rc = do_iopl(level, regs);
130 if (rc < 0)
131 goto out;
132
133 t->iopl = level << 12; 120 t->iopl = level << 12;
134 set_iopl_mask(t->iopl); 121 set_iopl_mask(t->iopl);
135out:
136 return rc;
137}
138#else
139asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
140{
141 return do_iopl(level, regs);
142}
143#endif 122#endif
123
124 return 0;
125}