40 lines · plain
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03#4# Generate system call table for perf. Derived from5# s390 script.6#7# Copyright IBM Corp. 20178# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>9# Changed by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>10 11wordsize=$112SYSCALL_TBL=$213 14if ! test -r $SYSCALL_TBL; then15 echo "Could not read input file" >&216 exit 117fi18 19create_table()20{21 local wordsize=$122 local max_nr nr abi sc discard23 max_nr=-124 nr=025 26 echo "static const char *const syscalltbl_powerpc_${wordsize}[] = {"27 while read nr abi sc discard; do28 if [ "$max_nr" -lt "$nr" ]; then29 printf '\t[%d] = "%s",\n' $nr $sc30 max_nr=$nr31 fi32 done33 echo '};'34 echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr"35}36 37grep -E "^[[:digit:]]+[[:space:]]+(common|spu|nospu|${wordsize})" $SYSCALL_TBL \38 |sort -k1 -n \39 |create_table ${wordsize}40