Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/syscalls: Remove __SYSCALL_COMMON and __SYSCALL_X32

The common/64/x32 distinction has no effect other than
determining which kernels actually support the syscall. Move
the logic into syscalltbl.sh.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/58d4a95f40e43b894f93288b4a3633963d0ee22e.1454022279.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Andy Lutomirski and committed by
Ingo Molnar
32324ce1 fba32474

+16 -20
-8
arch/x86/entry/syscall_64.c
··· 6 6 #include <asm/asm-offsets.h> 7 7 #include <asm/syscall.h> 8 8 9 - #define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat) 10 - 11 - #ifdef CONFIG_X86_X32_ABI 12 - # define __SYSCALL_X32(nr, sym, compat) __SYSCALL_64(nr, sym, compat) 13 - #else 14 - # define __SYSCALL_X32(nr, sym, compat) /* nothing */ 15 - #endif 16 - 17 9 #define __SYSCALL_64(nr, sym, compat) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; 18 10 #include <asm/syscalls_64.h> 19 11 #undef __SYSCALL_64
+16 -1
arch/x86/entry/syscalls/syscalltbl.sh
··· 18 18 grep '^[0-9]' "$in" | sort -n | ( 19 19 while read nr abi name entry compat; do 20 20 abi=`echo "$abi" | tr '[a-z]' '[A-Z]'` 21 - emit "$abi" "$nr" "$entry" "$compat" 21 + if [ "$abi" == "COMMON" -o "$abi" == "64" ]; then 22 + # COMMON is the same as 64, except that we don't expect X32 23 + # programs to use it. Our expectation has nothing to do with 24 + # any generated code, so treat them the same. 25 + emit 64 "$nr" "$entry" "$compat" 26 + elif [ "$abi" == "X32" ]; then 27 + # X32 is equivalent to 64 on an X32-compatible kernel. 28 + echo "#ifdef CONFIG_X86_X32_ABI" 29 + emit 64 "$nr" "$entry" "$compat" 30 + echo "#endif" 31 + elif [ "$abi" == "I386" ]; then 32 + emit "$abi" "$nr" "$entry" "$compat" 33 + else 34 + echo "Unknown abi $abi" >&2 35 + exit 1 36 + fi 22 37 done 23 38 ) > "$out"
-6
arch/x86/kernel/asm-offsets_64.c
··· 5 5 #include <asm/ia32.h> 6 6 7 7 #define __SYSCALL_64(nr, sym, compat) [nr] = 1, 8 - #define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1, 9 - #ifdef CONFIG_X86_X32_ABI 10 - # define __SYSCALL_X32(nr, sym, compat) [nr] = 1, 11 - #else 12 - # define __SYSCALL_X32(nr, sym, compat) /* nothing */ 13 - #endif 14 8 static char syscalls_64[] = { 15 9 #include <asm/syscalls_64.h> 16 10 };
-3
arch/x86/um/sys_call_table_64.c
··· 35 35 #define stub_execveat sys_execveat 36 36 #define stub_rt_sigreturn sys_rt_sigreturn 37 37 38 - #define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat) 39 - #define __SYSCALL_X32(nr, sym, compat) /* Not supported */ 40 - 41 38 #define __SYSCALL_64(nr, sym, compat) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; 42 39 #include <asm/syscalls_64.h> 43 40
-2
arch/x86/um/user-offsets.c
··· 15 15 }; 16 16 #else 17 17 #define __SYSCALL_64(nr, sym, compat) [nr] = 1, 18 - #define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1, 19 - #define __SYSCALL_X32(nr, sym, compat) /* Not supported */ 20 18 static char syscalls[] = { 21 19 #include <asm/syscalls_64.h> 22 20 };