47 lines · plain
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03#4# Generate system call table for perf. Derived from5# powerpc 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# Changed by: Kim Phillips <kim.phillips@arm.com>11 12gcc=$113hostcc=$214incpath=$315input=$416 17if ! test -r $input; then18 echo "Could not read input file" >&219 exit 120fi21 22create_sc_table()23{24 local sc nr max_nr25 26 while read sc nr; do27 printf "%s\n" " [$nr] = \"$sc\","28 max_nr=$nr29 done30 31 echo "#define SYSCALLTBL_ARM64_MAX_ID $max_nr"32}33 34create_table()35{36 echo "#include \"$input\""37 echo "static const char *const syscalltbl_arm64[] = {"38 create_sc_table39 echo "};"40}41 42$gcc -E -dM -x c -I $incpath/include/uapi $input \43 |awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {44 sub("^#define __NR(3264)?_", "");45 print | "sort -k2 -n"}' \46 |create_table47