mksyscalltbl (919B)
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 11wordsize=$1 12SYSCALL_TBL=$2 13 14if ! test -r $SYSCALL_TBL; then 15 echo "Could not read input file" >&2 16 exit 1 17fi 18 19create_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 37grep -E "^[[:digit:]]+[[:space:]]+(common|spu|nospu|${wordsize})" $SYSCALL_TBL \ 38 |sort -k1 -n \ 39 |create_table ${wordsize}