Skip to content

Commit 44fe489

Browse files
masahir0yKAGA-KOKO
authored andcommitted
x86/syscalls: Stop filling syscall arrays with *_sys_ni_syscall
This is a follow-up cleanup after switching to the generic syscalltbl.sh. The old x86 specific script skipped non-existing syscalls. So, the generated syscalls_64.h, for example, had a big hole in the syscall numbers 335-423 range. That is why there exists [0 ... __NR_*_syscall_max] = &__*_sys_ni_cyscall. The new script, scripts/syscalltbl.sh automatically fills holes with __SYSCALL(<nr>, sys_ni_syscall), hence such ugly code can go away. The designated initializers, '[nr] =' are also unneeded. Also, there is no need to give __NR_*_syscall_max+1 because the array size is implied by the number of syscalls in the generated headers. Hence, there is no need to include <asm/unistd.h>, either. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20210517073815.97426-4-masahiroy@kernel.org
1 parent 6218d0f commit 44fe489

5 files changed

Lines changed: 6 additions & 36 deletions

File tree

arch/x86/entry/syscall_32.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <linux/sys.h>
66
#include <linux/cache.h>
77
#include <linux/syscalls.h>
8-
#include <asm/unistd.h>
98
#include <asm/syscall.h>
109

1110
#ifdef CONFIG_IA32_EMULATION
@@ -19,13 +18,8 @@
1918
#include <asm/syscalls_32.h>
2019
#undef __SYSCALL
2120

22-
#define __SYSCALL(nr, sym) [nr] = __ia32_##sym,
21+
#define __SYSCALL(nr, sym) __ia32_##sym,
2322

24-
__visible const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1] = {
25-
/*
26-
* Smells like a compiler bug -- it doesn't work
27-
* when the & below is removed.
28-
*/
29-
[0 ... __NR_ia32_syscall_max] = &__ia32_sys_ni_syscall,
23+
__visible const sys_call_ptr_t ia32_sys_call_table[] = {
3024
#include <asm/syscalls_32.h>
3125
};

arch/x86/entry/syscall_64.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@
55
#include <linux/sys.h>
66
#include <linux/cache.h>
77
#include <linux/syscalls.h>
8-
#include <asm/unistd.h>
98
#include <asm/syscall.h>
109

1110
#define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *);
1211
#include <asm/syscalls_64.h>
1312
#undef __SYSCALL
1413

15-
#define __SYSCALL(nr, sym) [nr] = __x64_##sym,
14+
#define __SYSCALL(nr, sym) __x64_##sym,
1615

17-
asmlinkage const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
18-
/*
19-
* Smells like a compiler bug -- it doesn't work
20-
* when the & below is removed.
21-
*/
22-
[0 ... __NR_syscall_max] = &__x64_sys_ni_syscall,
16+
asmlinkage const sys_call_ptr_t sys_call_table[] = {
2317
#include <asm/syscalls_64.h>
2418
};

arch/x86/entry/syscall_x32.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@
55
#include <linux/sys.h>
66
#include <linux/cache.h>
77
#include <linux/syscalls.h>
8-
#include <asm/unistd.h>
98
#include <asm/syscall.h>
109

1110
#define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *);
1211
#include <asm/syscalls_x32.h>
1312
#undef __SYSCALL
1413

15-
#define __SYSCALL(nr, sym) [nr] = __x64_##sym,
14+
#define __SYSCALL(nr, sym) __x64_##sym,
1615

17-
asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_x32_syscall_max+1] = {
18-
/*
19-
* Smells like a compiler bug -- it doesn't work
20-
* when the & below is removed.
21-
*/
22-
[0 ... __NR_x32_syscall_max] = &__x64_sys_ni_syscall,
16+
asmlinkage const sys_call_ptr_t x32_sys_call_table[] = {
2317
#include <asm/syscalls_x32.h>
2418
};

arch/x86/um/sys_call_table_32.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <linux/linkage.h>
88
#include <linux/sys.h>
99
#include <linux/cache.h>
10-
#include <asm/unistd.h>
1110
#include <asm/syscall.h>
1211

1312
#define __NO_STUBS
@@ -37,11 +36,6 @@
3736
extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
3837

3938
const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
40-
/*
41-
* Smells like a compiler bug -- it doesn't work
42-
* when the & below is removed.
43-
*/
44-
[0 ... __NR_syscall_max] = &sys_ni_syscall,
4539
#include <asm/syscalls_32.h>
4640
};
4741

arch/x86/um/sys_call_table_64.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <linux/linkage.h>
88
#include <linux/sys.h>
99
#include <linux/cache.h>
10-
#include <asm/unistd.h>
1110
#include <asm/syscall.h>
1211

1312
#define __NO_STUBS
@@ -45,11 +44,6 @@
4544
extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
4645

4746
const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
48-
/*
49-
* Smells like a compiler bug -- it doesn't work
50-
* when the & below is removed.
51-
*/
52-
[0 ... __NR_syscall_max] = &sys_ni_syscall,
5347
#include <asm/syscalls_64.h>
5448
};
5549

0 commit comments

Comments
 (0)