1 #!/bin/sh 2 # SPDX-License-Identifier: GPL-2.0 3 # 4 # Generate system call table for perf. Derived from 5 # powerpc script. 6 # 7 # Author(s): Ming Wang <wangming01@loongson.cn> 8 # Author(s): Huacai Chen <chenhuacai@loongson.cn> 9 # Copyright (C) 2020-2023 Loongson Technology Corporation Limited 10 11 gcc=$1 12 hostcc=$2 13 incpath=$3 14 input=$4 15 16 if ! test -r $input; then 17 echo "Could not read input file" >&2 18 exit 1 19 fi 20 21 create_sc_table() 22 { 23 local sc nr max_nr 24 25 while read sc nr; do 26 printf "%s\n" " [$nr] = \"$sc\"," 27 max_nr=$nr 28 done 29 30 echo "#define SYSCALLTBL_LOONGARCH_MAX_ID $max_nr" 31 } 32 33 create_table() 34 { 35 echo "#include \"$input\"" 36 echo "static const char *const syscalltbl_loongarch[] = {" 37 create_sc_table 38 echo "};" 39 } 40 41 $gcc -E -dM -x c -I $incpath/include/uapi $input \ 42 |awk '$2 ~ "__NR" && $3 !~ "__NR3264_" { 43 sub("^#define __NR(3264)?_", ""); 44 print | "sort -k2 -n"}' \ 45 |create_table
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.