summaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)Author
2018-06-04linux-user: remove useless #ifLaurent Vivier
Remove a "#if defined(XX) || defined(YY) || ..." with all available targets Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-16-laurent@vivier.eu>
2018-06-04linux-user: move hppa signal definitions to hppa/target_signal.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-15-laurent@vivier.eu>
2018-06-04linux-user: move alpha signal definitions to alpha/target_signal.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-14-laurent@vivier.eu>
2018-06-04linux-user: move openrisc signal definitions to openrisc/target_signal.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-13-laurent@vivier.eu>
2018-06-04linux-user: move mips signal definitions to mips/target_signal.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-12-laurent@vivier.eu>
2018-06-04linux-user: move sparc signal definitions to sparc/target_signal.hLaurent Vivier
Remove sparc64/target_signal.h, use sparc/target_signal.h instead. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-11-laurent@vivier.eu>
2018-06-04linux-user: move generic signal definitions to generic/signal.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-10-laurent@vivier.eu>
2018-06-04linux-user: move get_sp_from_cpustate() to target_cpu.hLaurent Vivier
Remove useless includes Fix HPPA include guard. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Acked-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180529194207.31503-9-laurent@vivier.eu>
2018-06-04linux-user: move sparc/sparc64 fcntl definitions to sparc/target_fcntl.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-8-laurent@vivier.eu>
2018-06-04linux-user: move ppc fcntl definitions to ppc/target_fcntl.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-7-laurent@vivier.eu>
2018-06-04linux-user: move mips/mips64 fcntl definitions to mips/target_fcntl.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-6-laurent@vivier.eu>
2018-06-04linux-user: move arm/aarch64/m68k fcntl definitions to ↵Laurent Vivier
[arm|aarch64|m68k]/target_fcntl.h No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Acked-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180529194207.31503-5-laurent@vivier.eu>
2018-06-04linux-user: move hppa fcntl definitions to hppa/target_fcntl.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Acked-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180529194207.31503-4-laurent@vivier.eu>
2018-06-04linux-user: move alpha fcntl definitions to alpha/target_fcntl.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Acked-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180529194207.31503-3-laurent@vivier.eu>
2018-06-04linux-user: move generic fcntl definitions to generic/fcntl.hLaurent Vivier
add a per target target_fcntl.h and include the generic one from them No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180529194207.31503-2-laurent@vivier.eu>
2018-06-04syscall: replace strcpy() by g_strlcpy()Philippe Mathieu-Daudé
linux-user/syscall.c:9860:17: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy (buf->machine, cpu_to_uname_machine(cpu_env)); ^~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170724182751.18261-32-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-05-29target-microblaze: Make special registers 64-bitEdgar E. Iglesias
Extend special registers to 64-bits. This is in preparation for MFSE/MTSE, moves to and from extended special registers. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
2018-05-25linux-user: define TARGET_SO_REUSEPORTLaurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180519092956.15134-9-laurent@vivier.eu>
2018-05-25linux-user: copy sparc/sockbits.h definitions from linuxLaurent Vivier
Values defined for sparc are not correct. Copy the content of "arch/sparc/include/uapi/asm/socket.h" to fix them. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180519092956.15134-8-laurent@vivier.eu>
2018-05-25linux-user: update ARCH_HAS_SOCKET_TYPES useLaurent Vivier
to be like in the kernel and rename it TARGET_ARCH_HAS_SOCKET_TYPES Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180519092956.15134-7-laurent@vivier.eu>
2018-05-25linux-user: move ppc socket.h definitions to ppc/sockbits.hLaurent Vivier
Change conditional #ifdef part by #undef of the symbols redefined for PPC relative to generic/socket.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180519092956.15134-6-laurent@vivier.eu>
2018-05-25linux-user: move socket.h generic definitions to generic/sockbits.hLaurent Vivier
and include the file from architectures without specific definitions Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180519092956.15134-5-laurent@vivier.eu>
2018-05-25linux-user: move sparc/sparc64 socket.h definitions to sparc/sockbits.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180519092956.15134-4-laurent@vivier.eu>
2018-05-25linux-user: move alpha socket.h definitions to alpha/sockbits.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180519092956.15134-3-laurent@vivier.eu>
2018-05-25linux-user: move mips socket.h definitions to mips/sockbits.hLaurent Vivier
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180519092956.15134-2-laurent@vivier.eu>
2018-05-25linux-user: Fix payload size logic in host_to_target_cmsg()Peter Maydell
Coverity points out that there's a missing break in the switch in host_to_target_cmsg() where we update tgt_len for cmsg_level/cmsg_type combinations which require a different length for host and target (CID 1385425). To avoid duplicating the default case (target length same as host) in both switches, set that before the switch so that only the cases which want to override it need any code. This fixes a bug where we would have used the wrong length for SOL_SOCKET/SO_TIMESTAMP messages where the target and host have differently sized 'struct timeval' (ie one is 32 bit and the other is 64 bit). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180518184715.29833-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-05-25linux-user: update comments to point to tcg_exec_init()Igor Mammedov
cpu_init() was replaced by cpu_create() since 2.12 but comments weren't updated. So update stale comments to point that page sizes arei actually initialized by tcg_exec_init(). Also move another qemu_host_page_size related comment before tcg_exec_init() where it belongs. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1526557877-293151-1-git-send-email-imammedo@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-05-25linux-user: update netlink emulationLaurent Vivier
Update enums with entries from linux 4.17 Translate entries that generate logs with iproute2 4.9.0 and host kernel 4.15: # ip address show Unknown host QEMU_IFLA type: 43 Unknown host QEMU_IFLA type: 43 Unknown host QEMU_IFLA type: 43 Unknown QEMU_IFLA_BR type 41 Unknown QEMU_IFLA_BR type 42 Unknown QEMU_IFLA_BR type 43 Unknown QEMU_IFLA_BR type 44 Unknown host QEMU_IFLA type: 43 Unknown QEMU_IFLA_BR type 41 Unknown QEMU_IFLA_BR type 42 Unknown QEMU_IFLA_BR type 43 Unknown QEMU_IFLA_BR type 44 Unknown host QEMU_IFLA type: 43 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180516221213.11111-1-laurent@vivier.eu>
2018-05-15Merge remote-tracking branch ↵Peter Maydell
'remotes/vivier2/tags/linux-user-for-2.13-pull-request' into staging # gpg: Signature made Mon 14 May 2018 19:15:02 BST # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-2.13-pull-request: linux-user: correctly align types in thunking code linux-user: fix UNAME_MACHINE for sparc/sparc64 linux-user: add sparc/sparc64 specific errno linux-user: fix conversion of flock/flock64 l_type field linux-user: update sparc/syscall_nr.h to linux header 4.16 linux-user: fix flock/flock64 padding linux-user: define correct fcntl() values for sparc Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-05-11linux-user: fix UNAME_MACHINE for sparc/sparc64Laurent Vivier
"sun4" is not recognized by config.guess. linux defines sparc and sparc64 in arch/sparc/Makefile. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20180509231123.20864-7-laurent@vivier.eu>
2018-05-11linux-user: add sparc/sparc64 specific errnoLaurent Vivier
Copied from linux/arch/sparc/include/uapi/asm/errno.h Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20180509231123.20864-6-laurent@vivier.eu>
2018-05-11linux-user: fix conversion of flock/flock64 l_type fieldLaurent Vivier
As l_type values (F_RDLCK, F_WRLCK, F_UNLCK, F_EXLCK, F_SHLCK) are not bitmasks, we can't use target_to_host_bitmask() and host_to_target_bitmask() to convert them. Introduce target_to_host_flock() and host_to_target_flock() to convert values between host and target. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20180509231123.20864-5-laurent@vivier.eu>
2018-05-11linux-user: update sparc/syscall_nr.h to linux header 4.16Laurent Vivier
And kill sys_aplib, add sys_sync_file_range: on sparc, since linux 2.6.17, aplib syscall has been replaced by sync_file_range syscall. (289eee6fa78e ["SPARC]: Wire up sys_sync_file_range() into syscall tables.") The syscall has been removed in linux v2.5.71 (6196166fad "[SPARC64]: Kill sys_aplib.") Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20180509231123.20864-4-laurent@vivier.eu>
2018-05-11linux-user: fix flock/flock64 paddingLaurent Vivier
include/uapi/asm-generic/fcntl.h insert a padding macro at the end of the structures flock and flock64. This macro is defined to "short __unused;" on sparc, and "long pad[4]" on mips. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20180509231123.20864-3-laurent@vivier.eu>
2018-05-11linux-user: define correct fcntl() values for sparcLaurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20180509231123.20864-2-laurent@vivier.eu>
2018-05-10target/arm: Introduce ARM_FEATURE_V8_ATOMICS and initial decodeRichard Henderson
The insns in the ARMv8.1-Atomics are added to the existing load/store exclusive and load/store reg opcode spaces. Rearrange the top-level decoders for these to accomodate. The Atomics insns themselves still generate Unallocated. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180508151437.4232-8-richard.henderson@linaro.org [PMM: Drop the ARM_FEATURE_V8_1 feature flag] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-05-03linux-user: remove useless padding in flock64 structureLaurent Vivier
Since commit 8efb2ed5ec ("linux-user: Correct signedness of target_flock l_start and l_len fields"), flock64 structure uses abi_llong for l_start and l_len in place of "unsigned long long" this should force them to be aligned accordingly to the target rules. So we can remove the padding field and the QEMU_PACKED attribute. I have compared the result of the following program before and after the change: cat -> flock64_dump <<EOF p/d sizeof(struct target_flock64) p/d &((struct target_flock64 *)0)->l_type p/d &((struct target_flock64 *)0)->l_whence p/d &((struct target_flock64 *)0)->l_start p/d &((struct target_flock64 *)0)->l_len p/d &((struct target_flock64 *)0)->l_pid quit EOF for file in build/all/*-linux-user/qemu-* ; do echo $file gdb -batch -nx -x flock64_dump $file 2> /dev/null done The sizeof() changes because we remove the QEMU_PACKED. The new size is 32 (except for i386 and m68k) and this is the real size of "struct flock64" on the target architecture. The following architectures differ: aarch64_be, aarch64, alpha, armeb, arm, cris, hppa, nios2, or1k, riscv32, riscv64, s390x. For a subset of these architectures, I have checked with the following program the new structure is the correct one: #include <stdio.h> #define __USE_LARGEFILE64 #include <fcntl.h> int main(void) { printf("struct flock64 %d\n", sizeof(struct flock64)); printf("l_type %d\n", &((struct flock64 *)0)->l_type); printf("l_whence %d\n", &((struct flock64 *)0)->l_whence); printf("l_start %d\n", &((struct flock64 *)0)->l_start); printf("l_len %d\n", &((struct flock64 *)0)->l_len); printf("l_pid %d\n", &((struct flock64 *)0)->l_pid); } [I have checked aarch64, alpha, hppa, s390x] For ARM, the target_flock64 becomes the EABI definition, so we need to define the OABI one in place of the EABI one and use it when it is needed. I have also fixed the alignment value for sh4 (to align llong on 4 bytes) (see c2e3dee6e0 "linux-user: Define target alignment size") [We should check alignment properties for cris, nios2 and or1k] Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180502215730.28162-1-laurent@vivier.eu>
2018-05-03linux-user: introduce target_sigsp() and target_save_altstack()Laurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180411192347.30228-1-laurent@vivier.eu>
2018-05-03linux-user: ARM-FDPIC: Add support for signals for FDPIC targetsChristophe Lyon
The FDPIC restorer needs to deal with a function descriptor, hence we have to extend 'retcode' such that it can hold the instructions needed to perform this. The restorer sequence uses the same thumbness as the exception handler (mainly to support Thumb-only architectures). Co-Authored-By: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180430080404.7323-5-christophe.lyon@st.com> [lv: moved the change to linux-user/arm/signal.c] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-05-03linux-user: ARM-FDPIC: Add support of FDPIC for ARM.Christophe Lyon
Add FDPIC info into image_info structure since interpreter info is on stack and needs to be saved to be accessed later on. Co-Authored-By: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180430080404.7323-4-christophe.lyon@st.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-05-03linux-user: ARM-FDPIC: Identify ARM FDPIC binariesChristophe Lyon
Define an ARM-specific version of elf_is_fdpic: FDPIC ELF objects are identified with e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC. Co-Authored-By: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180430080404.7323-3-christophe.lyon@st.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-05-03Remove CONFIG_USE_FDPIC.Christophe Lyon
We want to avoid code disabled by default, because it ends up less tested. This patch removes all instances of #ifdef CONFIG_USE_FDPIC, most of which can be safely kept. For the ones that should be conditionally executed, we define elf_is_fdpic(). Without this patch, defining CONFIG_USE_FDPIC would prevent QEMU from building precisely because elf_is_fdpic is not defined. Signed-off-by: Christophe Lyon <christophe.lyon@st.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180430080404.7323-2-christophe.lyon@st.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-04-30linux-user: Add ARM get_tls syscall supportChristophe Lyon
Co-Authored-By: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180416091845.7315-1-christophe.lyon@st.com> [lv: moved the change to linux-user/arm/cpu_loop.c] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-04-30linux-user: move xtensa cpu loop to xtensa directoryLaurent Vivier
No code change, only move code from main.c to xtensa/cpu_loop.c. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180411185651.21351-20-laurent@vivier.eu>
2018-04-30linux-user: move hppa cpu loop to hppa directoryLaurent Vivier
No code change, only move code from main.c to hppa/cpu_loop.c. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180411185651.21351-19-laurent@vivier.eu>
2018-04-30linux-user: move riscv cpu loop to riscv directoryLaurent Vivier
No code change, only move code from main.c to riscv/cpu_loop.c. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Michael Clark <mjc@sifive.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180411185651.21351-18-laurent@vivier.eu>
2018-04-30linux-user: move tilegx cpu loop to tilegx directoryLaurent Vivier
No code change, only move code from main.c to tilegx/cpu_loop.c. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180411185651.21351-17-laurent@vivier.eu>
2018-04-30linux-user: move s390x cpu loop to s390x directoryLaurent Vivier
No code change, only move code from main.c to s390x/cpu_loop.c. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Acked-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180411185651.21351-16-laurent@vivier.eu>
2018-04-30linux-user: move alpha cpu loop to alpha directoryLaurent Vivier
No code change, only move code from main.c to alpha/cpu_loop.c. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180411185651.21351-15-laurent@vivier.eu>
2018-04-30linux-user: move m68k cpu loop to m68k directoryLaurent Vivier
No code change, only move code from main.c to m68k/cpu_loop.c. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180411185651.21351-14-laurent@vivier.eu>