Commit 08720988 authored by Brian Gerst's avatar Brian Gerst Committed by Thomas Gleixner
Browse files

x86/entry: Move max syscall number calculation to syscallhdr.sh



Instead of using an array in asm-offsets to calculate the max syscall
number, calculate it when writing out the syscall headers.

Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200313195144.164260-9-brgerst@gmail.com
parent 2e487c35
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
#include <linux/linkage.h>
#include <linux/sys.h>
#include <linux/cache.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
#include <asm/syscall.h>

#ifdef CONFIG_IA32_EMULATION
@@ -22,11 +22,11 @@ extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned lon

#define __SYSCALL_I386(nr, sym, qual) [nr] = sym,

__visible const sys_call_ptr_t ia32_sys_call_table[__NR_syscall_compat_max+1] = {
__visible const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1] = {
	/*
	 * Smells like a compiler bug -- it doesn't work
	 * when the & below is removed.
	 */
	[0 ... __NR_syscall_compat_max] = &__sys_ni_syscall,
	[0 ... __NR_ia32_syscall_max] = &__sys_ni_syscall,
#include <asm/syscalls_32.h>
};
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
#include <linux/sys.h>
#include <linux/cache.h>
#include <linux/syscalls.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
#include <asm/syscall.h>

#define __SYSCALL_X32(nr, sym, qual)
+3 −3
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
#include <linux/sys.h>
#include <linux/cache.h>
#include <linux/syscalls.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
#include <asm/syscall.h>

#define __SYSCALL_64(nr, sym, qual)
@@ -16,11 +16,11 @@

#define __SYSCALL_X32(nr, sym, qual) [nr] = sym,

asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_syscall_x32_max+1] = {
asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_x32_syscall_max+1] = {
	/*
	 * Smells like a compiler bug -- it doesn't work
	 * when the & below is removed.
	 */
	[0 ... __NR_syscall_x32_max] = &__x64_sys_ni_syscall,
	[0 ... __NR_x32_syscall_max] = &__x64_sys_ni_syscall,
#include <asm/syscalls_64.h>
};
+7 −0
Original line number Diff line number Diff line
@@ -15,14 +15,21 @@ grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
    echo "#define ${fileguard} 1"
    echo ""

    max=0
    while read nr abi name entry ; do
	if [ -z "$offset" ]; then
	    echo "#define __NR_${prefix}${name} $nr"
	else
	    echo "#define __NR_${prefix}${name} ($offset + $nr)"
        fi

	max=$nr
    done

    echo ""
    echo "#ifdef __KERNEL__"
    echo "#define __NR_${prefix}syscall_max $max"
    echo "#endif"
    echo ""
    echo "#endif /* ${fileguard} */"
) > "$out"
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
 */
#undef CONFIG_64BIT
#undef CONFIG_X86_64
#undef CONFIG_COMPAT
#undef CONFIG_PGTABLE_LEVELS
#undef CONFIG_ILLEGAL_POINTER_VALUE
#undef CONFIG_SPARSEMEM_VMEMMAP
Loading