mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
linux-user,loongarch: move to syscalltbl file
Since kernel v6.11 loongarch has moved from syscall_nr.h file to syscall.tbl (26a3b85bac08 ("loongarch: convert to generic syscall table")) Update linux-user scripts to be able to retrieve syscall numbers from linux syscall.tbl instead of syscall_nr.h. New syscall.tbl is imported from linux v6.11 using updated scripts/update-syscalltbl.sh Remove scripts/gensyscalls.sh that is now useless. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-ID: <20240920151034.859533-6-laurent@vivier.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
e7e6cc5021
commit
c52e405968
8 changed files with 444 additions and 427 deletions
|
@ -1,97 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Update syscall_nr.h files from linux headers asm-generic/unistd.h
|
||||
#
|
||||
# This code is licensed under the GPL version 2 or later. See
|
||||
# the COPYING file in the top-level directory.
|
||||
#
|
||||
|
||||
linux="$1"
|
||||
output="$2"
|
||||
|
||||
TMP=$(mktemp -d)
|
||||
|
||||
if [ "$linux" = "" ] ; then
|
||||
echo "Needs path to linux source tree" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$output" = "" ] ; then
|
||||
output="$PWD"
|
||||
fi
|
||||
|
||||
upper()
|
||||
{
|
||||
echo "$1" | tr "[:lower:]" "[:upper:]" | tr "[:punct:]" "_"
|
||||
}
|
||||
|
||||
qemu_arch()
|
||||
{
|
||||
case "$1" in
|
||||
arm64)
|
||||
echo "aarch64"
|
||||
;;
|
||||
*)
|
||||
echo "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
read_includes()
|
||||
{
|
||||
arch=$1
|
||||
bits=$2
|
||||
|
||||
cpp -P -nostdinc -fdirectives-only \
|
||||
-D_UAPI_ASM_$(upper ${arch})_BITSPERLONG_H \
|
||||
-D__ASM_$(upper ${arch})_BITSPERLONG_H \
|
||||
-D__BITS_PER_LONG=${bits} \
|
||||
-I${linux}/arch/${arch}/include/uapi/ \
|
||||
-I${linux}/include/uapi \
|
||||
-I${TMP} \
|
||||
"${linux}/arch/${arch}/include/uapi/asm/unistd.h"
|
||||
}
|
||||
|
||||
filter_defines()
|
||||
{
|
||||
grep -e "#define __NR_" -e "#define __NR3264"
|
||||
}
|
||||
|
||||
rename_defines()
|
||||
{
|
||||
sed "s/ __NR_/ TARGET_NR_/g;s/(__NR_/(TARGET_NR_/g"
|
||||
}
|
||||
|
||||
evaluate_values()
|
||||
{
|
||||
sed "s/#define TARGET_NR_/QEMU TARGET_NR_/" | \
|
||||
cpp -P -nostdinc | \
|
||||
sed "s/^QEMU /#define /"
|
||||
}
|
||||
|
||||
generate_syscall_nr()
|
||||
{
|
||||
arch=$1
|
||||
bits=$2
|
||||
file="$3"
|
||||
guard="$(upper LINUX_USER_$(qemu_arch $arch)_$(basename "$file"))"
|
||||
|
||||
(echo "/*"
|
||||
echo " * This file contains the system call numbers."
|
||||
echo " * Do not modify."
|
||||
echo " * This file is generated by scripts/gensyscalls.sh"
|
||||
echo " */"
|
||||
echo "#ifndef ${guard}"
|
||||
echo "#define ${guard}"
|
||||
echo
|
||||
read_includes $arch $bits | filter_defines | rename_defines | \
|
||||
evaluate_values | sort -n -k 3
|
||||
echo
|
||||
echo "#endif /* ${guard} */") > "$file"
|
||||
}
|
||||
|
||||
mkdir "$TMP/asm"
|
||||
> "$TMP/asm/bitsperlong.h"
|
||||
|
||||
generate_syscall_nr loongarch 64 "$output/linux-user/loongarch64/syscall_nr.h"
|
||||
rm -fr "$TMP"
|
|
@ -3,6 +3,7 @@ arch/alpha/kernel/syscalls/syscall.tbl,linux-user/alpha/syscall.tbl \
|
|||
arch/arm/tools/syscall.tbl,linux-user/arm/syscall.tbl \
|
||||
scripts/syscall.tbl,linux-user/aarch64/syscall_64.tbl \
|
||||
scripts/syscall.tbl,linux-user/hexagon/syscall.tbl \
|
||||
scripts/syscall.tbl,linux-user/loongarch64/syscall.tbl \
|
||||
arch/m68k/kernel/syscalls/syscall.tbl,linux-user/m68k/syscall.tbl \
|
||||
arch/microblaze/kernel/syscalls/syscall.tbl,linux-user/microblaze/syscall.tbl \
|
||||
arch/mips/kernel/syscalls/syscall_n32.tbl,linux-user/mips64/syscall_n32.tbl \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue