Skip to content

Commit 2e487c3

Browse files
Brian GerstKAGA-KOKO
authored andcommitted
x86/entry/64: Split X32 syscall table into its own file
Since X32 has its own syscall table now, move it to a separate file. Signed-off-by: Brian Gerst <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Dominik Brodowski <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent cc42c04 commit 2e487c3

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

arch/x86/entry/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ obj-y += vdso/
1414
obj-y += vsyscall/
1515

1616
obj-$(CONFIG_IA32_EMULATION) += entry_64_compat.o syscall_32.o
17+
obj-$(CONFIG_X86_X32_ABI) += syscall_x32.o
1718

arch/x86/entry/syscall_64.c

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
#include <asm/asm-offsets.h>
99
#include <asm/syscall.h>
1010

11+
#define __SYSCALL_X32(nr, sym, qual)
12+
1113
#define __SYSCALL_64(nr, sym, qual) extern asmlinkage long sym(const struct pt_regs *);
12-
#define __SYSCALL_X32(nr, sym, qual) __SYSCALL_64(nr, sym, qual)
1314
#include <asm/syscalls_64.h>
1415
#undef __SYSCALL_64
15-
#undef __SYSCALL_X32
1616

1717
#define __SYSCALL_64(nr, sym, qual) [nr] = sym,
18-
#define __SYSCALL_X32(nr, sym, qual)
1918

2019
asmlinkage const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
2120
/*
@@ -25,25 +24,3 @@ asmlinkage const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
2524
[0 ... __NR_syscall_max] = &__x64_sys_ni_syscall,
2625
#include <asm/syscalls_64.h>
2726
};
28-
29-
#undef __SYSCALL_64
30-
#undef __SYSCALL_X32
31-
32-
#ifdef CONFIG_X86_X32_ABI
33-
34-
#define __SYSCALL_64(nr, sym, qual)
35-
#define __SYSCALL_X32(nr, sym, qual) [nr] = sym,
36-
37-
asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_syscall_x32_max+1] = {
38-
/*
39-
* Smells like a compiler bug -- it doesn't work
40-
* when the & below is removed.
41-
*/
42-
[0 ... __NR_syscall_x32_max] = &__x64_sys_ni_syscall,
43-
#include <asm/syscalls_64.h>
44-
};
45-
46-
#undef __SYSCALL_64
47-
#undef __SYSCALL_X32
48-
49-
#endif

arch/x86/entry/syscall_x32.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/* System call table for x32 ABI. */
3+
4+
#include <linux/linkage.h>
5+
#include <linux/sys.h>
6+
#include <linux/cache.h>
7+
#include <linux/syscalls.h>
8+
#include <asm/asm-offsets.h>
9+
#include <asm/syscall.h>
10+
11+
#define __SYSCALL_64(nr, sym, qual)
12+
13+
#define __SYSCALL_X32(nr, sym, qual) extern asmlinkage long sym(const struct pt_regs *);
14+
#include <asm/syscalls_64.h>
15+
#undef __SYSCALL_X32
16+
17+
#define __SYSCALL_X32(nr, sym, qual) [nr] = sym,
18+
19+
asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_syscall_x32_max+1] = {
20+
/*
21+
* Smells like a compiler bug -- it doesn't work
22+
* when the & below is removed.
23+
*/
24+
[0 ... __NR_syscall_x32_max] = &__x64_sys_ni_syscall,
25+
#include <asm/syscalls_64.h>
26+
};

0 commit comments

Comments
 (0)