summaryrefslogtreecommitdiffstats
path: root/linux-user
Commit message (Collapse)AuthorAgeFilesLines
* linux-user: support target-to-host SCM_CREDENTIALSAlex Suykov2015-01-271-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>
* linux-user: Fix broken m68k signal handling on 64 bit hostsPeter Maydell2015-01-271-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>
* mips64-linux-user: Fix definition of struct sigaltstackEd Swierk2015-01-271-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>
* linux-user: Fix ioctl cmd type mismatch on 64-bit targetsEd Swierk2015-01-271-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>
* linux-user: translate resource also for prlimit64Felix Janda2015-01-271-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>
* linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_userPeter Maydell2015-01-271-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>
* linux-user/main.c: Mark end_exclusive() as possibly unusedPeter Maydell2015-01-271-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>
* linux-user/main.c: Call cpu_exec_start/end on all target archsPeter Maydell2015-01-271-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>
* linux-user/arm/nwfpe: Delete unused aCC arrayPeter Maydell2015-01-271-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>
* linux-user/alpha: Add define for NR_shmat to enable shmat syscallPeter Maydell2015-01-271-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>
* linux-user/signal.c: Remove current_exec_domain_sig()Peter Maydell2015-01-271-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>
* linux-user/main.c (m68k): Use get_user_u16 rather than lduw in cpu_loopPeter Maydell2015-01-201-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
* linux-user/vm86.c: Use cpu_ldl_data &c rather than plain ldl &cPeter Maydell2015-01-201-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
* linux-user/elfload.c: Don't use _raw accessor functionsPeter Maydell2015-01-201-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
* exec.c: Drop TARGET_HAS_ICE define and checksPeter Maydell2015-01-201-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
* linux-user: Use the 5KEf processor for 64-bit emulationMaciej W. Rozycki2014-12-161-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>
* target-arm: make c13 cp regs banked (FCSEIDR, ...)Fabian Aggeler2014-12-113-3/+3
| | | | | | | | | | | | When EL3 is running in AArch32 (or ARMv7 with Security Extensions) FCSEIDR, CONTEXTIDR, TPIDRURW, TPIDRURO and TPIDRPRW have a secure and a non-secure instance. Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch> Signed-off-by: Greg Bellows <greg.bellows@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1416242878-876-25-git-send-email-greg.bellows@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Fix up timer id handlingAlexander Graf2014-11-112-21/+38
| | | | | | | | | | | | | | | | | | | | | | When creating a timer handle, we give the timer id a special magic offset of 0xcafe0000. However, we never mask that offset out of the timer id before we start using it to dereference our timer array. So we always end up aborting timer operations because the timer id is out of bounds. This was not an issue before my patch e52a99f756e ("linux-user: Simplify timerid checks on g_posix_timers range") because before we would blindly mask anything above the first 16 bits. This patch simplifies the code around timer id creation by introducing a proper target_timer_id typedef that is s32, just like Linux has it. It also changes the magic offset to a value that makes all timer ids be positive. Reported-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Tom Musta <tommusta@gmail.com> Tested-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Do not subtract offset from end addressTom Musta2014-11-111-1/+1
| | | | | | | | | When computing the upper address of a program segment, do not subtract the offset from the virtual address; instead compute the sum of the virtual address and the memory size. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* elf: take phdr offset into account when calculating the program load addressJonas Maebe2014-11-031-1/+1
| | | | | | | | The first program header does not necessarily start at offset 0. This change corresponds to what the Linux kernel does in load_elf_binary(). Signed-off-by: Jonas Maebe <jonas.maebe@elis.ugent.be> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Fix fault address truncation AArch64Riku Voipio2014-11-031-3/+1
| | | | | | | | | | | | On AArch64 the si_addr field of siginfo_t is truncated to 32 bits because the fault address passes through an uint32_t variable. Follow Peters suggestion and drop the uint32_t variable since its only used once in the Aarch64 loop. Reported-by: Amanieu d'Antras <amanieu@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Let user specify random seedMagnus Reftel2014-11-032-1/+19
| | | | | | | | | | This patch introduces the -seed command line option and the QEMU_RAND_SEED environment variable for setting the random seed, which is used for the AT_RANDOM ELF aux entry. Signed-off-by: Magnus Reftel <reftel@spotify.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* translate-all.c: memory walker initial address miscalculationMikhail Ilyin2014-10-061-9/+9
| | | | | | | | | | | | The initial base address is miscalculated in walk_memory_regions(). It has to be shifted TARGET_PAGE_BITS more. Holder variables are extended to target_ulong size otherwise they don't fit for MIPS N32 (a 32-bit ABI with a 64-bit address space) and qemu won't compile. The issue led to incorrect debug output of memory maps and a mis-formed coredumped file. Signed-off-by: Mikhail Ilyin <m.ilin@samsung.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: don't include timerfd if not neededRiku Voipio2014-10-061-1/+3
| | | | | | | | | | Without this, builds on older systems fail with: qemu/linux-user/syscall.c:61:25: warning: sys/timerfd.h: No such file or directory v2: fix the usual case where CONFIG_TIMERFD is enabled.. Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Simplify timerid checks on g_posix_timers rangeAlexander Graf2014-10-061-13/+17
| | | | | | | | | | | | | | | We check whether the passed in timer id is negative on all calls that involve g_posix_timers. However, these checks are bogus. First off we limit the timer_id to 16 bits which is not what Linux does. Then we check whether it's negative which it can't be because we masked it. We can safely remove the masking. For the negativity check we can just treat the timerid as unsigned and only check for upper boundaries. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Convert blkpg to use a special subop handlerAlexander Graf2014-10-063-2/+56
| | | | | | | | | | | The blkpg ioctl can take different payloads depending on the opcode in its payload structure. Create a new special ioctl handler that can only deal with partition style ones for now. This patch fixes running parted for me. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Enable epoll_pwait syscall for ARMPeter Maydell2014-10-061-1/+1
| | | | | | | | | | We have support for the epoll_pwait syscall, but it wasn't enabled for ARM guests because we hadn't defined the syscall number; correct this deficiency. Reported-by: Dave Flogeras <dflogeras2@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* exec.c: Relax restrictions on watchpoint length and alignmentPeter Maydell2014-09-121-2/+1
| | | | | | | | | | | The current implementation of watchpoints requires that they have a power of 2 length which is not greater than TARGET_PAGE_SIZE and that their address is a multiple of their length. Watchpoints on ARM don't fit these restrictions, so change the implementation so they can be relaxed. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
* linux-user: Handle PPC64 ELFv2 Function PointersTom Musta2014-09-081-10/+30
| | | | | | | | | | | | Function pointers in the 64-bit ELFv2 PowerPC ABI are actual (internal) entry point addresses. However, when invoking a function via a function pointer, GPR 12 must also be set to this address so that the TOC may be handled properly. Add this support to the invocation of a signal handler. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* linux-user: Implement do_setcontext for PPC64Tom Musta2014-09-081-5/+5
| | | | | | | | | Eliminate the stub for the do_setcontext() function for TARGET_PPC64. The implementation re-uses the existing TARGET_PPC32 code with the only change being the computation of the address of the register save area. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* linux-user: Properly Dereference PPC64 ELFv1 Signal Handler PointerTom Musta2014-09-081-0/+29
| | | | | | | | | | Properly dereference 64-bit PPC ELF V1 ABIT function pointers to signal handlers. On this platform, function pointers are pointers to structures and the first 64 bits of such a structure contains the function's entry point. The second 64 bits contains the TOC pointer, which must be placed into GPR 2. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* linux-user: Enable Signal Handlers on PPC64Tom Musta2014-09-081-48/+73
| | | | | | | | | | | | | | | | | | | | | | | | Enable the 64-bit PowerPC signal handling code that was previously disabled via #ifdefs. Specifically: - Move the target_mcontext (register save area) structure and append it to the 64-bit target_sigcontext structure. This provides the space on the stack for saving and restoring context. - Define the target_rt_sigframe for 64-bit. - Adjust the setup_frame and setup_rt_frame routines to properly select the target_mcontext area and trampoline within the stack frame; tthis is different for 32-bit and 64-bit implementations. - Adjust the do_setcontext stub for 64-bit so that it compiles without warnings. The 64-bit signal handling code is still not functional after this change; but the 32-bit code is. Subsequent changes will address specific issues with the 64-bit code. Signed-off-by: Tom Musta <tommusta@gmail.com> [agraf: fix build on 32bit hosts, ppc64abi32] Signed-off-by: Alexander Graf <agraf@suse.de>
* linux-user: Split PPC Trampoline Encoding from Register SaveTom Musta2014-09-081-6/+12
| | | | | | | | | | Split the encoding of the PowerPC sigreturn trampoline from the saving of register state onto the signal handler stack. This will make it easier in subsequent patches to deal with variations in the stack frame layouts between 32 and 64 bit PowerPC. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* linux-user: Fix Stack Pointer Bug in PPC setup_rt_frameTom Musta2014-09-081-1/+1
| | | | | | | | | | | | | | The code that sets the stack frame back pointer is incorrect for the setup_rt_frame() code; qemu will abort (SIGSEGV) in some environments. The setup_frame code was fixed in commit beb526b12134a6b6744125deec5a7fe24a8f92e3 but the setup_rt_frame code was not. Make the setup_rt_frame code consistent with the setup_frame code. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* linux-user: fix file descriptor leakszhanghailiang2014-08-241-0/+1
| | | | | | | | Handle variable "fd_orig" going out of scope leaks the handle. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* linux-user: check return value of malloc()zhanghailiang2014-08-221-0/+4
| | | | | | Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: writev Partial WritesTom Musta2014-08-221-2/+14
| | | | | | | | | | | Although not technically not required by POSIX, the writev system call will typically write out its buffers individually. That is, if the first buffer is written successfully, but the second buffer pointer is invalid, then the first chuck will be written and its size is returned. Signed-off-by: Tom Musta <tommusta@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Support target-to-host translation of mlockall argumentTom Musta2014-08-2218-1/+50
| | | | | | | | | | | | | The argument to the mlockall system call is not necessarily the same on all platforms and thus may require translation prior to passing to the host. For example, PowerPC 64 bit platforms define values for MCL_CURRENT (0x2000) and MCL_FUTURE (0x4000) which are different from Intel platforms (0x1 and 0x2, respectively) Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: clock_nanosleep errno Handling on PPCTom Musta2014-08-221-0/+8
| | | | | | | | | | | | | | The clock_nanosleep syscall is unusual in that it returns positive numbers in error handling situations, versus returning -1 and setting errno, or returning a negative errno value. On POWER, the kernel will set the SO bit of CR0 to indicate failure in a syscall. QEMU has generic handling to do this for syscalls with standard return values. Add special case code for clock_nanosleep to handle CR0 properly. Signed-off-by: Tom Musta <tommusta@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Minimum Sig Handler Stack Size for PPC64 ELF V2Tom Musta2014-08-2218-1/+34
| | | | | | | | The ELF V2 ABI for PPC64 defines MINSIGSTKSZ as 4096 bytes whereas it was 2048 previously. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Move get_ppc64_abiTom Musta2014-08-222-9/+10
| | | | | | | | | | The get_ppc64_abi is used to determine the ELF ABI (i.e. V1 or V2). This routine is currently implemented in the linux-user/elfload.c file but is useful in other scenarios. Move the routine to a more generally available location (linux-user/ppc/target_cpu.h). Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Detect fault in sched_rr_get_intervalTom Musta2014-08-221-1/+1
| | | | | | | | | Properly detect a fault when attempting to store into an invalid struct timespec pointer. Signed-off-by: Tom Musta <tommusta@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Handle NULL sched_param argument to sched_*Tom Musta2014-08-221-0/+10
| | | | | | | | | The sched_getparam, sched_setparam and sched_setscheduler system calls take a pointer argument to a sched_param structure. When this pointer is null, errno should be set to EINVAL. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Detect Negative Message Sizes in msgsnd System CallTom Musta2014-08-221-1/+5
| | | | | | | | | | The msgsnd system call takes an argument that describes the message size (msgsz) and is of type size_t. The system call should set errno to EINVAL in the event that a negative message size is passed. Signed-off-by: Tom Musta <tommusta@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Conditionally Pass Attribute Pointer to mq_open()Tom Musta2014-08-221-3/+7
| | | | | | | | | | | | | | The mq_open system call takes an optional struct mq_attr pointer argument in the fourth position. This pointer is used when O_CREAT is specified in the flags (second) argument. It may be NULL, in which case the queue is created with implementation defined attributes. Change the code to properly handle the case when NULL is passed in the arg4 position. Signed-off-by: Tom Musta <tommusta@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Make ipc syscall's third argument an abi_longTom Musta2014-08-221-4/+4
| | | | | | | | | | | | | | For those target ABIs that use the ipc system call (e.g. POWER), the third argument is used in the shmat path as a pointer. It therefore must be declared as an abi_long (versus int) so that the address bits are not lost in truncation. In fact, all arguments to do_ipc should be declared as abit_long. In fact, it makes more sense for all of the arguments to be declaried as abi_long (except call). Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Properly Handle semun Structure In Cross-Endian SituationsTom Musta2014-08-221-2/+11
| | | | | | | | | | | | | | | | The semun union used in the semctl system call contains both an int (val) and pointers. In cross-endian situations on 64 bit targets, the value passed to semctl is an 8 byte (abi_long) value and thus does not have the 4-byte val field in the correct location. In order to rectify this, the other half of the union must be accessed. This is achieved in code by performing a byte swap on the entire 8 byte union, followed by a 4-byte swap of the first half. Also, eliminate an extraneous (dead) line of code that sets target_su.val in the IPC_SET/IPC_GET case. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Dereference Pointer Argument to ipc/semctl Sys CallTom Musta2014-08-221-2/+8
| | | | | | | | | | When the ipc system call is used to wrap a semctl system call, the ptr argument to ipc needs to be dereferenced prior to passing it to the semctl handler. This is because the fourth argument to semctl is a union and not a pointer to a union. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: PPC64 semid_ds Doesnt Include _unused1 and _unused2Tom Musta2014-08-221-0/+4
| | | | | | | | | The 64 bit PowerPC platforms eliminate the _unused1 and _unused2 elements of the semid_ds structure from <sys/sem.h>. So eliminate these from the target_semid_ds structure. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: add setns and unshareRiku Voipio2014-08-222-0/+14
| | | | | | | | Add support for the setns and unshare syscalls, trivially passed through to the host. Based on patches by Paul Burton, added configure check. Signed-off-by: Paul Burton <paul@archlinuxmips.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
OpenPOWER on IntegriCloud