summaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2013-12-03linux-user: Fix stat64 syscall for SPARC64Stefan Weil2-3/+17
Some targets use a stat64 structure for the stat64 syscall while others use a stat structure. SPARC64 used the wrong kind. Instead of extending the conditional compilation in syscall.c, now a macro TARGET_HAS_STRUCT_STAT64 is defined whenever a target has a target_stat64. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Erik de Castro Lopo <erikd@mega-nerd.com> (cherry picked from commit 20d155bc902f41c5b354937e730ad85b43614ae9) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-07-29linux-user: Return success from m68k set_thread_area syscallPeter Maydell1-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>
2013-07-29linux-user/signal.c: Avoid using uninitialized data in ARM sigreturnPeter Maydell1-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>
2013-07-29linux-user/signal.c: PPC: Silence clang uninitialized-use warningPeter Maydell1-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>
2013-07-29linux-user: correct argument number for sys_mremap and sys_splicePetar Jovanovic1-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>
2013-07-26linux-user: Avoid redundant ENV_GET_CPU()Andreas Färber1-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>
2013-07-25Merge remote-tracking branch 'riku/linux-user-for-upstream' into stagingAnthony Liguori19-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>
2013-07-23linux-user: Handle compressed ISA encodings when processing MIPS exceptionsKwok Cheung Yeung1-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>
2013-07-23linux-user: Reset copied CPUs in cpu_copy() alwaysAlexander Graf1-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>
2013-07-23linux-user: Fix epoll on ARM hostsAlexander Graf1-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>
2013-07-23linux-user: Fix pipe syscall return for SPARCPeter Maydell1-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>
2013-07-23linux-user: Fix target_stat and target_stat64 for OpenRISCPeter Maydell1-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>
2013-07-23linux-user: Use X86CPU property to retrieve CPUID familyAndreas Färber1-4/+6
Avoids duplicating the calculation. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23gdbstub: Change gdb_handlesig() argument to CPUStateAndreas Färber2-17/+21
Prepares for changing GDBState::c_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-22linux-user: Avoid conditional cpu_reset()Andreas Färber1-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>
2013-07-22configure: Make NPTL non-optionalPeter Maydell4-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>
2013-07-22linux-user: Enable NPTL for x86-64Peter Maydell2-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>
2013-07-22linux-user: Add i386 TLS setterAlexander Graf2-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>
2013-07-22linux-user: Clean up handling of clone() argument orderPeter Maydell11-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>
2013-07-22linux-user: Add missing 'break' in i386 get_thread_area syscallPeter Maydell1-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>
2013-07-22linux-user: Enable NPTL for m68kPeter Maydell3-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>
2013-07-22linux-user: Enable NPTL for SPARC targetsPeter Maydell1-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>
2013-07-22linux-user: Enable NPTL for OpenRISCPeter Maydell1-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>
2013-07-22linux-user: Move includes of target-specific headers to end of qemu.hPeter Maydell1-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>
2013-07-19linux-user: declare sys_futex to have 6 argumentsPetar Jovanovic1-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>
2013-07-10Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into stagingAnthony Liguori22-65/+534
QOM CPUState refactorings * Fix for OpenRISCCPU subclasses * Fix for gdbstub CPU selection * Move linux-user CPU functions into new header * CPUState part 10 refactoring: first_cpu, next_cpu, cpu_single_env et al. * Fix some targets to consistently inline TCG code generation * Centrally log CPU reset # gpg: Signature made Wed 10 Jul 2013 07:52:39 AM CDT using RSA key ID 3E7E013F # gpg: Can't check signature: public key not found # By Andreas Färber (41) and others # Via Andreas Färber * afaerber/tags/qom-cpu-for-anthony: (43 commits) cpu: Move reset logging to CPUState target-ppc: Change LOG_MMU_STATE() argument to CPUState target-i386: Change LOG_PCALL_STATE() argument to CPUState log: Change log_cpu_state[_mask]() argument to CPUState target-i386: Change do_smm_enter() argument to X86CPU target-i386: Change do_interrupt_all() argument to X86CPU target-xtensa: Change gen_intermediate_code_internal() arg to XtensaCPU target-unicore32: Change gen_intermediate_code_internal() signature target-sparc: Change gen_intermediate_code_internal() argument to SPARCCPU target-sh4: Change gen_intermediate_code_internal() argument to SuperHCPU target-s390x: Change gen_intermediate_code_internal() argument to S390CPU target-ppc: Change gen_intermediate_code_internal() argument to PowerPCCPU target-mips: Change gen_intermediate_code_internal() argument to MIPSCPU target-microblaze: Change gen_intermediate_code_internal() argument types target-m68k: Change gen_intermediate_code_internal() argument to M68kCPU target-lm32: Change gen_intermediate_code_internal() argument to LM32CPU target-i386: Change gen_intermediate_code_internal() argument to X86CPU target-cris: Change gen_intermediate_code_internal() argument to CRISCPU target-arm: Change gen_intermediate_code_internal() argument to ARMCPU target-alpha: Change gen_intermediate_code_internal() argument to AlphaCPU ...
2013-07-09log: Change log_cpu_state[_mask]() argument to CPUStateAndreas Färber1-2/+3
Since commit 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks) CPUArchState is no longer needed. Add documentation and make the functions available through qemu/log.h outside NEED_CPU_H to allow use in qom/cpu.c. Moving them to qom/cpu.h was not yet possible due to convoluted include paths, so that some devices grow an implicit and unneeded dependency on qom/cpu.h for now. Acked-by: Michael Walle <michael@walle.cc> (for lm32) Reviewed-by: Richard Henderson <rth@twiddle.net> [AF: Simplified mb_cpu_do_interrupt() and do_interrupt_all() changes] Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09linux-user: Change thread_env to CPUStateAndreas Färber6-22/+27
Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09cpu: Make first_cpu and next_cpu CPUStateAndreas Färber3-11/+13
Move next_cpu from CPU_COMMON to CPUState. Move first_cpu variable to qom/cpu.h. gdbstub needs to use CPUState::env_ptr for now. cpu_copy() no longer needs to save and restore cpu_next. Acked-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Rebased, simplified cpu_copy()] Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09linux-user: Clean up do_syscall() Coding Style for TARGET_NR_exitAndreas Färber1-36/+37
In particular fix 6-/10-char indentation. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09linux-user: Move cpu_clone_regs() and cpu_set_tls() into linux-userPeter Maydell17-0/+460
The functions cpu_clone_regs() and cpu_set_tls() are not purely CPU related -- they are specific to the TLS ABI for a a particular OS. Move them into the linux-user/ tree where they belong. target-lm32 had entirely unused implementations, since it has no linux-user target; just drop them. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-05linux-user: Do not ignore mmap failure from hostJürg Billeter1-0/+4
File mapping may fail with EACCES. Signed-off-by: Jürg Billeter <j@bitron.ch> Message-id: 1372498892-23676-1-git-send-email-j@bitron.ch Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2013-07-05linux-user: improve target_to_host_sock_type conversionPetar Jovanovic2-149/+275
Previous implementation has failed to take into account different value of SOCK_NONBLOCK on target and host, and existence of SOCK_CLOEXEC. The same conversion has to be applied both for do_socket and do_socketpair, so the code has been isolated in a static inline function. enum sock_type in linux-user/socket.h has been extended to include TARGET_SOCK_CLOEXEC and TARGET_SOCK_NONBLOCK, similar to definition in libc. The patch also includes necessary code style changes (tab to spaces) in the header file since most of the file has been touched by this change. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Message-id: 1372639454-7560-1-git-send-email-petar.jovanovic@rt-rk.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2013-07-05linux-user: Fix sys_utimensat (would not compile on old glibc)Peter Maydell1-4/+12
Commit c0d472b12e accidentally dropped the definition of __NR_SYS_utimensat even though its use is guarded by CONFIG_UTIMENSAT, not CONFIG_ATFILE. Some older glibc don't have utimensat() (even if they have the other *at() functions). Fix this by correctly cleaning up the sys_utimensat() implementation and #defines, so that we always provide the syscall if needed whether we're doing it via glibc or not. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> Message-id: 1371743841-26110-1-git-send-email-peter.maydell@linaro.org
2013-07-05linux-user: fix signal number range checkAndreas Schwab1-2/+2
When translating between host and target signal numbers keep negative numbers unchanged, avoiding access beyond array bounds. Signed-off-by: Andreas Schwab <schwab@linux-m68k.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 878v2b8sek.fsf@igel.home
2013-07-05linux-user: add SIOCADDRT/SIOCDELRT supportLaurent Vivier2-2/+68
This allows to pass the device name. You can test this with the "route" command. WITHOUT this patch: $ sudo route add -net default gw 10.0.3.1 eth0 SIOCADDRT: Bad address $ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Ifa 10.0.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth WITH this patch: $ sudo route add -net default gw 10.0.3.1 eth0 $ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Ifa 0.0.0.0 10.0.3.1 0.0.0.0 UG 0 0 0 eth 10.0.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2013-07-05linux-user: handle /proc/$$ like /proc/selfAndreas Schwab1-19/+46
Some applications use /proc/$$/... (where $$ is the own pid) instead of /proc/self/... to refer to their own proc files. Extend the interception for open and readlink to handle this case. Also, do the same interception in readlinkat. Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-28cpu: Turn cpu_dump_{state,statistics}() into CPUState hooksAndreas Färber1-15/+23
Make cpustats monitor command available unconditionally. Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec() arguments to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-28cpu: Change cpu_exit() argument to CPUStateAndreas Färber2-2/+2
It no longer depends on CPUArchState, so move it to qom/cpu.c. Prepares for changing GDBState::c_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-14main: use TARGET_ARCH only for the target-specific #definePaolo Bonzini1-3/+3
Everything else needs to match the executable name, which is TARGET_NAME. Before: $ sh4eb-linux-user/qemu-sh4eb --help usage: qemu-sh4 [options] program [arguments...] Linux CPU emulator (compiled for sh4 emulation) After: $ sh4eb-linux-user/qemu-sh4eb --help usage: qemu-sh4eb [options] program [arguments...] Linux CPU emulator (compiled for sh4eb emulation) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1370349928-20419-5-git-send-email-pbonzini@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12linux-user: Drop direct use of openat etc syscallsPeter Maydell1-194/+24
The linux-user syscall emulation layer currently supports the openat family of syscalls via two mechanisms: simply calling the corresponding libc functions, and making direct syscalls. Since glibc has supported these functions since at least glibc 2.5, there's no real need to retain the (essentially untested) direct syscall fallback code, so simply delete it. This allows us to remove some ifdeffery that was attempting to disable provision of some of the syscalls if the host didn't seem to support them, which in some cases was actually wrong (eg where there are several flavours of the syscall and we only need one of them, not necessarily the exact one the guest has, as with the fstatat* calls). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Tested-by: Claudio Fontana <claudio.fontana@huawei.com> Message-id: 1370126121-22975-2-git-send-email-peter.maydell@linaro.org
2013-06-12linux-user: Allow getdents to be provided by getdents64Peter Maydell1-1/+60
Newer architectures may only implement the getdents64 syscall, not getdents. Provide an implementation of getdents in terms of getdents64 so that we can run getdents-using targets on a getdents64-only host. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Tested-by: Claudio Fontana <claudio.fontana@huawei.com> Message-id: 1370344377-27445-1-git-send-email-peter.maydell@linaro.org Message-id: 1370193044-24535-1-git-send-email-peter.maydell@linaro.org
2013-06-01linux-user: Fix typo in commentLei Li1-1/+1
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-22Merge remote-tracking branch 'mjt/trivial-patches' into stagingAnthony Liguori1-2/+2
# By Christophe Lyon (1) and others # Via Michael Tokarev * mjt/trivial-patches: target-moxie: replace target_phys_addr_t with hwaddr Rename hexdump to avoid FreeBSD libutil conflict remove some double-includes translate: remove redundantly included qemu/timer.h Remove twice include of qemu-common.h fix /proc/self/maps output Message-id: 51977B44.1000302@msgid.tls.msk.ru Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-20linux-user: Save the correct resume address for MIPS signal handlingKwok Cheung Yeung1-1/+2
The current ISA mode needs to be saved in bit 0 of the resume address. If the current instruction happens to be in a branch delay slot, then the address of the preceding jump instruction should be stored instead. exception_resume_pc already does both of these tasks, so it is made available and reused. MIPS_HFLAG_BMASK in hflags is cleared, otherwise QEMU may treat the first instruction of the signal handler as a delay slot instruction. Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-05-20linux-user: Fix MIPS ISA transitions during signal handlingKwok Cheung Yeung1-0/+13
Processors supporting the MIPS16 or microMIPS ISAs set bit 0 in target addresses to indicate that the target is written using a compressed ISA. During signal handling, when jumping to or returning from a signal handler, bit 0 of the destination PC is inspected and MIPS_HFLAG_M16 in hflags cleared or set accordingly. Bit 0 of the PC is then cleared. Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-05-18fix /proc/self/maps outputChristophe Lyon1-2/+2
Add a space at end of line when there is no filename to print, to conform to linux kernel format (see show_map_vma() in fs/proc/task_mmu.c). Signed-off-by: Christophe Lyon <christophe.lyon@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-02target-i386: Replace cpuid_*features fields with a feature word arrayEduardo Habkost2-3/+3
This replaces the feature-bit fields on both X86CPU and x86_def_t structs with an array. With this, we will be able to simplify code that simply does the same operation on all feature words (e.g. kvm_check_features_against_host(), filter_features_for_kvm(), add_flagname_to_bitmaps(), CPU feature-bit property lookup/registration, and the proposed "feature-words" property) The following field replacements were made on X86CPU and x86_def_t: (cpuid_)features -> features[FEAT_1_EDX] (cpuid_)ext_features -> features[FEAT_1_ECX] (cpuid_)ext2_features -> features[FEAT_8000_0001_EDX] (cpuid_)ext3_features -> features[FEAT_8000_0001_ECX] (cpuid_)ext4_features -> features[FEAT_C000_0001_EDX] (cpuid_)kvm_features -> features[FEAT_KVM] (cpuid_)svm_features -> features[FEAT_SVM] (cpuid_)7_0_ebx_features -> features[FEAT_7_0_EBX] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-04-26linux-user: fix compile error due to stray colon at end of #ifdef linePeter Maydell1-1/+1
Remove a stray colon from the end of a #ifdef line. Some versions of gcc complain about this: linux-user/syscall.c: In function ‘do_syscall’: linux-user/syscall.c:7606:28: error: extra tokens at end of #ifdef directive [-Werror] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-By: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-19linux-user: fix setgroups/getgroups for non-UID16 archsAndreas Schwab1-3/+3
Don't assume target_id is a short. Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>