Skip to content

Commit aff8503

Browse files
Firoz Khanmpe
authored andcommitted
powerpc: add system call table generation support
The system call tables are in different format in all architecture and it will be difficult to manually add or modify the system calls in the respective files. To make it easy by keeping a script and which will generate the uapi header and syscall table file. This change will also help to unify the implementation across all architectures. The system call table generation script is added in syscalls directory which contain the script to generate both uapi header file and system call table files. The syscall.tbl file will be the input for the scripts. syscall.tbl contains the list of available system calls along with system call number and corresponding entry point. Add a new system call in this architecture will be possible by adding new entry in the syscall.tbl file. Adding a new table entry consisting of: - System call number. - ABI. - System call name. - Entry point name. - Compat entry name, if required. syscallhdr.sh and syscalltbl.sh will generate uapi header- unistd_32/64.h and syscall_table_32/64/c32/spu.h files respectively. File syscall_table_32/64/c32/spu.h is incl- uded by syscall.S - the real system call table. Both *.sh files will parse the content syscall.tbl to generate the header and table files. ARM, s390 and x86 architecuture does have similar support. I leverage their implementation to come up with a generic solution. Signed-off-by: Firoz Khan <firoz.khan@linaro.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent fbf508d commit aff8503

4 files changed

Lines changed: 563 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
kapi := arch/$(SRCARCH)/include/generated/asm
3+
uapi := arch/$(SRCARCH)/include/generated/uapi/asm
4+
5+
_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
6+
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
7+
8+
syscall := $(srctree)/$(src)/syscall.tbl
9+
syshdr := $(srctree)/$(src)/syscallhdr.sh
10+
systbl := $(srctree)/$(src)/syscalltbl.sh
11+
12+
quiet_cmd_syshdr = SYSHDR $@
13+
cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
14+
'$(syshdr_abis_$(basetarget))' \
15+
'$(syshdr_pfx_$(basetarget))' \
16+
'$(syshdr_offset_$(basetarget))'
17+
18+
quiet_cmd_systbl = SYSTBL $@
19+
cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \
20+
'$(systbl_abis_$(basetarget))' \
21+
'$(systbl_abi_$(basetarget))' \
22+
'$(systbl_offset_$(basetarget))'
23+
24+
syshdr_abis_unistd_32 := common,nospu,32
25+
$(uapi)/unistd_32.h: $(syscall) $(syshdr)
26+
$(call if_changed,syshdr)
27+
28+
syshdr_abis_unistd_64 := common,nospu,64
29+
$(uapi)/unistd_64.h: $(syscall) $(syshdr)
30+
$(call if_changed,syshdr)
31+
32+
systbl_abis_syscall_table_32 := common,nospu,32
33+
systbl_abi_syscall_table_32 := 32
34+
$(kapi)/syscall_table_32.h: $(syscall) $(systbl)
35+
$(call if_changed,systbl)
36+
37+
systbl_abis_syscall_table_64 := common,nospu,64
38+
systbl_abi_syscall_table_64 := 64
39+
$(kapi)/syscall_table_64.h: $(syscall) $(systbl)
40+
$(call if_changed,systbl)
41+
42+
systbl_abis_syscall_table_c32 := common,nospu,32
43+
systbl_abi_syscall_table_c32 := c32
44+
$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)
45+
$(call if_changed,systbl)
46+
47+
systbl_abis_syscall_table_spu := common,spu
48+
systbl_abi_syscall_table_spu := spu
49+
$(kapi)/syscall_table_spu.h: $(syscall) $(systbl)
50+
$(call if_changed,systbl)
51+
52+
uapisyshdr-y += unistd_32.h unistd_64.h
53+
kapisyshdr-y += syscall_table_32.h \
54+
syscall_table_64.h \
55+
syscall_table_c32.h \
56+
syscall_table_spu.h
57+
58+
targets += $(uapisyshdr-y) $(kapisyshdr-y)
59+
60+
PHONY += all
61+
all: $(addprefix $(uapi)/,$(uapisyshdr-y))
62+
all: $(addprefix $(kapi)/,$(kapisyshdr-y))
63+
@:

0 commit comments

Comments
 (0)