Commit | Line | Data |
---|---|---|
d181764c PA |
1 | #!/bin/sh |
2 | ||
3 | in="$1" | |
4 | out="$2" | |
5 | ||
fba32474 AL |
6 | emit() { |
7 | abi="$1" | |
8 | nr="$2" | |
9 | entry="$3" | |
10 | compat="$4" | |
11 | if [ -n "$compat" ]; then | |
12 | echo "__SYSCALL_${abi}($nr, $entry, $compat)" | |
13 | elif [ -n "$entry" ]; then | |
14 | echo "__SYSCALL_${abi}($nr, $entry, $entry)" | |
15 | fi | |
16 | } | |
17 | ||
d181764c PA |
18 | grep '^[0-9]' "$in" | sort -n | ( |
19 | while read nr abi name entry compat; do | |
20 | abi=`echo "$abi" | tr '[a-z]' '[A-Z]'` | |
32324ce1 AL |
21 | if [ "$abi" == "COMMON" -o "$abi" == "64" ]; then |
22 | # COMMON is the same as 64, except that we don't expect X32 | |
23 | # programs to use it. Our expectation has nothing to do with | |
24 | # any generated code, so treat them the same. | |
25 | emit 64 "$nr" "$entry" "$compat" | |
26 | elif [ "$abi" == "X32" ]; then | |
27 | # X32 is equivalent to 64 on an X32-compatible kernel. | |
28 | echo "#ifdef CONFIG_X86_X32_ABI" | |
29 | emit 64 "$nr" "$entry" "$compat" | |
30 | echo "#endif" | |
31 | elif [ "$abi" == "I386" ]; then | |
32 | emit "$abi" "$nr" "$entry" "$compat" | |
33 | else | |
34 | echo "Unknown abi $abi" >&2 | |
35 | exit 1 | |
36 | fi | |
d181764c PA |
37 | done |
38 | ) > "$out" |