blob: 5ebeaf1041e7c4fc1648c2cfb39cc8df9d8a85cd [file] [log] [blame]
H. Peter Anvind1817642011-11-11 15:55:49 -08001#!/bin/sh
2
3in="$1"
4out="$2"
5
Andy Lutomirskifba32472016-01-28 15:11:21 -08006emit() {
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
H. Peter Anvind1817642011-11-11 15:55:49 -080018grep '^[0-9]' "$in" | sort -n | (
19 while read nr abi name entry compat; do
20 abi=`echo "$abi" | tr '[a-z]' '[A-Z]'`
Andy Lutomirski32324ce2016-01-28 15:11:22 -080021 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
H. Peter Anvind1817642011-11-11 15:55:49 -080037 done
38) > "$out"