diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:05:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:05:51 +0000 |
commit | 5d1646d90e1f2cceb9f0828f4b28318cd0ec7744 (patch) | |
tree | a94efe259b9009378be6d90eb30d2b019d95c194 /arch/arm/tools/syscallnr.sh | |
parent | Initial commit. (diff) | |
download | linux-5d1646d90e1f2cceb9f0828f4b28318cd0ec7744.tar.xz linux-5d1646d90e1f2cceb9f0828f4b28318cd0ec7744.zip |
Adding upstream version 5.10.209.upstream/5.10.209
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | arch/arm/tools/syscallnr.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/tools/syscallnr.sh b/arch/arm/tools/syscallnr.sh new file mode 100644 index 000000000..df3ccd0ca --- /dev/null +++ b/arch/arm/tools/syscallnr.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +in="$1" +out="$2" +my_abis=`echo "($3)" | tr ',' '|'` +align=1 + +fileguard=_ASM_ARM_`basename "$out" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ + -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` + +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | tail -n1 | ( + echo "#ifndef ${fileguard} +#define ${fileguard} 1 + +/* + * This needs to be greater than __NR_last_syscall+1 in order to account + * for the padding in the syscall table. + */ +" + + while read nr abi name entry; do + nr=$(($nr + 1)) + while [ "$(($nr / (256 * $align) ))" -gt 0 ]; do + align=$(( $align * 4 )) + done + nr=$(( ($nr + $align - 1) & ~($align - 1) )) + echo "/* aligned to $align */" + echo "#define __NR_syscalls $nr" + done + + echo "" + echo "#endif /* ${fileguard} */" +) > "$out" |