x86/entry: Drop asmlinkage from syscalls
asmlinkage is no longer required since the syscall ABI is now fully under x86 architecture control. This makes the 32-bit native syscalls a bit more effecient by passing in regs via EAX instead of on the stack. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net> Reviewed-by: Andy Lutomirski <luto@kernel.org> Link: https://lkml.kernel.org/r/20200313195144.164260-18-brgerst@gmail.com
This commit is contained in:

committed by
Thomas Gleixner

parent
25c619e59b
commit
0f78ff1711
@@ -8,7 +8,7 @@
|
|||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
#include <asm/syscall.h>
|
#include <asm/syscall.h>
|
||||||
|
|
||||||
#define __SYSCALL_I386(nr, sym) extern asmlinkage long __ia32_##sym(const struct pt_regs *);
|
#define __SYSCALL_I386(nr, sym) extern long __ia32_##sym(const struct pt_regs *);
|
||||||
|
|
||||||
#include <asm/syscalls_32.h>
|
#include <asm/syscalls_32.h>
|
||||||
#undef __SYSCALL_I386
|
#undef __SYSCALL_I386
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#define __SYSCALL_X32(nr, sym)
|
#define __SYSCALL_X32(nr, sym)
|
||||||
#define __SYSCALL_COMMON(nr, sym) __SYSCALL_64(nr, sym)
|
#define __SYSCALL_COMMON(nr, sym) __SYSCALL_64(nr, sym)
|
||||||
|
|
||||||
#define __SYSCALL_64(nr, sym) extern asmlinkage long __x64_##sym(const struct pt_regs *);
|
#define __SYSCALL_64(nr, sym) extern long __x64_##sym(const struct pt_regs *);
|
||||||
#include <asm/syscalls_64.h>
|
#include <asm/syscalls_64.h>
|
||||||
#undef __SYSCALL_64
|
#undef __SYSCALL_64
|
||||||
|
|
||||||
|
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
#define __SYSCALL_64(nr, sym)
|
#define __SYSCALL_64(nr, sym)
|
||||||
|
|
||||||
#define __SYSCALL_X32(nr, sym) extern asmlinkage long __x32_##sym(const struct pt_regs *);
|
#define __SYSCALL_X32(nr, sym) extern long __x32_##sym(const struct pt_regs *);
|
||||||
#define __SYSCALL_COMMON(nr, sym) extern asmlinkage long __x64_##sym(const struct pt_regs *);
|
#define __SYSCALL_COMMON(nr, sym) extern long __x64_##sym(const struct pt_regs *);
|
||||||
#include <asm/syscalls_64.h>
|
#include <asm/syscalls_64.h>
|
||||||
#undef __SYSCALL_X32
|
#undef __SYSCALL_X32
|
||||||
#undef __SYSCALL_COMMON
|
#undef __SYSCALL_COMMON
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#include <asm/thread_info.h> /* for TS_COMPAT */
|
#include <asm/thread_info.h> /* for TS_COMPAT */
|
||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
|
|
||||||
typedef asmlinkage long (*sys_call_ptr_t)(const struct pt_regs *);
|
typedef long (*sys_call_ptr_t)(const struct pt_regs *);
|
||||||
extern const sys_call_ptr_t sys_call_table[];
|
extern const sys_call_ptr_t sys_call_table[];
|
||||||
|
|
||||||
#if defined(CONFIG_X86_32)
|
#if defined(CONFIG_X86_32)
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
struct pt_regs;
|
struct pt_regs;
|
||||||
|
|
||||||
extern asmlinkage long __x64_sys_ni_syscall(const struct pt_regs *regs);
|
extern long __x64_sys_ni_syscall(const struct pt_regs *regs);
|
||||||
extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
|
extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Instead of the generic __SYSCALL_DEFINEx() definition, the x86 version takes
|
* Instead of the generic __SYSCALL_DEFINEx() definition, the x86 version takes
|
||||||
@@ -66,22 +66,21 @@ extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
|
|||||||
,,(unsigned int)regs->di,,(unsigned int)regs->bp)
|
,,(unsigned int)regs->di,,(unsigned int)regs->bp)
|
||||||
|
|
||||||
#define __SYS_STUB0(abi, name) \
|
#define __SYS_STUB0(abi, name) \
|
||||||
asmlinkage long __##abi##_##name(const struct pt_regs *regs); \
|
long __##abi##_##name(const struct pt_regs *regs); \
|
||||||
ALLOW_ERROR_INJECTION(__##abi##_##name, ERRNO); \
|
ALLOW_ERROR_INJECTION(__##abi##_##name, ERRNO); \
|
||||||
asmlinkage long __##abi##_##name(const struct pt_regs *regs) \
|
long __##abi##_##name(const struct pt_regs *regs) \
|
||||||
__alias(__do_##name);
|
__alias(__do_##name);
|
||||||
|
|
||||||
#define __SYS_STUBx(abi, name, ...) \
|
#define __SYS_STUBx(abi, name, ...) \
|
||||||
asmlinkage long __##abi##_##name(const struct pt_regs *regs); \
|
long __##abi##_##name(const struct pt_regs *regs); \
|
||||||
ALLOW_ERROR_INJECTION(__##abi##_##name, ERRNO); \
|
ALLOW_ERROR_INJECTION(__##abi##_##name, ERRNO); \
|
||||||
asmlinkage long __##abi##_##name(const struct pt_regs *regs) \
|
long __##abi##_##name(const struct pt_regs *regs) \
|
||||||
{ \
|
{ \
|
||||||
return __se_##name(__VA_ARGS__); \
|
return __se_##name(__VA_ARGS__); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __COND_SYSCALL(abi, name) \
|
#define __COND_SYSCALL(abi, name) \
|
||||||
asmlinkage __weak long \
|
__weak long __##abi##_##name(const struct pt_regs *__unused) \
|
||||||
__##abi##_##name(const struct pt_regs *__unused) \
|
|
||||||
{ \
|
{ \
|
||||||
return sys_ni_syscall(); \
|
return sys_ni_syscall(); \
|
||||||
}
|
}
|
||||||
@@ -192,11 +191,11 @@ extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
|
|||||||
* of them.
|
* of them.
|
||||||
*/
|
*/
|
||||||
#define COMPAT_SYSCALL_DEFINE0(name) \
|
#define COMPAT_SYSCALL_DEFINE0(name) \
|
||||||
static asmlinkage long \
|
static long \
|
||||||
__do_compat_sys_##name(const struct pt_regs *__unused); \
|
__do_compat_sys_##name(const struct pt_regs *__unused); \
|
||||||
__IA32_COMPAT_SYS_STUB0(name) \
|
__IA32_COMPAT_SYS_STUB0(name) \
|
||||||
__X32_COMPAT_SYS_STUB0(name) \
|
__X32_COMPAT_SYS_STUB0(name) \
|
||||||
static asmlinkage long \
|
static long \
|
||||||
__do_compat_sys_##name(const struct pt_regs *__unused)
|
__do_compat_sys_##name(const struct pt_regs *__unused)
|
||||||
|
|
||||||
#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
|
#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
|
||||||
@@ -248,12 +247,10 @@ extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
|
|||||||
*/
|
*/
|
||||||
#define SYSCALL_DEFINE0(sname) \
|
#define SYSCALL_DEFINE0(sname) \
|
||||||
SYSCALL_METADATA(_##sname, 0); \
|
SYSCALL_METADATA(_##sname, 0); \
|
||||||
static asmlinkage long \
|
static long __do_sys_##sname(const struct pt_regs *__unused); \
|
||||||
__do_sys_##sname(const struct pt_regs *__unused); \
|
|
||||||
__X64_SYS_STUB0(sname) \
|
__X64_SYS_STUB0(sname) \
|
||||||
__IA32_SYS_STUB0(sname) \
|
__IA32_SYS_STUB0(sname) \
|
||||||
static asmlinkage long \
|
static long __do_sys_##sname(const struct pt_regs *__unused)
|
||||||
__do_sys_##sname(const struct pt_regs *__unused)
|
|
||||||
|
|
||||||
#define COND_SYSCALL(name) \
|
#define COND_SYSCALL(name) \
|
||||||
__X64_COND_SYSCALL(name) \
|
__X64_COND_SYSCALL(name) \
|
||||||
@@ -268,8 +265,8 @@ extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
|
|||||||
* For VSYSCALLS, we need to declare these three syscalls with the new
|
* For VSYSCALLS, we need to declare these three syscalls with the new
|
||||||
* pt_regs-based calling convention for in-kernel use.
|
* pt_regs-based calling convention for in-kernel use.
|
||||||
*/
|
*/
|
||||||
asmlinkage long __x64_sys_getcpu(const struct pt_regs *regs);
|
long __x64_sys_getcpu(const struct pt_regs *regs);
|
||||||
asmlinkage long __x64_sys_gettimeofday(const struct pt_regs *regs);
|
long __x64_sys_gettimeofday(const struct pt_regs *regs);
|
||||||
asmlinkage long __x64_sys_time(const struct pt_regs *regs);
|
long __x64_sys_time(const struct pt_regs *regs);
|
||||||
|
|
||||||
#endif /* _ASM_X86_SYSCALL_WRAPPER_H */
|
#endif /* _ASM_X86_SYSCALL_WRAPPER_H */
|
||||||
|
Reference in New Issue
Block a user