Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0
0003 in="$1"
0004 out="$2"
0005 align=1
0006 
0007 fileguard=_ASM_ARM_`basename "$out" | sed \
0008     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
0009     -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
0010 
0011 grep -E "^[0-9A-Fa-fXx]+[[:space:]]+" "$in" | sort -n | tail -n1 | (
0012     echo "#ifndef ${fileguard}
0013 #define ${fileguard} 1
0014 
0015 /*
0016  * This needs to be greater than __NR_last_syscall+1 in order to account
0017  * for the padding in the syscall table.
0018  */
0019 "
0020 
0021     while read nr abi name entry; do
0022         nr=$(($nr + 1))
0023         while [ "$(($nr / (256 * $align) ))" -gt 0 ]; do
0024             align=$(( $align * 4 ))
0025         done
0026         nr=$(( ($nr + $align - 1) & ~($align - 1) ))
0027         echo "/* aligned to $align */"
0028         echo "#define __NR_syscalls $nr"
0029     done
0030 
0031     echo ""
0032     echo "#endif /* ${fileguard} */"
0033 ) > "$out"