]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/arm/tools/syscallnr.sh
Merge tag 'for-5.15/io_uring-2021-09-04' of git://git.kernel.dk/linux-block
[mirror_ubuntu-jammy-kernel.git] / arch / arm / tools / syscallnr.sh
CommitLineData
96a8fae0 1#!/bin/sh
b2441318 2# SPDX-License-Identifier: GPL-2.0
96a8fae0
RK
3in="$1"
4out="$2"
96a8fae0
RK
5align=1
6
7fileguard=_ASM_ARM_`basename "$out" | sed \
8 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
9 -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
10
b34b9820 11grep -E "^[0-9A-Fa-fXx]+[[:space:]]+" "$in" | sort -n | tail -n1 | (
96a8fae0
RK
12 echo "#ifndef ${fileguard}
13#define ${fileguard} 1
14
15/*
16 * This needs to be greater than __NR_last_syscall+1 in order to account
17 * for the padding in the syscall table.
18 */
19"
20
21 while read nr abi name entry; do
22 nr=$(($nr + 1))
23 while [ "$(($nr / (256 * $align) ))" -gt 0 ]; do
24 align=$(( $align * 4 ))
25 done
26 nr=$(( ($nr + $align - 1) & ~($align - 1) ))
27 echo "/* aligned to $align */"
28 echo "#define __NR_syscalls $nr"
29 done
30
31 echo ""
32 echo "#endif /* ${fileguard} */"
33) > "$out"