summaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2010-07-30linux-user: fix build on hosts not using guest baseAurelien Jarno1-7/+7
Commit 68a1c816868b3e35a1da698af412b29e61b1948a broke qemu on hosts not using guest base. It uses reserved_va unconditionally in mmap.c. To avoid to many #ifdef #endif blocks, define RESERVED_VA as either reserved_va or 0ul, and use it instead of reserved_va, similarly to what has been done with guest_base/GUEST_BASE. (cherry picked from commit 18e9ea8a3f36b0a3845e1ac6d8acd180063bed8f)
2010-07-23microblaze: Pass a ucontext * as 3rd sighandler argEdgar E. Iglesias1-6/+20
There is disagreement between microblaze glibc and the kernel to what the third arg of signal handlers should point to. Change QEMU linux-user to match the kernel port. glibc patches are pending. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-07-22linux-user: display cpu list.Laurent Vivier1-0/+2
As it is done for qemu-system with "-cpu ?", when cpu_list_id() is missing for a target, call cpu_list() instead. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-15microblaze: Correct signal frame setup.Edgar E. Iglesias1-1/+2
Pass the context in r7. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-06-16Usermode exec-stack fixPaul Brook4-0/+14
When loading a shared library that requires an executable stack, glibc uses the mprotext PROT_GROWSDOWN flag to achieve this. We don't support PROT_GROWSDOWN. Add a special case to handle changing the stack permissions in this way. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-06-16Strace mprotect flags.Paul Brook2-0/+9
Teach strace code about linux specific mprotect flags. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-06-11s390x: Avoid _llseek.Richard Henderson1-2/+2
There's no _llseek on s390x either. Replace the existing test for __x86_64__ with a functional test for __NR_llseek. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-10rename CONFIG_QEMU_PREFIXPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-09linux-user: honor low bit of entry PC for MIPSNathan Froyd1-1/+4
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-29Pre-allocate guest address spacePaul Brook3-7/+178
Allow pre-allocation of the guest virtual address space in usermode emulation. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-05-28alpha-linux-user: Fill in SI_CODE for SIGSEGV.Richard Henderson1-1/+2
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28linux-user: Use qemu-malloc.c.Richard Henderson1-52/+0
Since we're no longer setting PAGE_RESERVED, there's no need to implement qemu_malloc via mmap. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28linux-user: Fix compilation with DEBUG definedRiccardo Magliocchetti1-1/+1
Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21linux-user: do not warn for missing pselect6Riku Voipio1-0/+4
Libc will fallback gracefully if pselect6 is not available. Thus put pselect6 to nowarn until the atomicity issues of the original pselect6 patch are dealt with. Signed-off-by: Riku Voipio <riku.voipio@nokia.com> Cc: Michael Casadevall <mcasadevall@ubuntu.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21tcg: Initialize the prologue after GUEST_BASE is fixed.Richard Henderson1-1/+8
This will allow backends to make intelligent choices about how to implement GUEST_BASE. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21alpha-linux-user: Fix sigprocmask.Richard Henderson2-5/+43
Alpha passes oldset by value in a register, and returns the newset as the return value; as compared to the standard implementation in which both are passed by reference. This requires being able to distinguish negative return values that are not errors. Do this in the same way as the Alpha Linux kernel, by storing a zero in V0 in the implementation of the syscall. At the same time, fix a think-o in the regular sigprocmask path in which we passed the target, rather than the host, HOW value. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21alpha-linux-user: Fix sigsuspend parameters.Richard Henderson1-0/+5
Alpha passes the signal set in a register, not by reference. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21alpha-linux-user: Fix getxpid.Richard Henderson1-3/+8
Put ppid in the second return register. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21alpha-linux-user: Fix pipe return mechanism.Richard Henderson1-12/+18
At the same time, tidy the code wrt MIPS and SH4 which have the same two register return mechanism. Fix confusion between pipe and pipe2 with an explicit flags=0, when the guest will not be using the two register return mechanism. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21alpha-linux-user: Add correct sigaction constants.Richard Henderson1-0/+8
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21alpha-linux-user: Fix siginfo.si_addr for SIGSEGV and SIGBUS.Richard Henderson1-2/+2
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-21alpha-linux-user: Fix brk error return.Richard Henderson1-2/+10
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-19linux-user: fix 32-bit host breakageAurelien Jarno1-1/+1
Fix breakage introduced by commit 81bbe906c89b6b7af58a1eeb96ec5a0bfdc3386f. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-19microblaze: Update elf machine nums.Edgar E. Iglesias1-2/+2
189 was allocated in upstream binutils. 0xbaab was the old temporary value. Still used by some tools and the linux kernel. I've seen 115 in older gdb versions, but lets ignore that one. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-05-19microblaze: Add linux-user core dumping support.Edgar E. Iglesias1-0/+18
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-05-18linux-user: rlimit conversion between host and target.takasi-y@ops.dti.ne.jp3-9/+32
rlim_t conversion between host and target added. Otherwise there are some incorrect case like - RLIM_INFINITY on 32bit target -> 64bit host. - RLIM_INFINITY on 64bit host -> mips and sparc target ? - Big value(for 32bit target) on 64bit host -> 32bit target. One is added into getrlimit, setrlimit, and ugetrlimit. It converts both RLIM_INFINITY and value bigger than target can hold(>31bit) to RLIM_INFINITY. Another one is added to guest_stack_size calculation introduced by 703e0e89. The rule is mostly same except the result on the case is keeping the value of guest_stack_size. Slightly tested for SH4, and x86_64 -linux-user on x86_64-pc-linux host. Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp> Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-09sparc: Fix lazy flag calculation on interrupts, refactorBlue Swirl1-2/+2
Recalculate Sparc64 CPU flags on interrupts, otherwise some earlier flags could be stored to pstate. Refactor PSR/CCR/CWP handling: concentrate the actual functions to op_helper.c. Thanks to Igor Kovalenko for reporting. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-05Better default guest_basePaul Brook1-6/+67
Avoid loading linux-user applications in address space already used/reserved by the host. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-05-05Remove PAGE_RESERVEDPaul Brook2-25/+0
The usermode PAGE_RESERVED code is not required by the current mmap implementation, and is already broken when guest_base != 0. Unfortunately the bsd emulation still uses the old mmap implementation, so we can't rip it out altogether. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-04-27target-alpha: Fix load-locked/store-conditional.Richard Henderson1-0/+55
Use an exception plus start_exclusive to implement the compare-and-swap. This follows the example set by the MIPS and PPC ports. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27target-alpha: Enable NPTL.Richard Henderson1-1/+1
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27target-alpha: Implement rs/rc properly.Richard Henderson1-1/+6
This is a per-cpu flag; there's no need for a spinlock of any kind. We were also failing to manipulate the flag with $31 as a target reg and failing to clear the flag on execution of a return-from-interrupt instruction. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-26linux-user: Fix sparc32plus stat64 syscalls.Richard Henderson1-1/+1
Check TARGET_ABI_BITS, not TARGET_LONG_BITS, when deciding whether or not the guest needs special 64-bit stat translation. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-25linux-user: Fix Sparc64 syscall returns.Richard Henderson1-2/+3
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-25linux-user: Remove ELFLOAD32.Richard Henderson3-40/+1
The ABI-specific types used by linux_binprm and image_info are different after forcing TARGET_ABI32 on. Which means that the parameters that load_elf_binary_multi sees are not those that loader_exec passed. This is inherently broken and is more trouble than it's worth fixing. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-14linux-user: do_shmdt(): Fix page_set_flags's 2nd arg.takasi-y@ops.dti.ne.jp1-1/+1
2nd arg of page_set_flags() should be start+size, but size. Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp> Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-08linux-user: switch default ppc64 CPU to 970fx from 970Aurelien Jarno1-1/+1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-01Fix compilation with missing inotify_init1Stefan Weil1-0/+2
Commit c05c7a7306a23a4b01d1606172b142c45caffc92 breaks cross compilation for mips (and other compilations without CONFIG_INOTIFY1): make[1]: Entering directory `/qemu/bin/mips' CC i386-linux-user/syscall.o cc1: warnings being treated as errors /qemu/linux-user/syscall.c: In function ‘do_syscall’: /qemu/linux-user/syscall.c:7067: error: implicit declaration of function ‘sys_inotify_init1’ Cc: Riku Voipio <riku.voipio@nokia.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-01linux-user/ia64: workaround ia64 strangenessesAurelien Jarno2-105/+109
ia64 has some strangenesses that need to be workaround: - it has a __clone2() syscall instead of the using clone() one, with different arguments, and which is not declared in the usual headers. - ucontext.uc_sigmask is declared with type long int, while it is actually of type sigset_t. - uc_mcontext, uc_sigmask, uc_stack, uc_link are declared using #define, which clashes with the target_ucontext fields. Change their names to tuc_*, as already done for some target architectures.
2010-03-29Compile qemu-timer only onceBlue Swirl1-1/+1
Arrange various declarations so that also non-CPU code can access them, adjust users. Move CPU specific code to cpus.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-28linux-user/ppc: use the Linux register layoutRob Landley1-21/+2
The dynamic linker converts the Linux layout to the AIX layout and is reentrant so it won't do it a second time if it's already been converted. In short it work just fine with either register layout. OTOH, statically linked binaries expect a Linux layout. Remove code converting the Linux layout to AIX layout so that all binaries are presented the Linux Layout. Signed-off-by: Rob Landley <rob@landley.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-27linux-user: Use RLIMIT_STACK for default stack size.Richard Henderson3-8/+19
The current default stack limit of 512kB is far too small; a fair number of gcc testsuite failures (for all guests) are directly attributable to this. Using the -s option in every invocation of the emulator is annoying to say the least. A reasonable compromise seems to be to honor the system rlimit. At least on two Linux distributions, this is set to 8MB and 10MB respectively. If the system does not limit the stack, then we're no worse off than before. At the same time, rename the variable from x86_stack_size and change the ultimate fallback size from 512kB to 8MB. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-26linux-user: Add the syscall id for pselect6 on ARMMichael Casadevall1-1/+1
As this is now supported in newer linux kernels. Signed-off-by: Michael Casadevall <mcasadevall@ubuntu.com> Signed-off-by: Riku Voipio <riku.voipio@nokia.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-26linux-user: add inotify_init1 syscall supportRiku Voipio1-0/+14
New syscall which gets actively used when you have a fresh kernel. Signed-off-by: Riku Voipio <riku.voipio@nokia.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-18Replace assert(0) with abort() or cpu_abort()Blue Swirl1-1/+0
When building with -DNDEBUG, assert(0) will not stop execution so it must not be used for abnormal termination. Use cpu_abort() when in CPU context, abort() otherwise. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-13Fix build with -DNDEBUG in CFLAGSBlue Swirl1-1/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-12Fix usermode virtual address typePaul Brook2-3/+3
Usermode virtual addresses are abi_ulong, not target_ulong. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-03-12linux-user: Fix mmap_find_vma returning invalid addresses.Richard Henderson3-33/+82
Don't return addresses that aren't properly aligned for the guest, e.g. when the guest has a larger page size than the host. Don't return addresses that are outside the virtual address space for the target, by paying proper attention to the h2g/g2h macros. At the same time, place the default mapping base for 64-bit guests (on 64-bit hosts) outside the low 4G. Consistently interpret mmap_next_start in the guest address space. Signed-off-by: Richard Henderson <rth@twiddle.net>
2010-03-12linux-user: Use h2g_valid in qemu_vmalloc.Richard Henderson1-5/+4
Signed-off-by: Richard Henderson <rth@twiddle.net>
2010-03-07Update to a hopefully more future proof FSF addressBlue Swirl12-24/+12
See also 8167ee883931cb20c6264fc19d040ce2dc6ceaaa, 530e7615ce3c01882e582c84dc6304ab98a3d5c5 and fad6cb1a565bb73f83fc0e2654489457b489e436. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>