summaryrefslogtreecommitdiff
path: root/arch/arm/tools/syscallhdr.sh
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-10-18 21:57:01 +0300
committerRussell King <rmk+kernel@armlinux.org.uk>2016-10-18 23:34:06 +0300
commit96a8fae0fe094b6a26a3ec88b2f097418f269cfe (patch)
tree611c87ac99ac3ee4407d4d37b6c77d5274e3c2e1 /arch/arm/tools/syscallhdr.sh
parent4e2648db9c5f7b2281551694597102612f54460d (diff)
downloadlinux-96a8fae0fe094b6a26a3ec88b2f097418f269cfe.tar.xz
ARM: convert to generated system call tables
Convert ARM to use a similar mechanism to x86 to generate the unistd.h system call numbers and the various kernel system call tables. This means that rather than having to edit three places (asm/unistd.h for the total number of system calls, uapi/asm/unistd.h for the system call numbers, and arch/arm/kernel/calls.S for the call table) we have only one place to edit, making the process much more simple. The scripts have knowledge of the table padding requirements, so there's no need to worry about __NR_syscalls not fitting within the immediate constant field of ALU instructions anymore. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch/arm/tools/syscallhdr.sh')
-rw-r--r--arch/arm/tools/syscallhdr.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/tools/syscallhdr.sh b/arch/arm/tools/syscallhdr.sh
new file mode 100644
index 000000000000..72d4b2e3bdec
--- /dev/null
+++ b/arch/arm/tools/syscallhdr.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+in="$1"
+out="$2"
+my_abis=`echo "($3)" | tr ',' '|'`
+prefix="$4"
+offset="$5"
+
+fileguard=_ASM_ARM_`basename "$out" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
+if echo $out | grep -q uapi; then
+ fileguard="_UAPI$fileguard"
+fi
+grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
+ echo "#ifndef ${fileguard}"
+ echo "#define ${fileguard} 1"
+ echo ""
+
+ while read nr abi name entry ; do
+ if [ -z "$offset" ]; then
+ echo "#define __NR_${prefix}${name} $nr"
+ else
+ echo "#define __NR_${prefix}${name} ($offset + $nr)"
+ fi
+ done
+
+ echo ""
+ echo "#endif /* ${fileguard} */"
+) > "$out"