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 12gcc=$2 13input=$3 14 15if ! test -r $input; then 16 echo "Could not read input file" >&2 17 exit 1 18fi 19 20create_table() 21{ 22 local wordsize=$1 23 local max_nr 24 25 echo "static const char *syscalltbl_powerpc_${wordsize}[] = {" 26 while read sc nr; do 27 printf '\t[%d] = "%s",\n' $nr $sc 28 max_nr=$nr 29 done 30 echo '};' 31 echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr" 32} 33 34$gcc -m${wordsize} -E -dM -x c $input \ 35 |sed -ne 's/^#define __NR_//p' \ 36 |sort -t' ' -k2 -nu \ 37 |create_table ${wordsize} 38