aboutsummaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2020-05-21linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32Peter Maydell1-6/+0
The Arm signal-handling code has some parts ifdeffed with a TARGET_CONFIG_CPU_32, which is always defined. This is a leftover from when this code's structure was based on the Linux kernel signal handling code, where it was intended to support 26-bit Arm CPUs. The kernel dropped its CONFIG_CPU_32 in kernel commit 4da8b8208eded0ba21e3 in 2009. QEMU has never had 26-bit CPU support and is unlikely to ever add it; we certainly aren't going to support 26-bit Linux binaries via linux-user mode. The ifdef is just unhelpful noise, so remove it entirely. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200518143014.20689-1-peter.maydell@linaro.org
2020-05-21linux-user/arm: Reset CPSR_E when entering a signal handlerAmanieu d'Antras1-1/+7
This fixes signal handlers running with the wrong endianness if the interrupted code used SETEND to dynamically switch endianness. Signed-off-by: Amanieu d'Antras <amanieu@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20200511131117.2486486-1-amanieu@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-05-21target/arm: Allow user-mode code to write CPSR.E via MSRPeter Maydell1-0/+1
Using the MSR instruction to write to CPSR.E is deprecated, but it is required to work from any mode including unprivileged code. We were incorrectly forbidding usermode code from writing it because CPSR_USER did not include the CPSR_E bit. We use CPSR_USER in only three places: * as the mask of what to allow userspace MSR to write to CPSR * when deciding what bits a linux-user signal-return should be able to write from the sigcontext structure * in target_user_copy_regs() when we set up the initial registers for the linux-user process In the first two cases not being able to update CPSR.E is a bug, and in the third case it doesn't matter because CPSR.E is always 0 there. So we can fix both bugs by adding CPSR_E to CPSR_USER. Because the cpsr_write() in restore_sigcontext() is now changing a CPSR bit which is cached in hflags, we need to add an arm_rebuild_hflags() call there; the callsite in target_user_copy_regs() was already rebuilding hflags for other reasons. (The recommended way to change CPSR.E is to use the 'SETEND' instruction, which we do correctly allow from usermode code.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200518142801.20503-1-peter.maydell@linaro.org
2020-05-21linux-user/arm: Fix identification of syscall numbersPeter Maydell1-66/+77
Our code to identify syscall numbers has some issues: * for Thumb mode, we never need the immediate value from the insn, but we always read it anyway * bad immediate values in the svc insn should cause a SIGILL, but we were abort()ing instead (via "goto error") We can fix both these things by refactoring the code that identifies the syscall number to more closely follow the kernel COMPAT_OABI code: * for Thumb it is always r7 * for Arm, if the immediate value is 0, then this is an EABI call with the syscall number in r7 * otherwise, we XOR the immediate value with 0x900000 (ARM_SYSCALL_BASE for QEMU; __NR_OABI_SYSCALL_BASE in the kernel), which converts valid syscall immediates into the desired value, and puts all invalid immediates in the range 0x100000 or above * then we can just let the existing "value too large, deliver SIGILL" case handle invalid numbers, and drop the 'goto error' Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-id: 20200420212206.12776-5-peter.maydell@linaro.org
2020-05-21linux-user/arm: Handle invalid arm-specific syscalls correctlyPeter Maydell1-4/+26
The kernel has different handling for syscalls with invalid numbers that are in the "arm-specific" range 0x9f0000 and up: * 0x9f0000..0x9f07ff return -ENOSYS if not implemented * other out of range syscalls cause a SIGILL (see the kernel's arch/arm/kernel/traps.c:arm_syscall()) Implement this distinction. (Note that our code doesn't look quite like the kernel's, because we have removed the 0x900000 prefix by this point, whereas the kernel retains it in arm_syscall().) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20200420212206.12776-4-peter.maydell@linaro.org
2020-05-21linux-user/arm: Remove bogus SVC 0xf0002 handlingPeter Maydell1-3/+1
We incorrectly treat SVC 0xf0002 as a cacheflush request (which is a NOP for QEMU). This is the wrong syscall number, because in the svc-immediate OABI syscall numbers are all offset by the ARM_SYSCALL_BASE value and so the correct insn is SVC 0x9f0002. (This is handled further down in the code with the other Arm-specific syscalls like NR_breakpoint.) When this code was initially added in commit 6f1f31c069b20611 in 2004, ARM_NR_cacheflush was defined as (ARM_SYSCALL_BASE + 0xf0000 + 2) so the value in the comparison took account of the extra 0x900000 offset. In commit fbb4a2e371f2fa7 in 2008, the ARM_SYSCALL_BASE was removed from the definition of ARM_NR_cacheflush and handling for this group of syscalls was added below the point where we subtract ARM_SYSCALL_BASE from the SVC immediate value. However that commit forgot to remove the now-obsolete earlier handling code. Remove the spurious ARM_NR_cacheflush condition. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-id: 20200420212206.12776-3-peter.maydell@linaro.org
2020-05-21linux-user/arm: BKPT should cause SIGTRAP, not be a syscallPeter Maydell1-22/+8
In linux-user/arm/cpu-loop.c we incorrectly treat EXCP_BKPT similarly to EXCP_SWI, which means that if the guest executes a BKPT insn then QEMU will perform a syscall for it (which syscall depends on what value happens to be in r7...). The correct behaviour is that the guest process should take a SIGTRAP. This code has been like this (more or less) since commit 06c949e62a098f in 2006 which added BKPT in the first place. This is probably because at the time the same code path was used to handle both Linux syscalls and semihosting calls, and (on M profile) BKPT with a suitable magic number is used for semihosting calls. But these days we've moved handling of semihosting out to an entirely different codepath, so we can fix this bug by simply removing this handling of EXCP_BKPT and instead making it deliver a SIGTRAP like EXCP_DEBUG (as we do already on aarch64). Reported-by: <omerg681@gmail.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20200420212206.12776-2-peter.maydell@linaro.org Fixes: https://bugs.launchpad.net/qemu/+bug/1873898 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-05-15exec/cpu-all: Use bool for have_guest_baseRichard Henderson1-2/+2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200513175134.19619-6-alex.bennee@linaro.org>
2020-05-15linux-user: completely re-write init_guest_spaceAlex Bennée4-286/+277
First we ensure all guest space initialisation logic comes through probe_guest_base once we understand the nature of the binary we are loading. The convoluted init_guest_space routine is removed and replaced with a number of pgb_* helpers which are called depending on what requirements we have when loading the binary. We first try to do what is requested by the host. Failing that we try and satisfy the guest requested base address. If all those options fail we fall back to finding a space in the memory map using our recently written read_self_maps() helper. There are some additional complications we try and take into account when looking for holes in the address space. We try not to go directly after the system brk() space so there is space for a little growth. We also don't want to have to use negative offsets which would result in slightly less efficient code on x86 when it's unable to use the segment offset register. Less mind-binding gotos and hopefully clearer logic throughout. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200513175134.19619-5-alex.bennee@linaro.org>
2020-05-06gdbstub/linux-user: support debugging over a unix socketAlex Bennée1-6/+6
While debugging over TCP is fairly straightforward now we have test cases that want to orchestrate via make and currently a parallel build fails as two processes can't use the same listening port. While system emulation offers a wide cornucopia of connection methods thanks to the chardev abstraction we are a little more limited for linux user. Thankfully the programming API for a TCP socket and a local UNIX socket is pretty much the same once it's set up. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200430190122.4592-7-alex.bennee@linaro.org>
2020-04-29linux-user/riscv: fix up struct target_ucontext definitionLIU Zhiwei1-1/+2
As struct target_ucontext will be transfered to signal handler, it must keep pace with struct ucontext_t defined in Linux kernel. Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 20200412020830.607-1-zhiwei_liu@c-sky.com Message-Id: <20200412020830.607-1-zhiwei_liu@c-sky.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-04-20Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-5.0-20200417' ↵Peter Maydell1-40/+29
into staging ppc patch queue for 2020-04-17 Here are a few late bugfixes for qemu-5.0 in the ppc target code. Unless some really nasty last minute bug shows up, I expect this to be the last ppc pull request for qemu-5.0. # gpg: Signature made Fri 17 Apr 2020 06:02:13 BST # gpg: using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392 # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full] # gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full] # gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full] # gpg: aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown] # Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392 * remotes/dgibson/tags/ppc-for-5.0-20200417: target/ppc: Fix mtmsr(d) L=1 variant that loses interrupts target/ppc: Fix wrong interpretation of the disposition flag. linux-user/ppc: Fix padding in mcontext_t for ppc64 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-04-17linux-user/ppc: Fix padding in mcontext_t for ppc64Richard Henderson1-40/+29
The padding that was added in 95cda4c44ee was added to a union, and so it had no effect. This fixes misalignment errors detected by clang sanitizers for ppc64 and ppc64le. In addition, only ppc64 allocates space for VSX registers, so do not save them for ppc32. The kernel only has references to CONFIG_SPE in signal_32.c, so do not attempt to save them for ppc64. Fixes: 95cda4c44ee Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200407032105.26711-1-richard.henderson@linaro.org> Acked-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-04-16linux-user/syscall.c: add target-to-host mapping for epoll_create1()Sergei Trofimovich1-1/+1
Noticed by Barnabás Virágh as a python-3.7 failue on qemu-alpha. The bug shows up on alpha as it's one of the targets where EPOLL_CLOEXEC differs from other targets: sysdeps/unix/sysv/linux/alpha/bits/epoll.h: EPOLL_CLOEXEC = 01000000 sysdeps/unix/sysv/linux/bits/epoll.h: EPOLL_CLOEXEC = 02000000 Bug: https://bugs.gentoo.org/717548 Reported-by: Barnabás Virágh Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> CC: Riku Voipio <riku.voipio@iki.fi> CC: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200415220508.5044-1-slyfox@gentoo.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-04-15linux-user: fix /proc/self/stat handlingAlex Bennée1-24/+19
In the original bug report long files names in Guix caused /proc/self/stat be truncated without the trailing ") " as specified in proc manpage which says: (2) comm %s The filename of the executable, in parentheses. This is visible whether or not the executable is swapped out. In the kernel this is currently done by do_task_stat calling proc_task_name() which uses a structure limited by TASK_COMM_LEN (16). Additionally it should only be reporting the executable name rather than the full path. Fix both these failings while cleaning up the code to use GString to build up the reported values. As the whole function is cleaned up also adjust the white space to the current coding style. Message-ID: <fb4c55fa-d539-67ee-c6c9-de8fb63c8488@inria.fr> Reported-by: Brice Goglin <Brice.Goglin@inria.fr> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200414200631.12799-10-alex.bennee@linaro.org>
2020-04-14linux-user/flatload.c: Use "" for include of QEMU header target_flat.hPeter Maydell1-1/+1
The target_flat.h file is a QEMU header, so we should include it using quotes, not angle brackets. Coverity otherwise is unable to find the header: "../linux-user/flatload.c", line 40: error #1712: cannot open source file "target_flat.h" #include <target_flat.h> ^ because the relevant directory is only on the -iquote path, not the -I path. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200319193323.2038-5-peter.maydell@linaro.org
2020-04-07linux-user: clean-up padding on /proc/self/mapsAlex Bennée1-13/+19
Don't use magic spaces, calculate the justification for the file field like the kernel does with seq_pad. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200403191150.863-10-alex.bennee@linaro.org>
2020-04-07linux-user: factor out reading of /proc/self/mapsAlex Bennée1-30/+28
Unfortunately reading /proc/self/maps is still considered the gold standard for a process finding out about it's own memory layout. As we will want this data in other contexts soon factor out the code to read and parse the data. Rather than just blindly copying the existing sscanf based code we use a more modern glib version of the parsing code to make a more general purpose map structure. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200403191150.863-9-alex.bennee@linaro.org>
2020-04-07linux-user: more debug for init_guest_spaceAlex Bennée1-1/+7
Searching for memory space can cause problems so lets extend the CPU_LOG_PAGE output so you can watch init_guest_space fail to allocate memory. A more involved fix is actually required to make this function play nicely with the large guard pages the sanitiser likes to use. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200403191150.863-5-alex.bennee@linaro.org>
2020-04-07linux-user: protect fcntl64 with an #ifdefAlex Bennée1-4/+4
Checking TARGET_ABI_BITS is sketchy - we should check for the presence of the define to be sure. Also clean up the white space while we are there. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200403191150.863-3-alex.bennee@linaro.org>
2020-03-30linux-user: Support futex_time64Alistair Francis1-14/+126
Add support for host and target futex_time64. If futex_time64 exists on the host we try that first before falling back to the standard futex syscall. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <d9390e368a9a1fd32d52aa771815e6e3d40cb1d4.1584571250.git.alistair.francis@wdc.com> [lv: define sys_futex() if __NR_futex is defined (fix bug on 32bit host), remove duplicate get_errno()] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-26linux-user: Flush out implementation of gettimeofdayRichard Henderson1-2/+27
The first argument, timeval, is allowed to be NULL. The second argument, timezone, was missing. While its use is deprecated, it is still present in the syscall. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200213032223.14643-6-richard.henderson@linaro.org> [lv: add "#if defined(TARGET_NR_gettimeofday)"] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-26linux-user: Add x86_64 vsyscall page to /proc/self/mapsRichard Henderson1-0/+10
The page isn't (necessarily) present in the host /proc/self/maps, and even if it might be it isn't present in page_flags, and even if it was it might not have the same set of page permissions. The easiest thing to do, particularly when it comes to the "[vsyscall]" note at the end of line, is to special case it. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200213032223.14643-5-richard.henderson@linaro.org> [lv: remove trailing space] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-26linux-user/i386: Emulate x86_64 vsyscallsRichard Henderson1-0/+108
Notice the magic page during translate, much like we already do for the arm32 commpage. At runtime, raise an exception to return cpu_loop for emulation. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200213032223.14643-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-26linux-user/i386: Split out gen_signalRichard Henderson1-60/+33
This is a bit tidier than open-coding the 5 lines necessary to initialize the target_siginfo_t. In addition, this zeros the remaining bytes of the target_siginfo_t, rather than passing in garbage. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200213032223.14643-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-24target/ppc: don't byte swap ELFv2 signal handlerVincent Fazio1-4/+2
Previously, the signal handler would be byte swapped if the target and host CPU used different endianness. This would cause a SIGSEGV when attempting to translate the opcode pointed to by the swapped address. Thread 1 "qemu-ppc64" received signal SIGSEGV, Segmentation fault. 0x00000000600a9257 in ldl_he_p (ptr=0x4c2c061000000000) at qemu/include/qemu/bswap.h:351 351 __builtin_memcpy(&r, ptr, sizeof(r)); #0 0x00000000600a9257 in ldl_he_p (ptr=0x4c2c061000000000) at qemu/include/qemu/bswap.h:351 #1 0x00000000600a92fe in ldl_be_p (ptr=0x4c2c061000000000) at qemu/include/qemu/bswap.h:449 #2 0x00000000600c0790 in translator_ldl_swap at qemu/include/exec/translator.h:201 #3 0x000000006011c1ab in ppc_tr_translate_insn at qemu/target/ppc/translate.c:7856 #4 0x000000006005ae70 in translator_loop at qemu/accel/tcg/translator.c:102 The signal handler will be byte swapped as a result of the __get_user() call in sigaction() if it is necessary, no additional swap is required. Signed-off-by: Vincent Fazio <vfazio@gmail.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200319133244.8818-1-vfazio@xes-inc.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-20linux-user, openrisc: sync syscall numbers with kernel v5.5Laurent Vivier1-247/+62
Use helper script scripts/gensyscalls.sh to generate the file. Add TARGET_NR_or1k_atomic Remove useless comments and blank lines. Define diretly the __NR_XXX64 syscalls rather than using the intermediate __NR3264 definition. Remove wrong cut'n'paste (like "#ifdef __ARCH_WANT_SYNC_FILE_RANGE2") Add new syscalls from 286 (preadv) to 434 (pidfd_open). Remove obsolete syscalls 1204 (open) to 1079 (fork). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200316085620.309769-5-laurent@vivier.eu>
2020-03-20linux-user, nios2: sync syscall numbers with kernel v5.5Laurent Vivier1-330/+320
Use helper script scripts/gensyscalls.sh to generate the file. This adds TARGET_NR_llseek that was missing and remove syscalls 1024 to 1079. Add new syscalls from 288 (pkey_mprotect) to 434 (pidfd_open) Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20200316085620.309769-4-laurent@vivier.eu>
2020-03-20linux-user, aarch64: sync syscall numbers with kernel v5.5Laurent Vivier1-5/+29
Use helper script scripts/gensyscalls.sh to generate the file. This change TARGET_NR_fstatat64 by TARGET_NR_newfstatat that is correct because definitions from linux are: arch/arm64/include/uapi/asm/unistd.h #define __ARCH_WANT_NEW_STAT include/uapi/asm-generic/unistd.h #if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64) #define __NR3264_fstatat 79 __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat) #define __NR3264_fstat 80 __SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat) #endif ... #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT) ... #if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64) #define __NR_newfstatat __NR3264_fstatat #define __NR_fstat __NR3264_fstat #endif ... Add syscalls 286 (preadv2) to 435 (clone3). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200316085620.309769-3-laurent@vivier.eu>
2020-03-20linux-user,mips: update syscall-args-o32.c.incLaurent Vivier1-438/+436
Add a script to update the file from strace github and run it Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-22-laurent@vivier.eu> [lv: added file in MAINTAINERS] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user,mips: move content of mips_syscall_argsLaurent Vivier2-439/+439
Move content of mips_syscall_args to mips-syscall-args-o32.c.inc to ease automatic update. No functionnal change Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-21-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user: update syscall.tbl from linux 0bf999f9c5e7Laurent Vivier15-1/+31
Run scripts/update-syscalltbl.sh with linux commit 0bf999f9c5e7 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-20-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, mips64: add syscall table generation supportLaurent Vivier6-725/+774
Copy syscall_n32.tbl, syscall_n64.tbl and syscallhdr.sh from linux/arch/parisc/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Move the offsets (6000 for n32 and 5000 for n64) from the file to the Makefile.objs to be passed to syscallhdr.sh Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-18-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, mips: add syscall table generation supportLaurent Vivier5-425/+467
Copy syscall.tbl and syscallhdr.sh from linux/arch/mips/kernel/syscalls/syscall_o32.tbl v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Move the offset (4000) from the file to the Makefile.objs to be passed to syscallhdr.sh Rename on the fly fadvise64 to fadvise64_64. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-17-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, x86_64: add syscall table generation supportLaurent Vivier5-356/+436
Copy syscall_64.tbl and syscallhdr.sh from linux/arch/x86/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-16-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, i386: add syscall table generation supportLaurent Vivier5-387/+476
Copy syscall_32.tbl and syscallhdr.sh from linux/arch/x86/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-15-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, x86_64, i386: cleanup TARGET_NR_arch_prctlLaurent Vivier2-10/+13
Define do_arch_prctl() for i386 and x86_64, but return -TARGET_ENOSYS for i386. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-14-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, sparc, sparc64: add syscall table generation supportLaurent Vivier9-729/+1042
Copy syscall.tbl and syscallhdr.sh from linux/arch/sparc/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-13-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, s390x: add syscall table generation supportLaurent Vivier5-331/+478
Copy syscall.tbl from linux/arch/s390x/kernel/syscalls v5.5 Copy syscallhdr.sh from m68k. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-12-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, s390x: remove syscall definitions for !TARGET_S390XLaurent Vivier1-190/+123
We don't support other 32bit architecture. Update file to comply with coding style (TAB). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-11-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, ppc: add syscall table generation supportLaurent Vivier6-403/+562
Copy syscall.tbl and syscallhdr.sh from linux/arch/ppc/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h and to not generate the entry if entry point is sys_ni_syscall. Fix ppc/signal.c to define do_sigreturn() for TARGET_ABI32. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-10-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, arm: add syscall table generation supportLaurent Vivier6-449/+497
Copy syscall.tbl and syscallhdr.sh from linux/arch/arm/tools/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Update syscall.c to manage TARGET_NR_arm_sync_file_range as it has replaced TARGET_NR_sync_file_range2 Move existing stuff from linux-user/Makefile.objs to linux-user/arm/Makefile.objs Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200310103403.3284090-9-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, microblaze: add syscall table generation supportLaurent Vivier5-442/+481
Copy syscall.tbl and syscallhdr.sh from linux/arch/microblaze/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-8-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, sh4: add syscall table generation supportLaurent Vivier5-441/+478
Copy syscall.tbl and syscallhdr.sh from linux/arch/sh/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-7-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, xtensa: add syscall table generation supportLaurent Vivier5-469/+446
Copy syscall.tbl and syscallhdr.sh from linux/arch/xtensa/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-6-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, m68k: add syscall table generation supportLaurent Vivier5-434/+475
Copy syscall.tbl and syscallhdr.sh from linux/arch/m68k/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-5-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, hppa: add syscall table generation supportLaurent Vivier5-358/+473
Copy syscall.tbl and syscallhdr.sh from linux/arch/parisc/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200310103403.3284090-4-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user, alpha: add syscall table generation supportLaurent Vivier5-492/+518
Copy syscall.tbl and syscallhdr.sh from linux/arch/alpha/kernel/syscalls v5.5 Update syscallhdr.sh to generate QEMU syscall_nr.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20200310103403.3284090-3-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user/riscv: Update the syscall_nr's to the 5.5 kernelAlistair Francis4-293/+599
Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <8e512fa2dc885aafc4d9c4013ee033442827a4a0.1584051142.git.alistair.francis@wdc.com> [lv: guard sys_futex with TARGET_NR_exit] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-03-20linux-user/syscall: Add support for clock_gettime64/clock_settime64Alistair Francis1-0/+39
Add support for the clock_gettime64/clock_settime64 syscalls. If your host is 64-bit or is 32-bit with the *_time64 syscall then the timespec will correctly be a 64-bit time_t. Otherwise the host will return a 32-bit time_t which will be rounded to 64-bits. This will be incorrect after y2038. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <4a7fd05532400d10aa0f684c9043e2ac7b34d91c.1584051142.git.alistair.francis@wdc.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>