3 # Update syscall_nr.h files from linux headers asm-generic/unistd.h
5 # This code is licensed under the GPL version 2 or later. See
6 # the COPYING file in the top-level directory.
14 if [ "$linux" = "" ] ; then
15 echo "Needs path to linux source tree" 1>&2
19 if [ "$output" = "" ] ; then
25 echo "$1" | tr "[:lower:]" "[:upper:]" | tr "[:punct:]" "_"
45 cpp -P -nostdinc -fdirectives-only \
46 -D_UAPI_ASM_$(upper ${arch})_BITSPERLONG_H \
47 -D__ASM_$(upper ${arch})_BITSPERLONG_H \
48 -D__BITS_PER_LONG=${bits} \
49 -I${linux}/arch/${arch}/include/uapi/ \
50 -I${linux}/include/uapi \
52 "${linux}/arch/${arch}/include/uapi/asm/unistd.h"
57 grep -e "#define __NR_" -e "#define __NR3264"
62 sed "s/ __NR_/ TARGET_NR_/g;s/(__NR_/(TARGET_NR_/g"
67 sed "s/#define TARGET_NR_/QEMU TARGET_NR_/" | \
69 sed "s/^QEMU /#define /"
77 guard="$(upper LINUX_USER_$(qemu_arch $arch)_$(basename "$file"))"
80 echo " * This file contains the system call numbers."
81 echo " * Do not modify."
82 echo " * This file is generated by scripts/gensyscalls.sh"
84 echo "#ifndef ${guard}"
85 echo "#define ${guard}"
87 read_includes $arch $bits | filter_defines | rename_defines | \
88 evaluate_values | sort -n -k 3
90 echo "#endif /* ${guard} */") > "$file"
94 > "$TMP/asm/bitsperlong.h"
96 generate_syscall_nr arm64 64 "$output/linux-user/aarch64/syscall_nr.h"
97 generate_syscall_nr nios2 32 "$output/linux-user/nios2/syscall_nr.h"
98 generate_syscall_nr openrisc 32 "$output/linux-user/openrisc/syscall_nr.h"
100 generate_syscall_nr riscv 32 "$output/linux-user/riscv/syscall32_nr.h"
101 generate_syscall_nr riscv 64 "$output/linux-user/riscv/syscall64_nr.h"
102 generate_syscall_nr hexagon 32 "$output/linux-user/hexagon/syscall_nr.h"
103 generate_syscall_nr loongarch 64 "$output/linux-user/loongarch64/syscall_nr.h"