System call table generation support is provided for alpha, ia64, m68k, microblaze, mips, parisc, powerpc, sh, sparc and xtensa architectures. The implementat- ions are almost similar across all the above archte- ctures. In order to reduce the source code across all the above architectures, create common ".sh" files and keep it in the common directory, script/. This will be a generic scripts which can use for all the above architectures.
This patch depends on; https://lore.kernel.org/lkml/1546439331-18646-1-git-send-email-firoz.khan@li...
Firoz Khan (3): sparc: remove nargs from __SYSCALL sparc: rename not implemented system call sparc: generate uapi header and system call table files
arch/sparc/kernel/syscalls/Makefile | 11 ++++++++-- arch/sparc/kernel/syscalls/syscall.tbl | 26 +++++++++++------------ arch/sparc/kernel/syscalls/syscallhdr.sh | 36 -------------------------------- arch/sparc/kernel/syscalls/syscalltbl.sh | 36 -------------------------------- arch/sparc/kernel/systbls_32.S | 3 ++- arch/sparc/kernel/systbls_64.S | 4 +++- 6 files changed, 27 insertions(+), 89 deletions(-) delete mode 100644 arch/sparc/kernel/syscalls/syscallhdr.sh delete mode 100644 arch/sparc/kernel/syscalls/syscalltbl.sh
The __SYSCALL macro's arguments are system call number, system call entry name and number of arguments for the system call.
Argument- nargs in __SYSCALL(nr, entry, nargs) is neither calculated nor used anywhere. So it would be better to keep the implementaion as __SYSCALL(nr, entry). This will unifies the implementation with some other architetures too.
Signed-off-by: Firoz Khan firoz.khan@linaro.org --- arch/sparc/kernel/syscalls/syscalltbl.sh | 4 ++-- arch/sparc/kernel/systbls_32.S | 2 +- arch/sparc/kernel/systbls_64.S | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/sparc/kernel/syscalls/syscalltbl.sh b/arch/sparc/kernel/syscalls/syscalltbl.sh index 77cf014..ffe954b 100644 --- a/arch/sparc/kernel/syscalls/syscalltbl.sh +++ b/arch/sparc/kernel/syscalls/syscalltbl.sh @@ -13,10 +13,10 @@ emit() { t_entry="$3"
while [ $t_nxt -lt $t_nr ]; do - printf "__SYSCALL(%s, sys_nis_syscall, )\n" "${t_nxt}" + printf "__SYSCALL(%s,sys_nis_syscall)\n" "${t_nxt}" t_nxt=$((t_nxt+1)) done - printf "__SYSCALL(%s, %s, )\n" "${t_nxt}" "${t_entry}" + printf "__SYSCALL(%s,%s)\n" "${t_nxt}" "${t_entry}" }
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index ab9e4d5..391a49a 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S @@ -9,7 +9,7 @@ * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) */
-#define __SYSCALL(nr, entry, nargs) .long entry +#define __SYSCALL(nr, entry) .long entry .data .align 4 .globl sys_call_table diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index a27394b..08ce7cb 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S @@ -10,7 +10,7 @@ * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) */
-#define __SYSCALL(nr, entry, nargs) .word entry +#define __SYSCALL(nr, entry) .word entry .text .align 4 #ifdef CONFIG_COMPAT
Rename the sparc not implemented system call - sys_nis_syscall to sys_ni_syscall to unify the system call table implementation across all architectures.
This is neccessory to do it if we have to keep the scripts in common location.
Signed-off-by: Firoz Khan firoz.khan@linaro.org --- arch/sparc/kernel/syscalls/syscall.tbl | 26 +++++++++++++------------- arch/sparc/kernel/systbls_32.S | 1 + arch/sparc/kernel/systbls_64.S | 2 ++ 3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl index c8c77c0..5437fdb 100644 --- a/arch/sparc/kernel/syscalls/syscall.tbl +++ b/arch/sparc/kernel/syscalls/syscall.tbl @@ -20,7 +20,7 @@ 9 common link sys_link 10 common unlink sys_unlink 11 32 execv sunos_execv -11 64 execv sys_nis_syscall +11 64 execv sys_ni_syscall 12 common chdir sys_chdir 13 32 chown sys_chown16 13 64 chown sys_chown @@ -29,7 +29,7 @@ 16 32 lchown sys_lchown16 16 64 lchown sys_lchown 17 common brk sys_brk -18 common perfctr sys_nis_syscall +18 common perfctr sys_ni_syscall 19 common lseek sys_lseek compat_sys_lseek 20 common getpid sys_getpid 21 common capget sys_capget @@ -43,7 +43,7 @@ 27 common alarm sys_alarm 28 common sigaltstack sys_sigaltstack compat_sys_sigaltstack 29 32 pause sys_pause -29 64 pause sys_nis_syscall +29 64 pause sys_ni_syscall 30 common utime sys_utime compat_sys_utime 31 32 lchown32 sys_lchown 32 32 fchown32 sys_fchown @@ -214,7 +214,7 @@ 181 common removexattr sys_removexattr 182 common lremovexattr sys_lremovexattr 183 32 sigpending sys_sigpending compat_sys_sigpending -183 64 sigpending sys_nis_syscall +183 64 sigpending sys_ni_syscall 184 common query_module sys_ni_syscall 185 common setpgid sys_setpgid 186 common fremovexattr sys_fremovexattr @@ -233,15 +233,15 @@ 196 common ioprio_set sys_ioprio_set 197 common getppid sys_getppid 198 32 sigaction sys_sparc_sigaction compat_sys_sparc_sigaction -198 64 sigaction sys_nis_syscall +198 64 sigaction sys_ni_syscall 199 common sgetmask sys_sgetmask 200 common ssetmask sys_ssetmask 201 32 sigsuspend sys_sigsuspend -201 64 sigsuspend sys_nis_syscall +201 64 sigsuspend sys_ni_syscall 202 common oldlstat sys_newlstat compat_sys_newlstat 203 common uselib sys_uselib 204 32 readdir sys_old_readdir compat_sys_old_readdir -204 64 readdir sys_nis_syscall +204 64 readdir sys_ni_syscall 205 common readahead sys_readahead compat_sys_readahead 206 common socketcall sys_socketcall sys32_socketcall 207 common syslog sys_syslog @@ -255,19 +255,19 @@ 215 32 ipc sys_ipc compat_sys_ipc 215 64 ipc sys_sparc_ipc 216 32 sigreturn sys_sigreturn sys32_sigreturn -216 64 sigreturn sys_nis_syscall +216 64 sigreturn sys_ni_syscall 217 common clone sys_clone 218 common ioprio_get sys_ioprio_get 219 common adjtimex sys_adjtimex compat_sys_adjtimex 220 32 sigprocmask sys_sigprocmask compat_sys_sigprocmask -220 64 sigprocmask sys_nis_syscall +220 64 sigprocmask sys_ni_syscall 221 common create_module sys_ni_syscall 222 common delete_module sys_delete_module 223 common get_kernel_syms sys_ni_syscall 224 common getpgid sys_getpgid 225 common bdflush sys_bdflush 226 common sysfs sys_sysfs -227 common afs_syscall sys_nis_syscall +227 common afs_syscall sys_ni_syscall 228 common setfsuid sys_setfsuid16 229 common setfsgid sys_setfsgid16 230 common _newselect sys_select compat_sys_select @@ -295,8 +295,8 @@ 251 common _sysctl sys_sysctl compat_sys_sysctl 252 common getsid sys_getsid 253 common fdatasync sys_fdatasync -254 32 nfsservctl sys_ni_syscall sys_nis_syscall -254 64 nfsservctl sys_nis_syscall +254 32 nfsservctl sys_ni_syscall sys_ni_syscall +254 64 nfsservctl sys_ni_syscall 255 common sync_file_range sys_sync_file_range compat_sys_sync_file_range 256 common clock_settime sys_clock_settime compat_sys_clock_settime 257 common clock_gettime sys_clock_gettime compat_sys_clock_gettime @@ -310,7 +310,7 @@ 265 common timer_delete sys_timer_delete 266 common timer_create sys_timer_create compat_sys_timer_create # 267 was vserver -267 common vserver sys_nis_syscall +267 common vserver sys_ni_syscall 268 common io_setup sys_io_setup compat_sys_io_setup 269 common io_destroy sys_io_destroy 270 common io_submit sys_io_submit compat_sys_io_submit diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 391a49a..121a1a0 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S @@ -14,5 +14,6 @@ .align 4 .globl sys_call_table sys_call_table: +#define sys_nis_syscall sys_ni_syscall #include <asm/syscall_table_32.h> /* 32-bit native syscalls */ #undef __SYSCALL diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index 08ce7cb..7d861d6 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S @@ -10,6 +10,8 @@ * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) */
+#define sys_nis_syscall sys_ni_syscall + #define __SYSCALL(nr, entry) .word entry .text .align 4
Unified system call table generation script must be run to generate unistd_32/64.h and syscall_table_32/64/c32.h files. This patch will have changes which will invokes the script.
This patch will generate unistd_32/64.h and syscall_table- _32/64/c32.h files by the syscall table generation script invoked by parisc/Makefile and the generated files against the removed files must be identical.
The generated uapi header file will be included in uapi/- asm/unistd.h and generated system call table header file will be included by kernel/systbls_32/64.S file.
Signed-off-by: Firoz Khan firoz.khan@linaro.org --- arch/sparc/kernel/syscalls/Makefile | 11 ++++++++-- arch/sparc/kernel/syscalls/syscallhdr.sh | 36 -------------------------------- arch/sparc/kernel/syscalls/syscalltbl.sh | 36 -------------------------------- 3 files changed, 9 insertions(+), 74 deletions(-) delete mode 100644 arch/sparc/kernel/syscalls/syscallhdr.sh delete mode 100644 arch/sparc/kernel/syscalls/syscalltbl.sh
diff --git a/arch/sparc/kernel/syscalls/Makefile b/arch/sparc/kernel/syscalls/Makefile index c22a21c..e24272d 100644 --- a/arch/sparc/kernel/syscalls/Makefile +++ b/arch/sparc/kernel/syscalls/Makefile @@ -6,8 +6,9 @@ _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \ $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
syscall := $(srctree)/$(src)/syscall.tbl -syshdr := $(srctree)/$(src)/syscallhdr.sh -systbl := $(srctree)/$(src)/syscalltbl.sh +syshdr := $(srctree)/scripts/syscallhdr.sh +sysnr := $(srctree)/scripts/syscallnr.sh +systbl := $(srctree)/scripts/syscalltbl.sh
quiet_cmd_syshdr = SYSHDR $@ cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \ @@ -15,6 +16,12 @@ quiet_cmd_syshdr = SYSHDR $@ '$(syshdr_pfx_$(basetarget))' \ '$(syshdr_offset_$(basetarget))'
+quiet_cmd_sysnr = SYSNR $@ + cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@' \ + '$(sysnr_abis_$(basetarget))' \ + '$(sysnr_pfx_$(basetarget))' \ + '$(sysnr_offset_$(basetarget))' + quiet_cmd_systbl = SYSTBL $@ cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \ '$(systbl_abis_$(basetarget))' \ diff --git a/arch/sparc/kernel/syscalls/syscallhdr.sh b/arch/sparc/kernel/syscalls/syscallhdr.sh deleted file mode 100644 index 626b574..0000000 --- a/arch/sparc/kernel/syscalls/syscallhdr.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 - -in="$1" -out="$2" -my_abis=`echo "($3)" | tr ',' '|'` -prefix="$4" -offset="$5" - -fileguard=_UAPI_ASM_SPARC_`basename "$out" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` -grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( - printf "#ifndef %s\n" "${fileguard}" - printf "#define %s\n" "${fileguard}" - printf "\n" - - nxt=0 - while read nr abi name entry compat ; do - if [ -z "$offset" ]; then - printf "#define __NR_%s%s\t%s\n" \ - "${prefix}" "${name}" "${nr}" - else - printf "#define __NR_%s%s\t(%s + %s)\n" \ - "${prefix}" "${name}" "${offset}" "${nr}" - fi - nxt=$((nr+1)) - done - - printf "\n" - printf "#ifdef __KERNEL__\n" - printf "#define __NR_syscalls\t%s\n" "${nxt}" - printf "#endif\n" - printf "\n" - printf "#endif /* %s */" "${fileguard}" -) > "$out" diff --git a/arch/sparc/kernel/syscalls/syscalltbl.sh b/arch/sparc/kernel/syscalls/syscalltbl.sh deleted file mode 100644 index ffe954b..0000000 --- a/arch/sparc/kernel/syscalls/syscalltbl.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 - -in="$1" -out="$2" -my_abis=`echo "($3)" | tr ',' '|'` -my_abi="$4" -offset="$5" - -emit() { - t_nxt="$1" - t_nr="$2" - t_entry="$3" - - while [ $t_nxt -lt $t_nr ]; do - printf "__SYSCALL(%s,sys_nis_syscall)\n" "${t_nxt}" - t_nxt=$((t_nxt+1)) - done - printf "__SYSCALL(%s,%s)\n" "${t_nxt}" "${t_entry}" -} - -grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( - nxt=0 - if [ -z "$offset" ]; then - offset=0 - fi - - while read nr abi name entry compat ; do - if [ "$my_abi" = "c32" ] && [ ! -z "$compat" ]; then - emit $((nxt+offset)) $((nr+offset)) $compat - else - emit $((nxt+offset)) $((nr+offset)) $entry - fi - nxt=$((nr+1)) - done -) > "$out"
From: Firoz Khan firoz.khan@linaro.org Date: Wed, 2 Jan 2019 21:22:50 +0530
System call table generation support is provided for alpha, ia64, m68k, microblaze, mips, parisc, powerpc, sh, sparc and xtensa architectures. The implementat- ions are almost similar across all the above archte- ctures. In order to reduce the source code across all the above architectures, create common ".sh" files and keep it in the common directory, script/. This will be a generic scripts which can use for all the above architectures.
This patch depends on; https://lore.kernel.org/lkml/1546439331-18646-1-git-send-email-firoz.khan@li...
Can you please merge this series in with that dependency then?
Acked-by: David S. Miller davem@davemloft.net
Hi David,
This patch depends on; https://lore.kernel.org/lkml/1546439331-18646-1-git-send-email-firoz.khan@li...
Can you please merge this series in with that dependency then?
I was planning to push this patch series independently. But when Arnd (he is guiding me for this task) and I discussed some other work, then we planned to include that in this same patch series. I was done with the implementation but it is bit late to post. So please abandon this patch series.
Thanks Firoz