Commit 4ac286c4 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent f4e1f1b1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -134,10 +134,9 @@ zfcpdump:
	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

archheaders:
	$(Q)$(MAKE) $(build)=$(syscalls) uapi
	$(Q)$(MAKE) $(build)=$(syscalls) all

archprepare:
	$(Q)$(MAKE) $(build)=$(syscalls) kapi
	$(Q)$(MAKE) $(build)=$(tools) kapi $(extra_tools)
ifeq ($(KBUILD_EXTMOD),)
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
+2 −1
Original line number Diff line number Diff line
@@ -8,7 +8,8 @@
#define _ASM_S390_UNISTD_H_

#include <uapi/asm/unistd.h>
#include <asm/unistd_nr.h>

#define NR_syscalls (__NR_syscalls)

#define __ARCH_WANT_NEW_STAT
#define __ARCH_WANT_OLD_READDIR
+0 −8
Original line number Diff line number Diff line
@@ -606,11 +606,3 @@ SYM_DATA_START_LOCAL(daton_psw)
	.quad	PSW_KERNEL_BITS
	.quad	.Ldaton
SYM_DATA_END(daton_psw)

	.section .rodata, "a"
	.balign	8
#define SYSCALL(esame,emu)	.quad __s390x_ ## esame
SYM_DATA_START(sys_call_table)
#include <asm/syscall_table.h>
SYM_DATA_END(sys_call_table)
#undef SYSCALL
+10 −0
Original line number Diff line number Diff line
@@ -39,6 +39,16 @@

#include "entry.h"

#define __SYSCALL(nr, sym) long __s390x_##sym(struct pt_regs *);
#include <asm/syscall_table.h>
#undef __SYSCALL

#define __SYSCALL(nr, sym) [nr] = (__s390x_##sym),
const sys_call_ptr_t sys_call_table[__NR_syscalls] = {
#include <asm/syscall_table.h>
};
#undef __SYSCALL

#ifdef CONFIG_SYSVIPC
/*
 * sys_ipc() is the de-multiplexer for the SysV IPC calls.
+21 −37
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
kapi := arch/$(SRCARCH)/include/generated/asm
uapi := arch/$(SRCARCH)/include/generated/uapi/asm

gen	:= arch/$(ARCH)/include/generated
kapi	:= $(gen)/asm
uapi	:= $(gen)/uapi/asm
$(shell mkdir -p $(uapi) $(kapi))

syscall := $(src)/syscall.tbl
systbl	:= $(src)/syscalltbl

gen-y := $(kapi)/syscall_table.h
kapi-hdrs-y := $(kapi)/unistd_nr.h
uapi-hdrs-y := $(uapi)/unistd_32.h
uapi-hdrs-y += $(uapi)/unistd_64.h

targets += $(addprefix ../../../../,$(gen-y) $(kapi-hdrs-y) $(uapi-hdrs-y))

PHONY += kapi uapi

kapi:	$(gen-y) $(kapi-hdrs-y)
uapi:	$(uapi-hdrs-y)


# Create output directory if not already present
$(shell mkdir -p $(uapi) $(kapi))
syshdr := $(srctree)/scripts/syscallhdr.sh
systbl := $(srctree)/scripts/syscalltbl.sh

quiet_cmd_syshdr = SYSHDR  $@
      cmd_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$@" < $< > $@

quiet_cmd_sysnr = SYSNR   $@
      cmd_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $< > $@

quiet_cmd_syscalls = SYSTBL  $@
      cmd_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $< > $@
      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis common,$* $< $@

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

syshdr_abi_unistd_64 := common,64
$(uapi)/unistd_64.h: $(syscall) $(systbl) FORCE
$(uapi)/unistd_%.h: $(syscall) $(syshdr) FORCE
	$(call if_changed,syshdr)

$(kapi)/syscall_table.h: $(syscall) $(systbl) FORCE
	$(call if_changed,syscalls)
	$(call if_changed,systbl)

uapisyshdr-y		+= unistd_64.h
kapisyshdr-y		+= syscall_table.h

uapisyshdr-y	:= $(addprefix $(uapi)/, $(uapisyshdr-y))
kapisyshdr-y	:= $(addprefix $(kapi)/, $(kapisyshdr-y))
targets		+= $(addprefix ../../../../, $(uapisyshdr-y) $(kapisyshdr-y))

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