Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34 lines
843 B
Bash
34 lines
843 B
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
in="$1"
|
|
out="$2"
|
|
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:]]+" "$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"
|