0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 wordsize=$1
0012 SYSCALL_TBL=$2
0013
0014 if ! test -r $SYSCALL_TBL; then
0015 echo "Could not read input file" >&2
0016 exit 1
0017 fi
0018
0019 create_table()
0020 {
0021 local wordsize=$1
0022 local max_nr nr abi sc discard
0023 max_nr=-1
0024 nr=0
0025
0026 echo "static const char *syscalltbl_powerpc_${wordsize}[] = {"
0027 while read nr abi sc discard; do
0028 if [ "$max_nr" -lt "$nr" ]; then
0029 printf '\t[%d] = "%s",\n' $nr $sc
0030 max_nr=$nr
0031 fi
0032 done
0033 echo '};'
0034 echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr"
0035 }
0036
0037 grep -E "^[[:digit:]]+[[:space:]]+(common|spu|nospu|${wordsize})" $SYSCALL_TBL \
0038 |sort -k1 -n \
0039 |create_table ${wordsize}