Skip to content

Commit e632bca

Browse files
committed
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 <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 7fe33e9 commit e632bca

File tree

9 files changed

+17
-29
lines changed

9 files changed

+17
-29
lines changed

arch/arm64/include/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
syscall-y += syscall_table_32.h
3+
syscall-y += syscall_table_64.h
34

45
# arm32 syscall table used by lib/compat_audit.c:
56
syscall-y += unistd_32.h

arch/arm64/include/asm/seccomp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define SECCOMP_ARCH_NATIVE_NR NR_syscalls
2424
#define SECCOMP_ARCH_NATIVE_NAME "aarch64"
2525
#ifdef CONFIG_COMPAT
26+
#include <asm/unistd_compat_32.h>
2627
# define SECCOMP_ARCH_COMPAT AUDIT_ARCH_ARM
2728
# define SECCOMP_ARCH_COMPAT_NR __NR_compat32_syscalls
2829
# define SECCOMP_ARCH_COMPAT_NAME "arm"

arch/arm64/include/asm/unistd.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@
4141
#endif
4242

4343
#define __ARCH_WANT_SYS_CLONE
44+
#define __ARCH_WANT_NEW_STAT
4445

45-
#ifndef __COMPAT_SYSCALL_NR
46-
#include <uapi/asm/unistd.h>
47-
#endif
46+
#include <asm/unistd_64.h>
4847

4948
#define NR_syscalls (__NR_syscalls)

arch/arm64/include/uapi/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2+
syscall-y += unistd_64.h
23

34
generic-y += kvm_para.h

arch/arm64/include/uapi/asm/unistd.h

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
11
/* 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>

arch/arm64/kernel/Makefile.syscalls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22

33
syscall_abis_32 +=
4+
syscall_abis_64 += renameat newstat rlimit memfd_secret
45

56
syscalltbl = arch/arm64/tools/syscall_%.tbl

arch/arm64/kernel/sys.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused)
4848
*/
4949
#define __arm64_sys_personality __arm64_sys_arm64_personality
5050

51+
#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)
52+
5153
#undef __SYSCALL
5254
#define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *);
53-
#include <asm/unistd.h>
55+
#include <asm/syscall_table_64.h>
5456

5557
#undef __SYSCALL
5658
#define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
5759

5860
const syscall_fn_t sys_call_table[__NR_syscalls] = {
5961
[0 ... __NR_syscalls - 1] = __arm64_sys_ni_syscall,
60-
#include <asm/unistd.h>
62+
#include <asm/syscall_table_64.h>
6163
};

arch/arm64/tools/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
gen := arch/$(ARCH)/include/generated
44
kapi := $(gen)/asm
55

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))
79

810
targets += $(addprefix ../../../, $(kapi-hdrs-y))
911

1012
PHONY += kapi
1113

14+
all: $(syscall64) kapi
15+
1216
kapi: $(kapi-hdrs-y)
1317

1418
quiet_cmd_gen_cpucaps = GEN $@

arch/arm64/tools/syscall_64.tbl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../scripts/syscall.tbl

0 commit comments

Comments
 (0)