[PATCH 5/5] x86: Drop asmlinkage from syscalls

From: Brian Gerst
Date: Fri Feb 21 2020 - 00:10:56 EST


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@xxxxxxxxx>
---
arch/x86/entry/syscall_32.c | 2 +-
arch/x86/entry/syscall_64.c | 2 +-
arch/x86/include/asm/syscall.h | 2 +-
arch/x86/include/asm/syscall_wrapper.h | 20 ++++++++++----------
4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c
index 7af944b686ef..4e0113f3d4e8 100644
--- a/arch/x86/entry/syscall_32.c
+++ b/arch/x86/entry/syscall_32.c
@@ -8,7 +8,7 @@
#include <asm/asm-offsets.h>
#include <asm/syscall.h>

-#define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(const struct pt_regs *);
+#define __SYSCALL_I386(nr, sym, qual) extern long sym(const struct pt_regs *);

#include <asm/syscalls_32.h>
#undef __SYSCALL_I386
diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c
index 058dc1b73e96..3331a71eec77 100644
--- a/arch/x86/entry/syscall_64.c
+++ b/arch/x86/entry/syscall_64.c
@@ -8,7 +8,7 @@
#include <asm/asm-offsets.h>
#include <asm/syscall.h>

-#define __SYSCALL_64(nr, sym, qual) extern asmlinkage long sym(const struct pt_regs *);
+#define __SYSCALL_64(nr, sym, qual) extern long sym(const struct pt_regs *);
#define __SYSCALL_X32(nr, sym, qual) __SYSCALL_64(nr, sym, qual)
#include <asm/syscalls_64.h>
#undef __SYSCALL_64
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index 576178aefa01..a0b189714bac 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -17,7 +17,7 @@
#include <asm/thread_info.h> /* for TS_COMPAT */
#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[];

#if defined(CONFIG_X86_32)
diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h
index 9e9259a92020..68d2231bbff0 100644
--- a/arch/x86/include/asm/syscall_wrapper.h
+++ b/arch/x86/include/asm/syscall_wrapper.h
@@ -8,8 +8,8 @@

struct pt_regs;

-extern asmlinkage long __x64_sys_ni_syscall(const struct pt_regs *regs);
-extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
+extern long __x64_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, this macro takes
@@ -59,23 +59,23 @@ extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
,,(unsigned int)regs->di,,(unsigned int)regs->bp)

#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); \
- asmlinkage long __##abi##_##name(const struct pt_regs *regs) \
+ long __##abi##_##name(const struct pt_regs *regs) \
{ \
return __se_##name(__VA_ARGS__); \
}

#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); \
- asmlinkage long __##abi##_##name(const struct pt_regs *regs) \
+ long __##abi##_##name(const struct pt_regs *regs) \
{ \
return __do_##name(); \
}

#define __COND_SYSCALL(abi, name) \
- asmlinkage __weak long \
+ __weak long \
__##abi##_##name(const struct pt_regs *regs) \
{ \
return sys_ni_syscall(); \
@@ -270,8 +270,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
* pt_regs-based calling convention for in-kernel use.
*/
-asmlinkage long __x64_sys_getcpu(const struct pt_regs *regs);
-asmlinkage long __x64_sys_gettimeofday(const struct pt_regs *regs);
-asmlinkage long __x64_sys_time(const struct pt_regs *regs);
+long __x64_sys_getcpu(const struct pt_regs *regs);
+long __x64_sys_gettimeofday(const struct pt_regs *regs);
+long __x64_sys_time(const struct pt_regs *regs);

#endif /* _ASM_X86_SYSCALL_WRAPPER_H */
--
2.24.1