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

arm64: generate 64-bit syscall.tbl

Change the asm/unistd.h header for arm64 to no longer include
asm-generic/unistd.h itself, but instead generate both the asm/unistd.h
contents and the list of entry points using the syscall.tbl scripts that
we use on most other architectures.

Once his is done for the remaining architectures, the generic unistd.h
header can be removed and the generated tbl file put in its place.

The Makefile changes are more complex than they should be, I need
a little help to improve those. Ideally this should be done in an
architecture-independent way as well.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+16 -29
+1
arch/arm64/include/asm/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 syscall-y += syscall_table_32.h 3 + syscall-y += syscall_table_64.h 3 4 4 5 # arm32 syscall table used by lib/compat_audit.c: 5 6 syscall-y += unistd_32.h
+1
arch/arm64/include/asm/seccomp.h
··· 23 23 #define SECCOMP_ARCH_NATIVE_NR NR_syscalls 24 24 #define SECCOMP_ARCH_NATIVE_NAME "aarch64" 25 25 #ifdef CONFIG_COMPAT 26 + #include <asm/unistd_compat_32.h> 26 27 # define SECCOMP_ARCH_COMPAT AUDIT_ARCH_ARM 27 28 # define SECCOMP_ARCH_COMPAT_NR __NR_compat32_syscalls 28 29 # define SECCOMP_ARCH_COMPAT_NAME "arm"
+2 -3
arch/arm64/include/asm/unistd.h
··· 41 41 #endif 42 42 43 43 #define __ARCH_WANT_SYS_CLONE 44 + #define __ARCH_WANT_NEW_STAT 44 45 45 - #ifndef __COMPAT_SYSCALL_NR 46 - #include <uapi/asm/unistd.h> 47 - #endif 46 + #include <asm/unistd_64.h> 48 47 49 48 #define NR_syscalls (__NR_syscalls)
+1
arch/arm64/include/uapi/asm/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 + syscall-y += unistd_64.h 2 3 3 4 generic-y += kvm_para.h
+1 -23
arch/arm64/include/uapi/asm/unistd.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - /* 3 - * Copyright (C) 2012 ARM Ltd. 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 - */ 17 - 18 - #define __ARCH_WANT_RENAMEAT 19 - #define __ARCH_WANT_NEW_STAT 20 - #define __ARCH_WANT_SET_GET_RLIMIT 21 - #define __ARCH_WANT_TIME32_SYSCALLS 22 - #define __ARCH_WANT_MEMFD_SECRET 23 - 24 - #include <asm-generic/unistd.h> 2 + #include <asm/unistd_64.h>
+1
arch/arm64/kernel/Makefile.syscalls
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 3 syscall_abis_32 += 4 + syscall_abis_64 += renameat newstat rlimit memfd_secret 4 5 5 6 syscalltbl = arch/arm64/tools/syscall_%.tbl
+4 -2
arch/arm64/kernel/sys.c
··· 48 48 */ 49 49 #define __arm64_sys_personality __arm64_sys_arm64_personality 50 50 51 + #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) 52 + 51 53 #undef __SYSCALL 52 54 #define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *); 53 - #include <asm/unistd.h> 55 + #include <asm/syscall_table_64.h> 54 56 55 57 #undef __SYSCALL 56 58 #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, 57 59 58 60 const syscall_fn_t sys_call_table[__NR_syscalls] = { 59 61 [0 ... __NR_syscalls - 1] = __arm64_sys_ni_syscall, 60 - #include <asm/unistd.h> 62 + #include <asm/syscall_table_64.h> 61 63 };
+5 -1
arch/arm64/tools/Makefile
··· 3 3 gen := arch/$(ARCH)/include/generated 4 4 kapi := $(gen)/asm 5 5 6 - kapi-hdrs-y := $(kapi)/cpucap-defs.h $(kapi)/sysreg-defs.h 6 + kapisyshdr-y := cpucap-defs.h sysreg-defs.h 7 + 8 + kapi-hdrs-y := $(addprefix $(kapi)/, $(kapisyshdr-y)) 7 9 8 10 targets += $(addprefix ../../../, $(kapi-hdrs-y)) 9 11 10 12 PHONY += kapi 13 + 14 + all: $(syscall64) kapi 11 15 12 16 kapi: $(kapi-hdrs-y) 13 17