aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/syscalls/syscallhdr.sh
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-11-11 18:55:49 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2011-11-17 16:35:36 -0500
commitd181764ccf6207e02abb95fb3052639b947f4833 (patch)
treecd37381b20d437d5d352a07b20fd4a01d332759b /arch/x86/syscalls/syscallhdr.sh
parentd5e553d6e0a4bdea43adae7373e3fa144b9a1aaa (diff)
x86: Machine-readable syscall tables and scripts to process them
Create a simple set of syscall tables and scripts to turn them into both header files (unistd_*.h) and macros for generating the system call tables. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/syscalls/syscallhdr.sh')
-rw-r--r--arch/x86/syscalls/syscallhdr.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/x86/syscalls/syscallhdr.sh b/arch/x86/syscalls/syscallhdr.sh
new file mode 100644
index 00000000000..0d473ff12ea
--- /dev/null
+++ b/arch/x86/syscalls/syscallhdr.sh
@@ -0,0 +1,36 @@
1#!/bin/sh
2
3in="$1"
4out="$2"
5my_abis=`echo "$3" | tr ',' ' '`
6prefix="$4"
7offset="$5"
8
9fileguard=_ASM_X86_`basename "$out" | sed \
10 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
11 -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
12
13in_list () {
14 local x
15 for x in $1; do
16 if [ x"$x" = x"$2" ]; then
17 return 0
18 fi
19 done
20 return 1
21}
22
23grep '^[0-9]' "$in" | sort -n | (
24 echo "#ifndef ${fileguard}"
25 echo "#define ${fileguard} 1"
26 echo ""
27
28 while read nr abi name entry ; do
29 if in_list "$my_abis" "$abi"; then
30 echo "#define __NR_${prefix}${name}" $((nr+offset))
31 fi
32 done
33
34 echo ""
35 echo "#endif /* ${fileguard} */"
36) > "$out"