Commit 66f4e88c authored by Dominik Brodowski's avatar Dominik Brodowski

x86/ioport: add ksys_ioperm() helper; remove in-kernel calls to sys_ioperm()

Using this helper allows us to avoid the in-kernel calls to the
sys_ioperm() syscall. The ksys_ prefix denotes that this function is meant
as a drop-in replacement for the syscall. In particular, it uses the same
calling convention as sys_ioperm().

This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: x86@kernel.org
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent c7b95d51
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
/* Common in X86_32 and X86_64 */ /* Common in X86_32 and X86_64 */
/* kernel/ioport.c */ /* kernel/ioport.c */
long ksys_ioperm(unsigned long from, unsigned long num, int turn_on);
asmlinkage long sys_ioperm(unsigned long, unsigned long, int); asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
asmlinkage long sys_iopl(unsigned int); asmlinkage long sys_iopl(unsigned int);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* /*
* this changes the io permissions bitmap in the current task. * this changes the io permissions bitmap in the current task.
*/ */
SYSCALL_DEFINE3(ioperm, unsigned long, from, unsigned long, num, int, turn_on) long ksys_ioperm(unsigned long from, unsigned long num, int turn_on)
{ {
struct thread_struct *t = &current->thread; struct thread_struct *t = &current->thread;
struct tss_struct *tss; struct tss_struct *tss;
...@@ -96,6 +96,11 @@ SYSCALL_DEFINE3(ioperm, unsigned long, from, unsigned long, num, int, turn_on) ...@@ -96,6 +96,11 @@ SYSCALL_DEFINE3(ioperm, unsigned long, from, unsigned long, num, int, turn_on)
return 0; return 0;
} }
SYSCALL_DEFINE3(ioperm, unsigned long, from, unsigned long, num, int, turn_on)
{
return ksys_ioperm(from, num, turn_on);
}
/* /*
* sys_iopl has to be used when you want to access the IO ports * sys_iopl has to be used when you want to access the IO ports
* beyond the 0x3ff range: to get the full 65536 ports bitmapped * beyond the 0x3ff range: to get the full 65536 ports bitmapped
......
...@@ -57,7 +57,7 @@ extern struct tty_driver *console_driver; ...@@ -57,7 +57,7 @@ extern struct tty_driver *console_driver;
*/ */
#ifdef CONFIG_X86 #ifdef CONFIG_X86
#include <linux/syscalls.h> #include <asm/syscalls.h>
#endif #endif
static void complete_change_console(struct vc_data *vc); static void complete_change_console(struct vc_data *vc);
...@@ -420,12 +420,12 @@ int vt_ioctl(struct tty_struct *tty, ...@@ -420,12 +420,12 @@ int vt_ioctl(struct tty_struct *tty,
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
ret = sys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0; ret = ksys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0;
break; break;
case KDENABIO: case KDENABIO:
case KDDISABIO: case KDDISABIO:
ret = sys_ioperm(GPFIRST, GPNUM, ret = ksys_ioperm(GPFIRST, GPNUM,
(cmd == KDENABIO)) ? -ENXIO : 0; (cmd == KDENABIO)) ? -ENXIO : 0;
break; break;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment