Merge tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / perf / arch / powerpc / entry / syscalls / mksyscalltbl
blob6c58060aa03beae7456e4f7cb0588e70207314be
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
4 # Generate system call table for perf. Derived from
5 # s390 script.
7 # Copyright IBM Corp. 2017
8 # Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
9 # Changed by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
11 wordsize=$1
12 SYSCALL_TBL=$2
14 if ! test -r $SYSCALL_TBL; then
15 echo "Could not read input file" >&2
16 exit 1
19 create_table()
21 local wordsize=$1
22 local max_nr nr abi sc discard
23 max_nr=-1
24 nr=0
26 echo "static const char *syscalltbl_powerpc_${wordsize}[] = {"
27 while read nr abi sc discard; do
28 if [ "$max_nr" -lt "$nr" ]; then
29 printf '\t[%d] = "%s",\n' $nr $sc
30 max_nr=$nr
32 done
33 echo '};'
34 echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr"
37 grep -E "^[[:digit:]]+[[:space:]]+(common|spu|nospu|${wordsize})" $SYSCALL_TBL \
38 |sort -k1 -n \
39 |create_table ${wordsize}