Skip to content

Commit 8210efc

Browse files
Brian GerstKAGA-KOKO
authored andcommitted
x86/entry/64: Add __SYSCALL_COMMON()
Add a __SYSCALL_COMMON() macro to the syscall table, which simplifies syscalltbl.sh. Signed-off-by: Brian Gerst <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent b5592e5 commit 8210efc

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

arch/x86/entry/syscall_64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <asm/syscall.h>
1010

1111
#define __SYSCALL_X32(nr, sym)
12+
#define __SYSCALL_COMMON(nr, sym) __SYSCALL_64(nr, sym)
1213

1314
#define __SYSCALL_64(nr, sym) extern asmlinkage long sym(const struct pt_regs *);
1415
#include <asm/syscalls_64.h>

arch/x86/entry/syscall_x32.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
#define __SYSCALL_64(nr, sym)
1212

1313
#define __SYSCALL_X32(nr, sym) extern asmlinkage long sym(const struct pt_regs *);
14+
#define __SYSCALL_COMMON(nr, sym) extern asmlinkage long sym(const struct pt_regs *);
1415
#include <asm/syscalls_64.h>
1516
#undef __SYSCALL_X32
17+
#undef __SYSCALL_COMMON
1618

1719
#define __SYSCALL_X32(nr, sym) [nr] = sym,
20+
#define __SYSCALL_COMMON(nr, sym) [nr] = sym,
1821

1922
asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_x32_syscall_max+1] = {
2023
/*

arch/x86/entry/syscalls/syscalltbl.sh

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ emit() {
2525
fi
2626

2727
# For CONFIG_UML, we need to strip the __x64_sys prefix
28-
if [ "$abi" = "64" -a "${entry}" != "${entry#__x64_sys}" ]; then
28+
if [ "${entry}" != "${entry#__x64_sys}" ]; then
2929
umlentry="sys${entry#__x64_sys}"
3030
fi
3131

@@ -53,24 +53,6 @@ emit() {
5353
grep '^[0-9]' "$in" | sort -n | (
5454
while read nr abi name entry compat; do
5555
abi=`echo "$abi" | tr '[a-z]' '[A-Z]'`
56-
if [ "$abi" = "COMMON" -o "$abi" = "64" ]; then
57-
emit 64 "$nr" "$entry" "$compat"
58-
if [ "$abi" = "COMMON" ]; then
59-
# COMMON means that this syscall exists in the same form for
60-
# 64-bit and X32.
61-
echo "#ifdef CONFIG_X86_X32_ABI"
62-
emit X32 "$nr" "$entry" "$compat"
63-
echo "#endif"
64-
fi
65-
elif [ "$abi" = "X32" ]; then
66-
echo "#ifdef CONFIG_X86_X32_ABI"
67-
emit X32 "$nr" "$entry" "$compat"
68-
echo "#endif"
69-
elif [ "$abi" = "I386" ]; then
70-
emit "$abi" "$nr" "$entry" "$compat"
71-
else
72-
echo "Unknown abi $abi" >&2
73-
exit 1
74-
fi
56+
emit "$abi" "$nr" "$entry" "$compat"
7557
done
7658
) > "$out"

arch/x86/um/sys_call_table_64.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
#define stub_execveat sys_execveat
3737
#define stub_rt_sigreturn sys_rt_sigreturn
3838

39+
#define __SYSCALL_X32(nr, sym)
40+
#define __SYSCALL_COMMON(nr, sym) __SYSCALL_64(nr, sym)
41+
3942
#define __SYSCALL_64(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
4043
#include <asm/syscalls_64.h>
4144

0 commit comments

Comments
 (0)