summaryrefslogtreecommitdiffstats
path: root/linux-user
Commit message (Collapse)AuthorAgeFilesLines
* cpu: Drop cpu_model_str from CPU_COMMONAndreas Färber2013-10-071-2/+2
| | | | | | | Since this is only read in cpu_copy() and linux-user has a global cpu_model, drop the field from generic code. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move cpu_copy() into linux-userAndreas Färber2013-10-071-0/+31
| | | | | | | | It is only used there and is deemed very fragile if not incorrect in its current memcpy() form. Moving it into linux-user will allow to move parts into target_cpu.h headers and only copy what the ABI mandates. Signed-off-by: Andreas Färber <afaerber@suse.de>
* linux-user: Handle SOCK_CLOEXEC/NONBLOCK if unavailable on hostEdgar E. Iglesias2013-09-241-3/+37
| | | | | | | | | If the host lacks SOCK_CLOEXEC, bail out with -EINVAL. If the host lacks SOCK_ONONBLOCK, try to emulate it with fcntl() and O_NONBLOCK. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* [v2] linux-user: implement m68k atomic syscallsRiku Voipio2013-09-242-0/+34
| | | | | | | | | | | | | | | | With nptl enabled, atomic_cmpxchg_32 and atomic_barrier system calls are needed. This patch enabled really dummy versions of the system calls, modeled after the m68k kernel code. With this patch I am able to execute m68k binaries with qemu linux-user (busybox compiled for coldfire). [v2] que an segfault instead of returning a EFAULT to keep in line with kernel code. Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Check type of microMIPS break instructionKwok Cheung Yeung2013-09-241-21/+35
| | | | | | | | | | | | microMIPS instructions that cause breakpoint exceptions come in 16-bit and 32-bit variants. When handling exceptions caused by such instructions, the instruction type needs to be taken into account when extracting the break code. The code has also been restructured for better clarity. Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: correct how SOL_SOCKET is converted from target to host and backPetar Jovanovic2013-09-241-5/+13
| | | | | | | | | Previous implementation does not take into account that SOL_SOCKET constant can be arch specific. This change fixes some issues with sendmsg/recvmsg. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: add support of binfmt_misc 'O' flagLaurent Vivier2013-09-243-8/+34
| | | | | | | | | | | | | | | | | The binfmt_misc module can calculate the credentials and security token according to the binary instead of to the interpreter if the 'C' flag is enabled. To be able to execute non-readable binaries, this flag implies 'O' flag. When 'O' flag is enabled, bintfmt_misc opens the file for reading and pass the file descriptor to the interpreter. References: linux/Documentation/binfmt_misc.txt ['O' and 'C' description] linux/fs/binfmt_misc.c linux/fs/binfmt_elf.c [ AT_EXECFD usage ] Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: add some IPV6 commands in setsockop()Laurent Vivier2013-09-241-0/+20
| | | | | | Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: allow use of TIOCGSIDLaurent Vivier2013-09-241-0/+1
| | | | | | Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Add setsockopt(SO_ATTACH_FILTER)Laurent Vivier2013-09-242-0/+56
| | | | | | | | This is needed to be able to run dhclient. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: convert /proc/net/route when endianess differsLaurent Vivier2013-09-241-5/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows to have IP addresses in correct order in the case of "netstat -nr" when the endianess of the guest differs from one of the host. For instance, an m68k guest on an x86_64 host: WITHOUT this patch: $ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 1.3.0.10 0.0.0.0 UG 0 0 0 eth0 0.3.0.10 0.0.0.0 0.255.255.255 U 0 0 0 eth0 $ cat /proc/net/route Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT eth0 00000000 0103000A 0003 0 0 0 000000000 0 0 eth0 0003000A 00000000 0001 0 0 0 00FFFFFF0 0 0 WITH this patch: $ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 10.0.3.1 0.0.0.0 UG 0 0 0 eth0 10.0.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 $ cat /proc/net/route Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT eth0 00000000 0a000301 0003 0 0 0 000000000 0 0 eth0 0a000300 00000000 0001 0 0 0 ffffff000 0 0 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* mips-linux-user: Adjust names in mips_syscall_argsRichard Henderson2013-09-241-2/+2
| | | | | | | | The name field of MIPS_SYS isn't actually used; it's just documentation. But adjust the umount entries to match mips/syscall_nr.h anyway. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* alpha-linux-user: Fix umount syscall numbersRichard Henderson2013-09-243-6/+3
| | | | | | | | | | | | | | | It has been pointed out on LKML that the alpha umount syscall numbers are named wrong, and a patch to rectify that has been posted for 3.11. Glibc works around this by treating NR_umount as NR_umount2 if NR_oldumount exists. That's more complicated than we need in QEMU, given that we control linux-user/*/syscall_nr.h. This is the last instance of TARGET_NR_oldumount, so delete that from the strace.list. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* *-user: Improve documentation for lock_user functionStefan Weil2013-09-201-2/+2
| | | | | | | | | Add a missing "function" and replace "and" by "any". BSD and Linux use the same documentation here, so fix both. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* *-user: Fix typo in comment (ulocking -> unlocking)Stefan Weil2013-09-201-1/+1
| | | | | | Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* linux-user: Add AArch64 supportAlexander Graf2013-09-103-2/+38
| | | | | | | | | | | | | | | | | | This patch adds support for AArch64 in all the small corners of linux-user (primarily in image loading and startup code). Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-22-git-send-email-peter.maydell@linaro.org Message-id: 1368505980-17151-11-git-send-email-john.rigby@linaro.org [PMM: * removed some unnecessary #defines from syscall.h * catch attempts to use a 32 bit only cpu with aarch64-linux-user * termios stuff moved into its own patch * we specify our minimum uname version here now ] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Allow targets to specify a minimum uname releasePeter Maydell2013-09-103-14/+51
| | | | | | | | | | | | | | | | For newer target architectures, glibc can be picky about the kernel version: for example, it will not run on an aarch64 system unless the kernel reports itself as at least 3.8.0. Accommodate this by enhancing the existing support for faking the kernel version so that each target can optionally specify a minimum version: if the user doesn't force a specific fake version then we will override with the minimum required version only if the real host kernel version is insufficient. Use this facility to let aarch64 report a minimum of 3.8.0. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-21-git-send-email-peter.maydell@linaro.org
* linux-user: Add AArch64 termbits.h definitionsAlexander Graf2013-09-101-0/+220
| | | | | | | | | | | | Add the AArch64 termbits.h with all the target's termios related constants and structures. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-20-git-send-email-peter.maydell@linaro.org [PMM: split out from another patch] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Implement cpu_set_tls() and cpu_clone_regs() for AArch64Alexander Graf2013-09-101-0/+35
| | | | | | | | | | Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-19-git-send-email-peter.maydell@linaro.org [PMM: pulled out from another patch; don't use is_a64() here; moved to linux-user from target-arm] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Make sure NWFPE code is 32 bit ARM onlyPeter Maydell2013-09-101-1/+3
| | | | | | | | | | | On ARM, linux-user emulation includes NWFPE support for emulating the ancient FPA floating point coprocessor. This has long since been superseded by VFP and is only required for legacy binaries. The AArch64 linux-user target doesn't compile in NWFPE support, so make sure the relevant code is protected by suitable ifdefs. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-18-git-send-email-peter.maydell@linaro.org
* linux-user: Add signal handling for AArch64Andreas Schwab2013-09-102-0/+289
| | | | | | | | | | | | | | | This patch adds signal handling for AArch64. The code is based on the respective source in the Linux kernel. Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-17-git-send-email-peter.maydell@linaro.org Message-id: 1368505980-17151-10-git-send-email-john.rigby@linaro.org [PMM: fixed style nits: tabs, long lines; pulled target_signal.h in from a later patch; it fits better here] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Fix up AArch64 syscall handlersAlexander Graf2013-09-102-4/+29
| | | | | | | | | | | | | | | | | Some syscall handlers have special code for ARM enabled that we don't need on AArch64. Exclude AArch64 in those cases. In other places we can share struct definitions with other targets or have to provide our own. With this patch applied, most syscall definitions in linux-user should be sound for AArch64. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-16-git-send-email-peter.maydell@linaro.org Message-id: 1368505980-17151-9-git-send-email-john.rigby@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Add syscall number definitions for AArch64Alexander Graf2013-09-101-0/+323
| | | | | | | | | | | | | | | The AArch64 syscall definitions are all publicly available in the Linux kernel. Let's add them to our linux-user emulation target, so that we can easily handle AArch64 syscalls. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-15-git-send-email-peter.maydell@linaro.org Message-id: 1368505980-17151-8-git-send-email-john.rigby@linaro.org [PMM: changes relating to cpu_loop() removed as they are superseded by an earlier patch] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Add cpu loop for AArch64Peter Maydell2013-09-101-0/+82
| | | | | | | | | | | | Add the main linux-user cpu loop for AArch64. Since AArch64 has a different system call interface, doesn't need to worry about FPA emulation and may in the future keep the prefetch/data abort information in different system registers, it's simplest just to use a completely separate loop from the 32 bit ARM target, rather than peppering it with ifdefs. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-14-git-send-email-peter.maydell@linaro.org
* linux-user: Don't treat AArch64 cpu names speciallyAlexander Graf2013-09-101-1/+2
| | | | | | | | | | | | | 32-bit ARM has a lot of different names for different types of CPUs it supports. On AArch64, we don't have this, so we really don't want to execute the 32-bit logic. Stub it out for AArch64 linux-user guests. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-13-git-send-email-peter.maydell@linaro.org Message-id: 1368505980-17151-7-git-send-email-john.rigby@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* cpu: Use QTAILQ for CPU listAndreas Färber2013-09-033-19/+10
| | | | | | | Introduce CPU_FOREACH(), CPU_FOREACH_SAFE() and CPU_NEXT() shorthand macros. Signed-off-by: Andreas Färber <afaerber@suse.de>
* linux-user: Return success from m68k set_thread_area syscallPeter Maydell2013-07-291-0/+1
| | | | | | | | | | The m68k set_thread_area syscall implementation failed to set the return value. Correctly set it zero, since this syscall will always succeed. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1375093909-13653-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* linux-user/signal.c: Avoid using uninitialized data in ARM sigreturnPeter Maydell2013-07-291-16/+20
| | | | | | | | | | | | | | | Rephrase code used in ARM sigreturn functions to avoid using uninitialized variables. This fixes one genuine problem ('frame' would not be initialized if we took the error-exit path because our stackpointer was misaligned) and one which is clang being alarmist (frame_addr wouldn't be initialized, though this is harmless since unlock_user_struct ignores its second argument in these cases; however since we don't generally make use of this not-really-documented effect it's better avoided). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1375095632-13735-3-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* linux-user/signal.c: PPC: Silence clang uninitialized-use warningPeter Maydell2013-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Silence a clang warning in a PPC signal return function: /home/petmay01/linaro/qemu-from-laptop/qemu/linux-user/signal.c:4611:9: error: variable 'sr_addr' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (!lock_user_struct(VERIFY_READ, sc, sc_addr, 1)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/petmay01/linaro/qemu-from-laptop/qemu/linux-user/signal.c:4636:28: note: uninitialized use occurs here unlock_user_struct(sr, sr_addr, 1); ^~~~~~~ /home/petmay01/linaro/qemu-from-laptop/qemu/linux-user/qemu.h:442:27: note: expanded from macro 'unlock_user_struct' unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0) ^ This happens when we unlock a user struct which we never attempted to lock. Strictly, clang is actually wrong here -- it hasn't been able to spot that unlock_user_struct() doesn't use its second argument if the first is NULL. However it doesn't seem too unreasonable to demand that we pass in initialized values to it. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1375095632-13735-2-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* linux-user: correct argument number for sys_mremap and sys_splicePetar Jovanovic2013-07-291-2/+2
| | | | | | | | | | | sys_mremap missed 5th argument (new_address), which caused examples that remap to a specific address to fail. sys_splice missed 5th and 6th argument which caused different examples to fail. This change has an effect on MIPS target only. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* linux-user: Avoid redundant ENV_GET_CPU()Andreas Färber2013-07-261-1/+1
| | | | | | | This fixes a mismerge in 874ec3c5b3821bb964f9f37b2f930f2a9ce51652. Acked-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Andreas Färber <afaerber@suse.de>
* Merge remote-tracking branch 'riku/linux-user-for-upstream' into stagingAnthony Liguori2013-07-2519-152/+194
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * riku/linux-user-for-upstream: (21 commits) linux-user: Handle compressed ISA encodings when processing MIPS exceptions linux-user: Unlock mmap_lock when resuming guest from page_unprotect linux-user: Reset copied CPUs in cpu_copy() always linux-user: Fix epoll on ARM hosts linux-user: fix segmentation fault passing with h2g(x) != x linux-user: Fix pipe syscall return for SPARC linux-user: Fix target_stat and target_stat64 for OpenRISC linux-user: Avoid conditional cpu_reset() configure: Make NPTL non-optional linux-user: Enable NPTL for x86-64 linux-user: Add i386 TLS setter linux-user: Clean up handling of clone() argument order linux-user: Add missing 'break' in i386 get_thread_area syscall linux-user: Enable NPTL for m68k linux-user: Enable NPTL for SPARC targets linux-user: Enable NPTL for OpenRISC linux-user: Move includes of target-specific headers to end of qemu.h configure: Enable threading for unicore32-linux-user configure: Enable threading on all ppc and mips linux-user targets configure: Don't say target_nptl="no" if there is no linux-user target ... Conflicts: linux-user/main.c Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * linux-user: Handle compressed ISA encodings when processing MIPS exceptionsKwok Cheung Yeung2013-07-231-3/+43
| | | | | | | | | | | | | | | | Decode trap instructions during the handling of an EXCP_BREAK or EXCP_TRAP according to the current ISA mode. Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Reset copied CPUs in cpu_copy() alwaysAlexander Graf2013-07-231-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | When a new thread gets created, we need to reset non arch specific state to get the new CPU into clean state. However this reset should happen before the arch specific CPU contents get copied over. Otherwise we end up having clean reset state in our newly created thread. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Fix epoll on ARM hostsAlexander Graf2013-07-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The epoll emulation uses data structures without packing them, so the compiler might choose to add padding inside. This patch makes the most offending one (target_epoll_event) a packed structure to make sure we don't pad it by accident. ARM would pad it, so declare the padding mandatory for ARM targets. This fixes i386-on-ARM epoll emulation for me. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Fix pipe syscall return for SPARCPeter Maydell2013-07-231-0/+3
| | | | | | | | | | | | | | | | SPARC is one of the CPUs which has a funny syscall ABI for the pipe syscall; add it to the set of special cases in do_pipe(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Fix target_stat and target_stat64 for OpenRISCPeter Maydell2013-07-231-12/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenRISC uses the asm-generic versions of target_stat and target_stat64, but it was incorrectly using the x86/ARM/etc version due to a misplaced defined(TARGET_OPENRISC). The previously unused OpenRISC section of the ifdef ladder also defined an incorrect target_stat and omitted the target_stat64 definition. Fix target_stat, provide target_stat64, and add a comment noting that these are the asm-generic versions for the benefit of future ports. Reviewed-by: Jia Liu <proljc@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Avoid conditional cpu_reset()Andreas Färber2013-07-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Some CPUs reset as part of cpu_init(), some others were reset afterwards, some not at all. While some targets didn't implement a cpu_[state_]reset() function, QOM cpu_reset() is always available. There's nothing wrong with resetting twice on startup, so drop the #ifdef. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * configure: Make NPTL non-optionalPeter Maydell2013-07-224-110/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now all linux-user targets support building with NPTL, we can make it mandatory. This is a good idea because: * NPTL is no longer new and experimental; it is completely standard * in practice, linux-user without NPTL is nearly useless for binaries built against non-ancient glibc * it allows us to delete the rather untested code for handling the non-NPTL configuration Note that this patch leaves the CONFIG_USE_NPTL ifdefs in the bsd-user codebase alone. This makes no change for bsd-user, since our configure test for NPTL had a "#include <linux/futex.h>" which means bsd-user would never have been compiled with CONFIG_USE_NPTL defined, and it still is not. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Enable NPTL for x86-64Peter Maydell2013-07-222-1/+8
| | | | | | | | | | | | | | | | | | Add x86-64 implementation of cpu_set_tls() (like the kernel, we just have to call do_arch_prctl() to set FS); this allows us to enable NPTL. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Add i386 TLS setterAlexander Graf2013-07-222-3/+11
| | | | | | | | | | | | | | | | | | | | We can easily set the TLS on i386. Add code to do so. Signed-off-by: Alexander Graf <agraf@suse.de> [PMM: also remove "target_nptl=no" line from configure, for consistency with other patches in this series] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Clean up handling of clone() argument orderPeter Maydell2013-07-2211-7/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux manages to have three separate orderings of the arguments to the clone() syscall on different architectures. In the kernel these are selected via CONFIG_CLONE_BACKWARDS and CONFIG_CLONE_BACKWARDS2. Clean up our implementation of this to use similar #define names rather than a TARGET_* ifdef ladder. This includes behaviour changes fixing bugs on cris, x86-64, m68k, openrisc and unicore32. cris had explicit but wrong handling; the others were just incorrectly using QEMU's default, which happened to be the equivalent of CONFIG_CLONE_BACKWARDS. (unicore32 appears to be broken in the mainline kernel in that it tries to use arg3 for both parent_tidptr and newtls simultaneously -- we don't attempt to emulate this bug...) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Add missing 'break' in i386 get_thread_area syscallPeter Maydell2013-07-221-0/+1
| | | | | | | | | | | | | | | | | | | | The i386 code for the get_thread_area syscall was missing a 'break' which meant it would have fallen through into the implementation of the following syscall; add it. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Enable NPTL for m68kPeter Maydell2013-07-223-1/+18
| | | | | | | | | | | | | | | | | | | | | | For m68k, per-thread data is a purely kernel construct with no CPU level support. Implement it via a field in the TaskState structure, used by cpu_set_tls() and the set_thread_area/get_thread_area syscalls. This allows us to enable compilation with NPTL. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Enable NPTL for SPARC targetsPeter Maydell2013-07-221-4/+12
| | | | | | | | | | | | | | | | | | | | Provide the missing cpu_set_tls(), and resolve the FIXME in cpu_clone_regs() by clearing the carry flag for the child. This allows us to turn on building with NPTL for SPARC. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Enable NPTL for OpenRISCPeter Maydell2013-07-221-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | The OpenRISC kernel ignores CLONE_SETTLS in its copy_thread() implementation, so a cpu_set_tls() implementation is a no-op. cpu_clone_regs() was setting the syscall return value in the wrong register -- it is gpr[11], not gpr[2]. With these two things fixed, we can compile with NPTL enabled. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Jia Liu <proljc@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Move includes of target-specific headers to end of qemu.hPeter Maydell2013-07-221-2/+7
| | | | | | | | | | | | | | | | | | | | | | The target-specific headers (target_cpu.h and target_signal.h) might need to use the target-independent structure and function definitions of qemu.h; so include them only at the bottom of qemu.h, not the top. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* | linux-user: Use X86CPU property to retrieve CPUID familyAndreas Färber2013-07-231-4/+6
| | | | | | | | | | | | | | Avoids duplicating the calculation. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* | gdbstub: Change gdb_handlesig() argument to CPUStateAndreas Färber2013-07-232-17/+21
|/ | | | | | Prepares for changing GDBState::c_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
* linux-user: declare sys_futex to have 6 argumentsPetar Jovanovic2013-07-191-1/+1
| | | | | | | | | | | | | sys_futex has 6 arguments, and all of these need to be copied. Fix incorrect declaration in the mips_syscall_args array. This change fixes the cases where the 5th and 6th arguments have non-zero value and have importance. An example is a Linux implementation of pthread_cond_wait() function. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
OpenPOWER on IntegriCloud