Commit | Line | Data |
---|---|---|
1b700c99 | 1 | #!/bin/sh |
b2441318 | 2 | # SPDX-License-Identifier: GPL-2.0 |
1b700c99 ACM |
3 | |
4 | in="$1" | |
5 | arch="$2" | |
6 | ||
7 | syscall_macro() { | |
8 | nr="$1" | |
9 | name="$2" | |
10 | ||
11 | echo " [$nr] = \"$name\"," | |
12 | } | |
13 | ||
14 | emit() { | |
15 | nr="$1" | |
16 | entry="$2" | |
17 | ||
18 | syscall_macro "$nr" "$entry" | |
19 | } | |
20 | ||
21 | echo "static const char *syscalltbl_${arch}[] = {" | |
22 | ||
23 | sorted_table=$(mktemp /tmp/syscalltbl.XXXXXX) | |
24 | grep '^[0-9]' "$in" | sort -n > $sorted_table | |
25 | ||
26 | max_nr=0 | |
27 | while 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 | |
34 | done < $sorted_table | |
35 | ||
36 | rm -f $sorted_table | |
37 | ||
38 | echo "};" | |
39 | ||
40 | echo "#define SYSCALLTBL_${arch}_MAX_ID ${max_nr}" |