Merge tag 'sound-5.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[sfrench/cifs-2.6.git] / tools / perf / arch / powerpc / entry / syscalls / mksyscalltbl
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 #
4 # Generate system call table for perf. Derived from
5 # s390 script.
6 #
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>
10
11 wordsize=$1
12 SYSCALL_TBL=$2
13
14 if ! test -r $SYSCALL_TBL; then
15         echo "Could not read input file" >&2
16         exit 1
17 fi
18
19 create_table()
20 {
21         local wordsize=$1
22         local max_nr nr abi sc discard
23         max_nr=-1
24         nr=0
25
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
31                 fi
32         done
33         echo '};'
34         echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr"
35 }
36
37 grep -E "^[[:digit:]]+[[:space:]]+(common|spu|nospu|${wordsize})" $SYSCALL_TBL \
38         |sort -k1 -n                                                           \
39         |create_table ${wordsize}