Skip to content

Commit 0f78ff1

Browse files
Brian GerstKAGA-KOKO
authored andcommitted
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Dominik Brodowski <[email protected]> Reviewed-by: Andy Lutomirski <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 25c619e commit 0f78ff1

File tree

5 files changed

+19
-22
lines changed

5 files changed

+19
-22
lines changed

arch/x86/entry/syscall_32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <asm/unistd.h>
99
#include <asm/syscall.h>
1010

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

1313
#include <asm/syscalls_32.h>
1414
#undef __SYSCALL_I386

arch/x86/entry/syscall_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define __SYSCALL_X32(nr, sym)
1212
#define __SYSCALL_COMMON(nr, sym) __SYSCALL_64(nr, sym)
1313

14-
#define __SYSCALL_64(nr, sym) extern asmlinkage long __x64_##sym(const struct pt_regs *);
14+
#define __SYSCALL_64(nr, sym) extern long __x64_##sym(const struct pt_regs *);
1515
#include <asm/syscalls_64.h>
1616
#undef __SYSCALL_64
1717

arch/x86/entry/syscall_x32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
#define __SYSCALL_64(nr, sym)
1212

13-
#define __SYSCALL_X32(nr, sym) extern asmlinkage long __x32_##sym(const struct pt_regs *);
14-
#define __SYSCALL_COMMON(nr, sym) extern asmlinkage long __x64_##sym(const struct pt_regs *);
13+
#define __SYSCALL_X32(nr, sym) extern long __x32_##sym(const struct pt_regs *);
14+
#define __SYSCALL_COMMON(nr, sym) extern long __x64_##sym(const struct pt_regs *);
1515
#include <asm/syscalls_64.h>
1616
#undef __SYSCALL_X32
1717
#undef __SYSCALL_COMMON

arch/x86/include/asm/syscall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <asm/thread_info.h> /* for TS_COMPAT */
1717
#include <asm/unistd.h>
1818

19-
typedef asmlinkage long (*sys_call_ptr_t)(const struct pt_regs *);
19+
typedef long (*sys_call_ptr_t)(const struct pt_regs *);
2020
extern const sys_call_ptr_t sys_call_table[];
2121

2222
#if defined(CONFIG_X86_32)

arch/x86/include/asm/syscall_wrapper.h

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
struct pt_regs;
1010

11-
extern asmlinkage long __x64_sys_ni_syscall(const struct pt_regs *regs);
12-
extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
11+
extern long __x64_sys_ni_syscall(const struct pt_regs *regs);
12+
extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);
1313

1414
/*
1515
* 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);
6666
,,(unsigned int)regs->di,,(unsigned int)regs->bp)
6767

6868
#define __SYS_STUB0(abi, name) \
69-
asmlinkage long __##abi##_##name(const struct pt_regs *regs); \
69+
long __##abi##_##name(const struct pt_regs *regs); \
7070
ALLOW_ERROR_INJECTION(__##abi##_##name, ERRNO); \
71-
asmlinkage long __##abi##_##name(const struct pt_regs *regs) \
71+
long __##abi##_##name(const struct pt_regs *regs) \
7272
__alias(__do_##name);
7373

7474
#define __SYS_STUBx(abi, name, ...) \
75-
asmlinkage long __##abi##_##name(const struct pt_regs *regs); \
75+
long __##abi##_##name(const struct pt_regs *regs); \
7676
ALLOW_ERROR_INJECTION(__##abi##_##name, ERRNO); \
77-
asmlinkage long __##abi##_##name(const struct pt_regs *regs) \
77+
long __##abi##_##name(const struct pt_regs *regs) \
7878
{ \
7979
return __se_##name(__VA_ARGS__); \
8080
}
8181

8282
#define __COND_SYSCALL(abi, name) \
83-
asmlinkage __weak long \
84-
__##abi##_##name(const struct pt_regs *__unused) \
83+
__weak long __##abi##_##name(const struct pt_regs *__unused) \
8584
{ \
8685
return sys_ni_syscall(); \
8786
}
@@ -192,11 +191,11 @@ extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
192191
* of them.
193192
*/
194193
#define COMPAT_SYSCALL_DEFINE0(name) \
195-
static asmlinkage long \
194+
static long \
196195
__do_compat_sys_##name(const struct pt_regs *__unused); \
197196
__IA32_COMPAT_SYS_STUB0(name) \
198197
__X32_COMPAT_SYS_STUB0(name) \
199-
static asmlinkage long \
198+
static long \
200199
__do_compat_sys_##name(const struct pt_regs *__unused)
201200

202201
#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
@@ -248,12 +247,10 @@ extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
248247
*/
249248
#define SYSCALL_DEFINE0(sname) \
250249
SYSCALL_METADATA(_##sname, 0); \
251-
static asmlinkage long \
252-
__do_sys_##sname(const struct pt_regs *__unused); \
250+
static long __do_sys_##sname(const struct pt_regs *__unused); \
253251
__X64_SYS_STUB0(sname) \
254252
__IA32_SYS_STUB0(sname) \
255-
static asmlinkage long \
256-
__do_sys_##sname(const struct pt_regs *__unused)
253+
static long __do_sys_##sname(const struct pt_regs *__unused)
257254

258255
#define COND_SYSCALL(name) \
259256
__X64_COND_SYSCALL(name) \
@@ -268,8 +265,8 @@ extern asmlinkage long __ia32_sys_ni_syscall(const struct pt_regs *regs);
268265
* For VSYSCALLS, we need to declare these three syscalls with the new
269266
* pt_regs-based calling convention for in-kernel use.
270267
*/
271-
asmlinkage long __x64_sys_getcpu(const struct pt_regs *regs);
272-
asmlinkage long __x64_sys_gettimeofday(const struct pt_regs *regs);
273-
asmlinkage long __x64_sys_time(const struct pt_regs *regs);
268+
long __x64_sys_getcpu(const struct pt_regs *regs);
269+
long __x64_sys_gettimeofday(const struct pt_regs *regs);
270+
long __x64_sys_time(const struct pt_regs *regs);
274271

275272
#endif /* _ASM_X86_SYSCALL_WRAPPER_H */

0 commit comments

Comments
 (0)