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

ARM: 9067/1: syscalls: switch to generic syscallhdr.sh

Many architectures duplicate similar shell scripts.

This commit converts ARM to use scripts/syscallhdr.sh, and also
collects OABI/OEBI syscalls into unistd-eabi.h/unistd-oabi.h,
removing unistd-common.h.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

authored by

Masahiro Yamada and committed by
Russell King
32e9a0d5 0047eb9f

+5 -45
-1
arch/arm/include/uapi/asm/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 - generated-y += unistd-common.h 4 3 generated-y += unistd-oabi.h 5 4 generated-y += unistd-eabi.h 6 5 generic-y += kvm_para.h
-1
arch/arm/include/uapi/asm/unistd.h
··· 24 24 #include <asm/unistd-oabi.h> 25 25 #endif 26 26 27 - #include <asm/unistd-common.h> 28 27 #define __NR_sync_file_range2 __NR_arm_sync_file_range 29 28 30 29 /*
+5 -12
arch/arm/tools/Makefile
··· 8 8 gen := arch/$(ARCH)/include/generated 9 9 kapi := $(gen)/asm 10 10 uapi := $(gen)/uapi/asm 11 - syshdr := $(srctree)/$(src)/syscallhdr.sh 11 + syshdr := $(srctree)/scripts/syscallhdr.sh 12 12 sysnr := $(srctree)/$(src)/syscallnr.sh 13 13 systbl := $(srctree)/scripts/syscalltbl.sh 14 14 syscall := $(src)/syscall.tbl ··· 17 17 gen-y += $(gen)/calls-eabi.S 18 18 kapi-hdrs-y := $(kapi)/unistd-nr.h 19 19 kapi-hdrs-y += $(kapi)/mach-types.h 20 - uapi-hdrs-y := $(uapi)/unistd-common.h 21 20 uapi-hdrs-y += $(uapi)/unistd-oabi.h 22 21 uapi-hdrs-y += $(uapi)/unistd-eabi.h 23 22 ··· 40 41 $(call if_changed,gen_mach) 41 42 42 43 quiet_cmd_syshdr = SYSHDR $@ 43 - cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \ 44 - '$(syshdr_abi_$(basetarget))' \ 45 - '$(syshdr_pfx_$(basetarget))' \ 46 - '__NR_SYSCALL_BASE' 44 + cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis $(abis) \ 45 + --offset __NR_SYSCALL_BASE $< $@ 47 46 48 47 quiet_cmd_systbl = SYSTBL $@ 49 48 cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@ ··· 50 53 cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@' \ 51 54 '$(syshdr_abi_$(basetarget))' 52 55 53 - syshdr_abi_unistd-common := common 54 - $(uapi)/unistd-common.h: $(syscall) $(syshdr) FORCE 55 - $(call if_changed,syshdr) 56 - 57 - syshdr_abi_unistd-oabi := oabi 56 + $(uapi)/unistd-oabi.h: abis := common,oabi 58 57 $(uapi)/unistd-oabi.h: $(syscall) $(syshdr) FORCE 59 58 $(call if_changed,syshdr) 60 59 61 - syshdr_abi_unistd-eabi := eabi 60 + $(uapi)/unistd-eabi.h: abis := common,eabi 62 61 $(uapi)/unistd-eabi.h: $(syscall) $(syshdr) FORCE 63 62 $(call if_changed,syshdr) 64 63
-31
arch/arm/tools/syscallhdr.sh
··· 1 - #!/bin/sh 2 - # SPDX-License-Identifier: GPL-2.0 3 - 4 - in="$1" 5 - out="$2" 6 - my_abis=`echo "($3)" | tr ',' '|'` 7 - prefix="$4" 8 - offset="$5" 9 - 10 - fileguard=_ASM_ARM_`basename "$out" | sed \ 11 - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ 12 - -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` 13 - if echo $out | grep -q uapi; then 14 - fileguard="_UAPI$fileguard" 15 - fi 16 - grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( 17 - echo "#ifndef ${fileguard}" 18 - echo "#define ${fileguard} 1" 19 - echo "" 20 - 21 - while read nr abi name entry ; do 22 - if [ -z "$offset" ]; then 23 - echo "#define __NR_${prefix}${name} $nr" 24 - else 25 - echo "#define __NR_${prefix}${name} ($offset + $nr)" 26 - fi 27 - done 28 - 29 - echo "" 30 - echo "#endif /* ${fileguard} */" 31 - ) > "$out"