mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 11:58:21 +07:00
96a8fae0fe
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>
34 lines
853 B
Bash
34 lines
853 B
Bash
#!/bin/sh
|
|
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"
|