update syscall numbers to linux 5.5 (with scripts)

add clock_gettime64/clock_settime64
 add AT_EXECFN
 
 v4: restore syscall.tbl series but remove vsyscall series
 v3: remove syscall.tbl series
 v2: guard copy_to_user_timezone() with TARGET_NR_gettimeofday
     remove "Support futex_time64" patch
     guard sys_futex with TARGET_NR_exit
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAl503/ESHGxhdXJlbnRA
 dml2aWVyLmV1AAoJEPMMOL0/L7480UAP/jLzW/ANfq2DN+xdJdTHtmgVvyp/8AGJ
 WNYqTKcs51qR20Ra6JlALko5/MS4oQsZEMUItIr6idCzruUWBuVUE8sc78XXPoGE
 qGbNsNlD9dbcBkKFc9HRlZG+bbXeHgwRcmn0trmTIf7jaJ1e/R0XHaYNjhwAp+1e
 a5uQfuCbtYzZuFvho8ZtWMR8Y2L60rz/zKYLSGovgu6+udQSdTBS/n+WkDnjemkI
 5v3ZAjilG88B1FwQrDeZbQbeJrA1j5AihSEziwspICgsR5kGyEx3/UgFe30l7qNE
 OpUQhhg8rLcI6IWMTJoosYaYYQZvOV96mDYOliXqkfhiKqzUk4H5f56W/Xt1QaEU
 fq+5SUovpNB1KnmB0WAvitePL6jG+L+w11Yz8lBSgNIOe4SulL6oQh/I/vqpMvHT
 YONE/bldHCgeIV5mpb8p3r3Xt/8xF21I80G+Ub3wYK848AsyHGJftsZxZSB+BKgw
 eYQ6rXASAf+kXRf5ctsLgLsVo/1zvc0zJuz6BGXIrs2nZFOqFhudLOwN2Cbuakqj
 tet5MqKXgRRc4v2cEAFhlh9sF8MsnbWKKZGHwoHTnwe5dxJ1cEEQg95tg906txLV
 llzLladbwIIblzldi0X5SFFYfnVvOeCM4/JxgCk/IOTzljZY6rTsC6W02jYHBSuX
 x3BlAFDpJvZg
 =+8o+
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.0-pull-request' into staging

update syscall numbers to linux 5.5 (with scripts)
add clock_gettime64/clock_settime64
add AT_EXECFN

v4: restore syscall.tbl series but remove vsyscall series
v3: remove syscall.tbl series
v2: guard copy_to_user_timezone() with TARGET_NR_gettimeofday
    remove "Support futex_time64" patch
    guard sys_futex with TARGET_NR_exit

# gpg: Signature made Fri 20 Mar 2020 15:23:29 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-5.0-pull-request: (32 commits)
  linux-user, openrisc: sync syscall numbers with kernel v5.5
  linux-user, nios2: sync syscall numbers with kernel v5.5
  linux-user, aarch64: sync syscall numbers with kernel v5.5
  scripts: add a script to generate syscall_nr.h
  linux-user,mips: update syscall-args-o32.c.inc
  linux-user,mips: move content of mips_syscall_args
  linux-user: update syscall.tbl from linux 0bf999f9c5e7
  linux-user, scripts: add a script to update syscall.tbl
  linux-user, mips64: add syscall table generation support
  linux-user, mips: add syscall table generation support
  linux-user, x86_64: add syscall table generation support
  linux-user, i386: add syscall table generation support
  linux-user, x86_64, i386: cleanup TARGET_NR_arch_prctl
  linux-user, sparc, sparc64: add syscall table generation support
  linux-user, s390x: add syscall table generation support
  linux-user, s390x: remove syscall definitions for !TARGET_S390X
  linux-user, ppc: add syscall table generation support
  linux-user, arm: add syscall table generation support
  linux-user, microblaze: add syscall table generation support
  linux-user, sh4: add syscall table generation support
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-03-20 16:00:21 +00:00
commit 52a96afaa2
82 changed files with 9464 additions and 7837 deletions

102
scripts/gensyscalls.sh Executable file
View file

@ -0,0 +1,102 @@
#!/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__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} */"
echo) > "$file"
}
mkdir "$TMP/asm"
> "$TMP/asm/bitsperlong.h"
generate_syscall_nr arm64 64 "$output/linux-user/aarch64/syscall_nr.h"
generate_syscall_nr nios2 32 "$output/linux-user/nios2/syscall_nr.h"
generate_syscall_nr openrisc 32 "$output/linux-user/openrisc/syscall_nr.h"
generate_syscall_nr riscv 32 "$output/linux-user/riscv/syscall32_nr.h"
generate_syscall_nr riscv 64 "$output/linux-user/riscv/syscall64_nr.h"
rm -fr "$TMP"

View file

@ -0,0 +1,57 @@
#!/bin/sh
URL=https://raw.githubusercontent.com/strace/strace/master
FILES="sysent.h sysent_shorthand_defs.h linux/mips/syscallent-compat.h \
linux/mips/syscallent-o32.h linux/syscallent-common-32.h \
linux/syscallent-common.h"
output="$1"
if [ "$output" = "" ] ; then
output="$PWD"
fi
INC=linux-user/mips/syscall-args-o32.c.inc
TMP=$(mktemp -d)
cd $TMP
for file in $FILES; do
curl -O $URL/$file
done
> subcall32.h
cat > gen_mips_o32.c <<EOF
#include <stdio.h>
#define LINUX_MIPSO32
#define MAX_ARGS 7
#include "sysent.h"
#include "sysent_shorthand_defs.h"
#define SEN(syscall_name) 0,0
const struct_sysent sysent0[] = {
#include "syscallent-o32.h"
};
int main(void)
{
int i;
for (i = 4000; i < sizeof(sysent0) / sizeof(struct_sysent); i++) {
if (sysent0[i].sys_name == NULL) {
printf(" [% 4d] = MIPS_SYSCALL_NUMBER_UNUSED,\n", i - 4000);
} else {
printf(" [% 4d] = %d, /* %s */\n", i - 4000,
sysent0[i].nargs, sysent0[i].sys_name);
}
}
return 0;
}
EOF
cc -o gen_mips_o32 gen_mips_o32.c && ./gen_mips_o32 > "$output/$INC"
rm -fr "$TMP"

49
scripts/update-syscalltbl.sh Executable file
View file

@ -0,0 +1,49 @@
TBL_LIST="\
arch/alpha/kernel/syscalls/syscall.tbl,linux-user/alpha/syscall.tbl \
arch/arm/tools/syscall.tbl,linux-user/arm/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 \
arch/mips/kernel/syscalls/syscall_n64.tbl,linux-user/mips64/syscall_n64.tbl \
arch/mips/kernel/syscalls/syscall_o32.tbl,linux-user/mips/syscall_o32.tbl \
arch/parisc/kernel/syscalls/syscall.tbl,linux-user/hppa/syscall.tbl \
arch/powerpc/kernel/syscalls/syscall.tbl,linux-user/ppc/syscall.tbl \
arch/s390/kernel/syscalls/syscall.tbl,linux-user/s390x/syscall.tbl \
arch/sh/kernel/syscalls/syscall.tbl,linux-user/sh4/syscall.tbl \
arch/sparc/kernel/syscalls/syscall.tbl,linux-user/sparc64/syscall.tbl \
arch/sparc/kernel/syscalls/syscall.tbl,linux-user/sparc/syscall.tbl \
arch/x86/entry/syscalls/syscall_32.tbl,linux-user/i386/syscall_32.tbl \
arch/x86/entry/syscalls/syscall_64.tbl,linux-user/x86_64/syscall_64.tbl \
arch/xtensa/kernel/syscalls/syscall.tbl,linux-user/xtensa/syscall.tbl\
"
linux="$1"
output="$2"
if [ -z "$linux" ] || ! [ -d "$linux" ]; then
cat << EOF
usage: update-syscalltbl.sh LINUX_PATH [OUTPUT_PATH]
LINUX_PATH Linux kernel directory to obtain the syscall.tbl from
OUTPUT_PATH output directory, usually the qemu source tree (default: $PWD)
EOF
exit 1
fi
if [ -z "$output" ]; then
output="$PWD"
fi
for entry in $TBL_LIST; do
OFS="$IFS"
IFS=,
set $entry
src=$1
dst=$2
IFS="$OFS"
if ! cp "$linux/$src" "$output/$dst" ; then
echo "Cannot copy $linux/$src to $output/$dst" 1>&2
exit 1
fi
done