1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3 4in="$1" 5arch="$2" 6 7syscall_macro() { 8 nr="$1" 9 name="$2" 10 11 echo " [$nr] = \"$name\"," 12} 13 14emit() { 15 nr="$1" 16 entry="$2" 17 18 syscall_macro "$nr" "$entry" 19} 20 21echo "static const char *syscalltbl_${arch}[] = {" 22 23sorted_table=$(mktemp /tmp/syscalltbl.XXXXXX) 24grep '^[0-9]' "$in" | sort -n > $sorted_table 25 26max_nr=0 27while read nr abi name entry compat; do 28 if [ $nr -ge 512 ] ; then # discard compat sycalls 29 break 30 fi 31 32 emit "$nr" "$name" 33 max_nr=$nr 34done < $sorted_table 35 36rm -f $sorted_table 37 38echo "};" 39 40echo "#define SYSCALLTBL_${arch}_MAX_ID ${max_nr}" 41