Skip to content

Commit 4ac286c

Browse files
committed
s390/syscalls: Switch to generic system call table generation
The s390 syscall.tbl format differs slightly from most others, and therefore requires an s390 specific system call table generation script. With compat support gone use the opportunity to switch to generic system call table generation. The abi for all 64 bit system calls is now common, since there is no need to specify if system call entry points are only for 64 bit anymore. Furthermore create the system call table in C instead of assembler code in order to get type checking for all system call functions contained within the table. Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent f4e1f1b commit 4ac286c

7 files changed

Lines changed: 424 additions & 746 deletions

File tree

arch/s390/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,9 @@ zfcpdump:
134134
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
135135

136136
archheaders:
137-
$(Q)$(MAKE) $(build)=$(syscalls) uapi
137+
$(Q)$(MAKE) $(build)=$(syscalls) all
138138

139139
archprepare:
140-
$(Q)$(MAKE) $(build)=$(syscalls) kapi
141140
$(Q)$(MAKE) $(build)=$(tools) kapi $(extra_tools)
142141
ifeq ($(KBUILD_EXTMOD),)
143142
# We need to generate vdso-offsets.h before compiling certain files in kernel/.

arch/s390/include/asm/unistd.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
#define _ASM_S390_UNISTD_H_
99

1010
#include <uapi/asm/unistd.h>
11-
#include <asm/unistd_nr.h>
11+
12+
#define NR_syscalls (__NR_syscalls)
1213

1314
#define __ARCH_WANT_NEW_STAT
1415
#define __ARCH_WANT_OLD_READDIR

arch/s390/kernel/entry.S

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,3 @@ SYM_DATA_START_LOCAL(daton_psw)
606606
.quad PSW_KERNEL_BITS
607607
.quad .Ldaton
608608
SYM_DATA_END(daton_psw)
609-
610-
.section .rodata, "a"
611-
.balign 8
612-
#define SYSCALL(esame,emu) .quad __s390x_ ## esame
613-
SYM_DATA_START(sys_call_table)
614-
#include <asm/syscall_table.h>
615-
SYM_DATA_END(sys_call_table)
616-
#undef SYSCALL

arch/s390/kernel/syscall.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939

4040
#include "entry.h"
4141

42+
#define __SYSCALL(nr, sym) long __s390x_##sym(struct pt_regs *);
43+
#include <asm/syscall_table.h>
44+
#undef __SYSCALL
45+
46+
#define __SYSCALL(nr, sym) [nr] = (__s390x_##sym),
47+
const sys_call_ptr_t sys_call_table[__NR_syscalls] = {
48+
#include <asm/syscall_table.h>
49+
};
50+
#undef __SYSCALL
51+
4252
#ifdef CONFIG_SYSVIPC
4353
/*
4454
* sys_ipc() is the de-multiplexer for the SysV IPC calls.

arch/s390/kernel/syscalls/Makefile

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,32 @@
11
# SPDX-License-Identifier: GPL-2.0
2+
kapi := arch/$(SRCARCH)/include/generated/asm
3+
uapi := arch/$(SRCARCH)/include/generated/uapi/asm
24

3-
gen := arch/$(ARCH)/include/generated
4-
kapi := $(gen)/asm
5-
uapi := $(gen)/uapi/asm
6-
7-
syscall := $(src)/syscall.tbl
8-
systbl := $(src)/syscalltbl
9-
10-
gen-y := $(kapi)/syscall_table.h
11-
kapi-hdrs-y := $(kapi)/unistd_nr.h
12-
uapi-hdrs-y := $(uapi)/unistd_32.h
13-
uapi-hdrs-y += $(uapi)/unistd_64.h
14-
15-
targets += $(addprefix ../../../../,$(gen-y) $(kapi-hdrs-y) $(uapi-hdrs-y))
16-
17-
PHONY += kapi uapi
18-
19-
kapi: $(gen-y) $(kapi-hdrs-y)
20-
uapi: $(uapi-hdrs-y)
21-
22-
23-
# Create output directory if not already present
245
$(shell mkdir -p $(uapi) $(kapi))
256

26-
quiet_cmd_syshdr = SYSHDR $@
27-
cmd_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$@" < $< > $@
28-
29-
quiet_cmd_sysnr = SYSNR $@
30-
cmd_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $< > $@
7+
syscall := $(src)/syscall.tbl
8+
syshdr := $(srctree)/scripts/syscallhdr.sh
9+
systbl := $(srctree)/scripts/syscalltbl.sh
3110

32-
quiet_cmd_syscalls = SYSTBL $@
33-
cmd_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $< > $@
11+
quiet_cmd_syshdr = SYSHDR $@
12+
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis common,$* $< $@
3413

35-
syshdr_abi_unistd_32 := common,32
36-
$(uapi)/unistd_32.h: $(syscall) $(systbl) FORCE
37-
$(call if_changed,syshdr)
14+
quiet_cmd_systbl = SYSTBL $@
15+
cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis common,$* $< $@
3816

39-
syshdr_abi_unistd_64 := common,64
40-
$(uapi)/unistd_64.h: $(syscall) $(systbl) FORCE
17+
$(uapi)/unistd_%.h: $(syscall) $(syshdr) FORCE
4118
$(call if_changed,syshdr)
4219

4320
$(kapi)/syscall_table.h: $(syscall) $(systbl) FORCE
44-
$(call if_changed,syscalls)
21+
$(call if_changed,systbl)
22+
23+
uapisyshdr-y += unistd_64.h
24+
kapisyshdr-y += syscall_table.h
25+
26+
uapisyshdr-y := $(addprefix $(uapi)/, $(uapisyshdr-y))
27+
kapisyshdr-y := $(addprefix $(kapi)/, $(kapisyshdr-y))
28+
targets += $(addprefix ../../../../, $(uapisyshdr-y) $(kapisyshdr-y))
4529

46-
sysnr_abi_unistd_nr := common,32,64
47-
$(kapi)/unistd_nr.h: $(syscall) $(systbl) FORCE
48-
$(call if_changed,sysnr)
30+
PHONY += all
31+
all: $(uapisyshdr-y) $(kapisyshdr-y)
32+
@:

0 commit comments

Comments
 (0)