summaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2015-07-15linux-user: Fix MIPS N64 trap and break instruction bugAndrew Bennett1-2/+2
For the MIPS N64 ABI when QEMU reads the break/trap instruction so that it can inspect the break/trap code it reads 8 rather than 4 bytes which means it finds the code field from the instruction after the break/trap instruction. This then causes the break/trap handling code to fail because it does not understand the code number. The fix forces QEMU to always read 4 bytes of instruction data rather than deciding how much to read based on the ABI. Signed-off-by: Andrew Bennett <andrew.bennett@imgtec.com> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-07-09cpu-exec: Purge all uses of ENV_GET_CPU()Peter Crosthwaite1-14/+14
Remove un-needed usages of ENV_GET_CPU() by converting the APIs to use CPUState pointers and retrieving the env_ptr as minimally needed. Scripted conversion for target-* change: for I in target-*/cpu.h; do sed -i \ 's/\(^int cpu_[^_]*_exec(\)[^ ][^ ]* \*s);$/\1CPUState *cpu);/' \ $I; done Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-07-09gdbstub: Change gdbserver_fork() to accept cpu instead of envPeter Crosthwaite1-1/+1
All callsites to this function navigate the cpu->env_ptr only for the function to take the env ptr back to the original cpu ptr. Change the function to just pass in the CPU pointer instead. Removes a core code usage of ENV_GET_CPU() (in gdbstub.c). Cc: Riku Voipio <riku.voipio@iki.fi> Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-07-09translate-all: Change tb_flush() env argument to cpuPeter Crosthwaite1-1/+1
All of the core-code usages of this API have the cpu pointer handy so pass it in. There are only 3 architecture specific usages (2 of which are commented out) which can just use ENV_GET_CPU() locally to get the cpu pointer. The reduces core code usage of the CPU env, which brings us closer to common-obj'ing these core files. Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-07-07linux-user, ppc: mftbl can be used by user applicationLaurent Vivier1-2/+1
In qemu-linux-user, when calling gethostbyname2(), it was hanging in .__res_nmkquery. (gdb) bt 0 in .__res_nmkquery () from /lib64/libresolv.so.2 1 in .__libc_res_nquery () from /lib64/libresolv.so.2 2 in .__libc_res_nsearch () from /lib64/libresolv.so.2 3 in ._nss_dns_gethostbyname3_r () from /lib64/libnss_dns.so.2 4 in ._nss_dns_gethostbyname2_r () from /lib64/libnss_dns.so.2 5 in .gethostbyname2_r () from /lib64/libc.so.6 6 in .gethostbyname2 () from /lib64/libc.so.6 .__res_nmkquery() is: ... do { RANDOM_BITS (randombits); } while ((randombits & 0xffff) == 0); ... <.__res_nmkquery+112>: mftbl r11 <.__res_nmkquery+116>: clrlwi r10,r11,16 <.__res_nmkquery+120>: cmpwi cr7,r10,0 <.__res_nmkquery+124>: beq cr7,<.__res_nmkquery+112> but as mftbl (Move From Time Base Lower) is not implemented, r11 is always 0, so we have an infinite loop. This patch fills the Time Base register with cpu_get_real_ticks(). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-06-16linux-user: ioctl() command type is intLaurent Vivier1-8/+8
When executing a 64bit target chroot on 64bit host, the ioctl() command can mismatch. It seems the previous commit doesn't solve the problem in my case: 9c6bf9c7 linux-user: Fix ioctl cmd type mismatch on 64-bit targets For example, a ppc64 chroot on an x86_64 host: bash-4.3# ls Unsupported ioctl: cmd=0x80087467 Unsupported ioctl: cmd=0x802c7415 The origin of the problem is in syscall.c:do_ioctl(). static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg) In this case (ppc64) abi_long is long (on the x86_64), and cmd = 0x0000000080087467 then if (ie->target_cmd == cmd) target_cmd is int, so target_cmd = 0x80087467 and to compare an int with a long, the sign is extended to 64bit, so the comparison is: if (0xffffffff80087467 == 0x0000000080087467) which doesn't match whereas it should. This patch uses int in the case of the target command type instead of abi_long. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-06-16linux-user: fix the breakpoint inheritance in spawned threadsThierry Bultel1-2/+2
When a thread is spawned, cpu_copy re-initializes the bp & wp lists of current thread, instead of the ones of the new thread. The effect is that breakpoints are no longer hit. Signed-off-by: Thierry Bultel <thierry.bultel@basystemes.fr> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-06-16linux-user: use __get_user and __put_user in cmsg conversionsPeter Maydell1-9/+11
The target payloads in cmsg conversions may not have the alignment required by the host. Using the get_user and put_user functions is the easiest way to handle this and also do the byte-swapping we require. (Note that prior to this commit target_to_host_cmsg was incorrectly using __put_user() rather than __get_user() for the SCM_CREDENTIALS conversion, which meant it wasn't getting the benefit of the misalignment handling.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-06-16linux-user: Fix length handling in host_to_target_cmsgPeter Maydell1-8/+61
The previous code for handling payload length when converting cmsg structures from host to target had a number of problems: * we required the msg->msg_controllen to declare the buffer to have enough space for final trailing padding (we were checking against CMSG_SPACE), whereas the kernel does not require this, and common userspace code assumes this. (In particular, glibc's "try to talk to nscd" code that it will run on startup will receive a cmsg with a 4 byte payload and only allocate 4 bytes for it, which was causing us to do the wrong thing on architectures that need 8-alignment.) * we weren't correctly handling the fact that the SO_TIMESTAMP payload may be larger for the target than the host * we weren't marking the messages with MSG_CTRUNC when we did need to truncate a message that wasn't truncated by the host, but were instead logging a QEMU message; since truncation is always the result of a guest giving us an insufficiently sized buffer, we should report it to the guest as the kernel does and don't log anything Rewrite the parts of the function that deal with length to fix these issues, and add a comment in target_to_host_cmsg to explain why the overflow logging it does is a QEMU bug, not a guest issue. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-06-15linux-user: Use abi_ulong for TARGET_ELF_PAGESTARTYongbok Kim1-1/+2
TARGET_ELF_PAGESTART is required to use abi_ulong to correctly handle addresses for different target bits width. This patch fixes a problem when running a 64-bit user mode application on 32-bit host machines. Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-06-15linux-user: Allocate thunk size dynamicallyAlexander Graf1-0/+3
We store all struct types in an array of static size without ever checking whether we overrun it. Of course some day someone (like me in another, ancient ALSA enabling patch set) will run into the limit without realizing it. So let's make the allocation dynamic. We already know the number of structs that we want to allocate, so we only need to pass the variable into the respective piece of code. Also, to ensure we don't accidently overwrite random memory, add some asserts to sanity check whether a thunk is actually part of our array. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-06-12linux-user: Add HWCAP for SH4Richard Henderson1-0/+29
Only exposing FPU and LLSC as the only features supported by the translator. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2015-06-12linux-user: Default sh4 to sh7785Richard Henderson1-0/+2
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2015-06-05target-i386: use memory API to implement SMRAMPaolo Bonzini1-4/+0
Remove cpu_smm_register and cpu_smm_update. Instead, each CPU address space gets an extra region which is an alias of /machine/smram. This extra region is enabled or disabled as the CPU enters/exits SMM. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-06-05translate-all: remove unnecessary argument to tb_invalidate_phys_rangePaolo Bonzini1-3/+3
The is_cpu_write_access argument is always 0, remove it. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-06-05exec: move functions to translate-all.hPaolo Bonzini1-0/+1
Remove them from the sundry exec-all.h header, since they are only used by the TCG runtime in exec.c and user-exec.c. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-27s390x: Common access to floating point registersEric Farman1-2/+2
Provide a routine to access the correct floating point register, to simplify future expansion. Suggested-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-18linux-user/arm: Correct TARGET_NR_timerfd to TARGET_NR_timerfd_createTimothy Baldwin1-1/+1
Misspelled system call name in macro was causing timerfd_create not to be supported for the ARM target. Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-04-30linux-user/elfload: use QTAILQ_FOREACH instead of open-coding itEmilio G. Cota1-2/+1
Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-04-27linux-user, bsd-user: Remove two calls to cpu_exec_init_allFam Zheng1-1/+0
The function is a nop for user mode, so just remove them. Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1426496617-10702-3-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-04-01rcu: do not create thread in pthread_atfork callbackPaolo Bonzini1-0/+1
If QEMU forks after the CPU threads have been created, qemu_mutex_lock_iothread will not be able to do qemu_cpu_kick_thread. There is no solution other than assuming that forks after the CPU threads have been created will end up in an exec. Forks before the CPU threads have been created (such as -daemonize) have to call rcu_after_fork manually. Notably, the oxygen theme for GTK+ forks and shows a "No such process" error without this patch. This patch can be reverted once the iothread loses the "kick the TCG thread" magic. User-mode emulation does not use the iothread, so it can also call rcu_after_fork. Reported by: Dr. David Alan Gilbert <dgilbert@redhat.com> Tested by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-03-23linux-user: fix broken cpu_copy()Leon Alrae1-1/+1
New threads always point at the same env which is incorrect and usually leads to a crash. Signed-off-by: Leon Alrae <leon.alrae@imgtec.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-03-22linux-user: fix emulation of splice syscallAndreas Schwab1-4/+18
The second and fourth argument are in/out parameters, store them back after the syscall. Also, the fourth argument was mishandled, and EFAULT handling was missing. Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-03-22linux-user/main.c: Remove redundant end_exclusive() in ↵Chen Gang S1-2/+0
arm_kernel_cmpxchg64_helper() start/end_exclusive() need be pairs, except the start_exclusive() in stop_all_tasks() which is only used by force_sig(), which will be abort. So at present, start_exclusive() in stop_all_task() need not be paired. queue_signal() may call force_sig(), or return after kill pid (or queue signal). If could return from queue_signal(), stop_all_task() would not be called in time, the next end_exclusive() would be issue. So in arm_kernel_cmpxchg64_helper() for ARM, need remove end_exclusive() after queue_signal(). The related commit: "97cc756 linux-user: Implement new ARM 64 bit cmpxchg kernel helper". Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-03-16linux-user: Access correct register for get/set_tls syscalls on ARM TZ CPUsMikhail Ilyin2-2/+15
When support was added for TrustZone to ARM CPU emulation, we failed to correctly update the support for the linux-user implementation of the get/set_tls syscalls. This meant that accesses to the TPIDRURO register via the syscalls were always using the non-secure copy of the register even if native MRC/MCR accesses were using the secure register. This inconsistency caused most binaries to segfault on startup if the CPU type was explicitly set to one of the TZ-enabled ones like cortex-a15. (The default "any" CPU doesn't have TZ enabled and so is not affected.) Use access_secure_reg() to determine whether we should be using the secure or the nonsecure copy of TPIDRURO when emulating these syscalls. Signed-off-by: Mikhail Ilyin <m.ilin@samsung.com> Message-id: 1426505198-2411-1-git-send-email-m.ilin@samsung.com [PMM: rewrote commit message to more clearly explain the issue and its consequences.] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-03-10cpu: Make cpu_init() return QOM CPUState objectEduardo Habkost1-5/+5
Instead of making cpu_init() return CPUArchState, return CPUState. Changes were made using the Coccinelle semantic patch below. @@ typedef CPUState; identifier e; expression args; type CPUArchState; @@ - e = + cpu = cpu_init(args); - if (!e) { + if (!cpu) { ... } - cpu = ENV_GET_CPU(env); + e = cpu->env_ptr; @@ identifier new_env, new_cpu, env, cpu; type CPUArchState; expression args; @@ -{ - CPUState *cpu = ENV_GET_CPU(env); - CPUArchState *new_env = cpu_init(args); - CPUState *new_cpu = ENV_GET_CPU(new_env); +{ + CPUState *cpu = ENV_GET_CPU(env); + CPUState *new_cpu = cpu_init(args); + CPUArchState *new_env = new_cpu->env_ptr; ... } @@ identifier c, cpu_init_func, cpu_model; type StateType, CPUType; @@ -static inline StateType* cpu_init(const char *cpu_model) -{ - CPUType *c = cpu_init_func(cpu_model); ( - if (c == NULL) { - return NULL; - } - return &c->env; | - if (c) { - return &c->env; - } - return NULL; ) -} +#define cpu_init(cpu_model) CPU(cpu_init_func(cpu_model)) @@ identifier cpu_init_func; identifier model; @@ -#define cpu_init(model) (&cpu_init_func(model)->env) +#define cpu_init(model) CPU(cpu_init_func(model)) Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Richard Henderson <rth@twiddle.net> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Michael Walle <michael@walle.cc> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Leon Alrae <leon.alrae@imgtec.com> Cc: Anthony Green <green@moxielogic.com> Cc: Jia Liu <proljc@gmail.com> Cc: Alexander Graf <agraf@suse.de> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Cc: Max Filippov <jcmvbkbc@gmail.com> [AF: Fixed up cpu_copy() manually] Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-03-03Revert "Merge remote-tracking branch ↵Peter Maydell1-8/+1
'remotes/ehabkost/tags/x86-pull-request' into staging" This reverts commit b8a173b25c887a606681fc35a46702c164d5b2d0, reversing changes made to 5de090464f1ec5360c4f30faa01d8a9f8826cd58. (I applied this pull request when I should not have done so, and am now immediately reverting it.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-02-25linux-user: Check for cpu_init() errorsEduardo Habkost1-1/+8
This was the only caller of cpu_init() that was not checking for NULL yet. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-02-13linux-user: correct stat structure in MIPS N32Leon Alrae1-67/+19
Simple "hello world" MIPS N32 userland program crashes with segfault due to incorrectly defined stat structure in QEMU. Correct "target_stat" definition to match kernel's "stat64" as in MIPS N32 there are only plain "stat" syscalls using 64-bit structure. Reported-by: Daniel Sanders <daniel.sanders@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com> Tested-by: Daniel Sanders <daniel.sanders@imgtec.com> Reviewed-by: James Hogan <james.hogan@imgtec.com>
2015-02-10linux-user: wrong TARGET_SI_PAD_SIZE value for some targets.Maxim Ostapenko1-1/+8
Fix TARGET_SI_PAD_SIZE calculation to match the way the kernel does it. Use different TARGET_SI_PREAMBLE_SIZE for 32-bit and 64-bit targets. Signed-off-by: Maxim Ostapenko <m.ostapenko@partner.samsung.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-02-10linux-user/syscall.c: do_ioctl_dm: Need to call unlock_user() before going ↵Chen Gang S1-0/+2
to failure return in default case In abi_long do_ioctl_dm(), after lock_user() call, the code does not call unlock_user() before going to failure return in default case. Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-02-10linux-user/main.c: Use TARGET_SIG* instead of SIG*Chen Gang S1-32/+32
In main.c, all SIG* should be TARGET_SIG*, since the relevant functions (queue_signal() and gdb_handlesig()) expect TARGET_SIG*. The corresponding vi command is "1,$ s/\<SIG/TARGET_SIG/g". Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-02-10linux-user/syscall.c: Fix typo issue for using target_vec[i].iov_len instead ↵Chen Gang S1-1/+1
of target_vec[i].iov_base It is only a typo issue, need use tswapal(target_vec[i].iov_len) for the len. Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-02-10linux-user/syscall.c: lock_iovec: unlock vec[i] in failure processing code blockChen Gang S1-0/+5
When failure occurs during locking of vec[i], we also need to unlock all already locked vec[i] in failure processing code block before return. Code in unlock_user() checks vec[i].iov_base for NULL, so there's no need not check it . If error is EFAULT when "i == 0", vec[i].iov_base is NULL, we can just skip it, so can still use "while (--i >= 0)" loop condition. Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-01-27linux-user: support target-to-host SCM_CREDENTIALSAlex Suykov1-4/+14
When passing ancillary data through a unix socket, handle credentials properly instead of doing a simple copy and issuing a warning. Signed-off-by: Alex Suykov <alex.suykov@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user: Fix broken m68k signal handling on 64 bit hostsPeter Maydell1-3/+3
The m68k signal frame setup code which writes the signal return trampoline code to the stack was assuming that a 'long' was 32 bits; on 64 bit systems this meant we would end up writing the 32 bit (2 insn) trampoline sequence to retaddr+4,retaddr+6 instead of the intended retaddr+0,retaddr+2, resulting in a guest crash when it tried to execute the invalid zero-bytes at retaddr+0. Fix by using uint32_t instead; also use uint16_t rather than short for consistency. This fixes bug LP:1404690. Reported-by: Michel Boaventura Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27mips64-linux-user: Fix definition of struct sigaltstackEd Swierk1-1/+1
Without this fix, qemu segfaults when emulating the sigaltstack syscall, because it incorrectly treats the ss_flags field as 64 bits rather than 32 bits. Signed-off-by: Ed Swierk <eswierk@skyportsystems.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user: Fix ioctl cmd type mismatch on 64-bit targetsEd Swierk1-1/+1
linux-user passes the cmd argument of the ioctl syscall as a signed long, but compares it to an unsigned int when iterating through the ioctl_entries list. When the cmd is a large value like 0x80047476 (TARGET_TIOCSWINSZ on mips64) it gets sign-extended to 0xffffffff80047476, causing the comparison to fail and resulting in lots of spurious "Unsupported ioctl" errors. Changing the target_cmd field in the ioctl_entries list to a signed int causes those values to be sign-extended as well during the comparison. Signed-off-by: Ed Swierk <eswierk@skyportsystems.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user: translate resource also for prlimit64Felix Janda1-1/+2
The resource argument is translated from host to target for [gs]etprlimit but not for prlimit64. Fix this. Signed-off-by: Felix Janda <felix.janda@posteo.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_userPeter Maydell1-17/+11
The function copy_siginfo_to_user() just calls tswap_siginfo(), so call the latter function directly and delete the wrapper function. The wrapper is actually misleading since it implies that the semantics are like the kernel function with the same name which copies the data to a guest user-space address. In fact tswap_siginfo() just does data-structure conversion between two structures whose addresses are host addresses (the copy to userspace is handled in QEMU by the lock_user/unlock_user calls). This also fixes clang complaints about the wrapper being unused in some configs. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user/main.c: Mark end_exclusive() as possibly unusedPeter Maydell1-1/+1
The function end_exclusive() isn't used on all targets; mark it as such to avoid a clang warning. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user/main.c: Call cpu_exec_start/end on all target archsPeter Maydell1-0/+18
The start_exclusive() infrastructure is used on all target architectures, even if only to do the "stop all CPUs before dumping core" in force_sig(), so be consistent and call cpu_exec_start/end in the main loop of every target. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user/arm/nwfpe: Delete unused aCC arrayPeter Maydell1-22/+0
The aCC array in fpopcode.c is completely unused in QEMU; delete it (silencing a clang warning). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user/alpha: Add define for NR_shmat to enable shmat syscallPeter Maydell1-0/+4
For historical reasons, the define for the shmat() syscall on Alpha is NR_osf_shmat; however it has the same semantics as this syscall does on all other architectures, so define TARGET_NR_shmat as well so that QEMU's code for the syscall is enabled. This patch brings our behaviour on the LTP shmat tests into line with that for ARM (still not a perfect pass rate but not "this syscall is completely broken" as we had before). (Problem detected via a clang warning that the do_shmat() function was unused on Alpha.) Cc: Richard Henderson <rth@twiddle.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-27linux-user/signal.c: Remove current_exec_domain_sig()Peter Maydell1-25/+6
Remove the function current_exec_domain_sig(), which always returns its argument. This was intended as a stub for supporting the kernel's exec_domain handling, but: * we don't have any of the other code for execution domains * in the kernel this handling is architecture-specific, not generic * we only call this function in the x86, ppc and sh4 signal code paths, and the PPC one is wrong anyway because the PPC kernel doesn't have this signal-remapping code So it's best to simply delete the function; any future attempt to implement exec domains will be better served by adding the correct code from scratch based on the kernel sources at that time. This change also fixes some clang warnings about the function being defined but not used for some target architectures. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-01-20linux-user/main.c (m68k): Use get_user_u16 rather than lduw in cpu_loopPeter Maydell1-1/+1
In the m68k cpu_loop() use get_user_u16 to read the immediate for the simcall rahter than lduw, to bring it into line with how other archs do it and to remove another user of the ldl family of functions. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1421334118-3287-8-git-send-email-peter.maydell@linaro.org
2015-01-20linux-user/vm86.c: Use cpu_ldl_data &c rather than plain ldl &cPeter Maydell1-26/+31
Use the cpu_ld*_data and cpu_st*_data family of functions to access guest memory in vm86.c rather than the very short-named ldl/stl functions. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1421334118-3287-7-git-send-email-peter.maydell@linaro.org
2015-01-20linux-user/elfload.c: Don't use _raw accessor functionsPeter Maydell1-2/+5
The _raw accessor functions are an implementation detail that has leaked out to some callsites. Use get_user_u64() instead of ldq_raw(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1421334118-3287-5-git-send-email-peter.maydell@linaro.org
2015-01-20exec.c: Drop TARGET_HAS_ICE define and checksPeter Maydell1-4/+0
The TARGET_HAS_ICE #define is intended to indicate whether a target-* guest CPU implementation supports the breakpoint handling. However, all our guest CPUs have that support (the only two which do not define TARGET_HAS_ICE are unicore32 and openrisc, and in both those cases the bp support is present and the lack of the #define is just a bug). So remove the #define entirely: all new guest CPU support should include breakpoint handling as part of the basic implementation. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Message-id: 1420484960-32365-1-git-send-email-peter.maydell@linaro.org
2014-12-16linux-user: Use the 5KEf processor for 64-bit emulationMaciej W. Rozycki1-1/+1
Replace the 20Kc original MIPS64 ISA processor used for 64-bit user emulation with the 5KEf processor that implements the MIPS64r2 ISA, complementing the choice of the 24Kf processor for 32-bit emulation. Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>