0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 gcc=$1
0013 hostcc=$2
0014 incpath=$3
0015 input=$4
0016
0017 if ! test -r $input; then
0018 echo "Could not read input file" >&2
0019 exit 1
0020 fi
0021
0022 create_table_from_c()
0023 {
0024 local sc nr last_sc
0025
0026 create_table_exe=`mktemp ${TMPDIR:-/tmp}/create-table-XXXXXX`
0027
0028 {
0029
0030 cat <<-_EoHEADER
0031
0032
0033 int main(int argc, char *argv[])
0034 {
0035 _EoHEADER
0036
0037 while read sc nr; do
0038 printf "%s\n" " printf(\"\\t[%d] = \\\"$sc\\\",\\n\", __NR_$sc);"
0039 last_sc=$sc
0040 done
0041
0042 printf "%s\n" " printf(\"#define SYSCALLTBL_ARM64_MAX_ID %d\\n\", __NR_$last_sc);"
0043 printf "}\n"
0044
0045 } | $hostcc -I $incpath/include/uapi -o $create_table_exe -x c -
0046
0047 $create_table_exe
0048
0049 rm -f $create_table_exe
0050 }
0051
0052 create_table()
0053 {
0054 echo "static const char *syscalltbl_arm64[] = {"
0055 create_table_from_c
0056 echo "};"
0057 }
0058
0059 $gcc -E -dM -x c -I $incpath/include/uapi $input \
0060 |sed -ne 's/^#define __NR_//p' \
0061 |sort -t' ' -k2 -nu \
0062 |create_table