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

sparc: syscalls: switch to generic syscalltbl.sh

Many architectures duplicate similar shell scripts.

This commit converts sparc to use scripts/syscalltbl.sh. This also
unifies syscall_table_64.h and syscall_table_c32.h.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+12 -56
-1
arch/sparc/include/asm/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 generated-y += syscall_table_32.h 3 3 generated-y += syscall_table_64.h 4 - generated-y += syscall_table_c32.h 5 4 generic-y += export.h 6 5 generic-y += kvm_para.h 7 6 generic-y += mcs_spinlock.h
+5 -14
arch/sparc/kernel/syscalls/Makefile
··· 7 7 8 8 syscall := $(src)/syscall.tbl 9 9 syshdr := $(srctree)/$(src)/syscallhdr.sh 10 - systbl := $(srctree)/$(src)/syscalltbl.sh 10 + systbl := $(srctree)/scripts/syscalltbl.sh 11 11 12 12 quiet_cmd_syshdr = SYSHDR $@ 13 13 cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \ ··· 16 16 '$(syshdr_offset_$(basetarget))' 17 17 18 18 quiet_cmd_systbl = SYSTBL $@ 19 - cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \ 20 - '$(systbl_abis_$(basetarget))' \ 21 - '$(systbl_abi_$(basetarget))' \ 22 - '$(systbl_offset_$(basetarget))' 19 + cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@ 23 20 24 21 syshdr_abis_unistd_32 := common,32 25 22 $(uapi)/unistd_32.h: $(syscall) $(syshdr) FORCE ··· 26 29 $(uapi)/unistd_64.h: $(syscall) $(syshdr) FORCE 27 30 $(call if_changed,syshdr) 28 31 29 - systbl_abis_syscall_table_32 := common,32 32 + $(kapi)/syscall_table_32.h: abis := common,32 30 33 $(kapi)/syscall_table_32.h: $(syscall) $(systbl) FORCE 31 34 $(call if_changed,systbl) 32 35 33 - systbl_abis_syscall_table_64 := common,64 36 + $(kapi)/syscall_table_64.h: abis := common,64 34 37 $(kapi)/syscall_table_64.h: $(syscall) $(systbl) FORCE 35 - $(call if_changed,systbl) 36 - 37 - systbl_abis_syscall_table_c32 := common,32 38 - systbl_abi_syscall_table_c32 := c32 39 - $(kapi)/syscall_table_c32.h: $(syscall) $(systbl) FORCE 40 38 $(call if_changed,systbl) 41 39 42 40 uapisyshdr-y += unistd_32.h unistd_64.h 43 41 kapisyshdr-y += syscall_table_32.h \ 44 - syscall_table_64.h \ 45 - syscall_table_c32.h 42 + syscall_table_64.h 46 43 47 44 uapisyshdr-y := $(addprefix $(uapi)/, $(uapisyshdr-y)) 48 45 kapisyshdr-y := $(addprefix $(kapi)/, $(kapisyshdr-y))
-36
arch/sparc/kernel/syscalls/syscalltbl.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 - my_abi="$4" 8 - offset="$5" 9 - 10 - emit() { 11 - t_nxt="$1" 12 - t_nr="$2" 13 - t_entry="$3" 14 - 15 - while [ $t_nxt -lt $t_nr ]; do 16 - printf "__SYSCALL(%s, sys_nis_syscall, )\n" "${t_nxt}" 17 - t_nxt=$((t_nxt+1)) 18 - done 19 - printf "__SYSCALL(%s, %s, )\n" "${t_nxt}" "${t_entry}" 20 - } 21 - 22 - grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( 23 - nxt=0 24 - if [ -z "$offset" ]; then 25 - offset=0 26 - fi 27 - 28 - while read nr abi name entry compat ; do 29 - if [ "$my_abi" = "c32" ] && [ ! -z "$compat" ]; then 30 - emit $((nxt+offset)) $((nr+offset)) $compat 31 - else 32 - emit $((nxt+offset)) $((nr+offset)) $entry 33 - fi 34 - nxt=$((nr+1)) 35 - done 36 - ) > "$out"
+2 -2
arch/sparc/kernel/systbls_32.S
··· 9 9 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) 10 10 */ 11 11 12 - #define __SYSCALL(nr, entry, nargs) .long entry 12 + #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) 13 + #define __SYSCALL(nr, entry) .long entry 13 14 .data 14 15 .align 4 15 16 .globl sys_call_table 16 17 sys_call_table: 17 18 #include <asm/syscall_table_32.h> /* 32-bit native syscalls */ 18 - #undef __SYSCALL
+5 -3
arch/sparc/kernel/systbls_64.S
··· 10 10 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) 11 11 */ 12 12 13 - #define __SYSCALL(nr, entry, nargs) .word entry 13 + #define __SYSCALL(nr, entry) .word entry 14 14 .text 15 15 .align 4 16 16 #ifdef CONFIG_COMPAT 17 17 .globl sys_call_table32 18 18 sys_call_table32: 19 - #include <asm/syscall_table_c32.h> /* Compat syscalls */ 19 + #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat) 20 + #include <asm/syscall_table_32.h> /* Compat syscalls */ 21 + #undef __SYSCALL_WITH_COMPAT 20 22 #endif /* CONFIG_COMPAT */ 21 23 22 24 .align 4 23 25 .globl sys_call_table64, sys_call_table 24 26 sys_call_table64: 25 27 sys_call_table: 28 + #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) 26 29 #include <asm/syscall_table_64.h> /* 64-bit native syscalls */ 27 - #undef __SYSCALL