aboutsummaryrefslogtreecommitdiffstats
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2010-10-03Replace most gcc format attributes by macro GCC_FMT_ATTR (format checking)Stefan Weil1-1/+1
Since version 4.4.x, gcc supports additional format attributes. __attribute__ ((format (gnu_printf, 1, 2))) should be used instead of __attribute__ ((format (printf, 1, 2)) because QEMU always uses standard format strings (even with mingw32). The patch replaces format attribute printf / __printf__ by macro GCC_FMT_ATTR which uses gnu_printf if supported. It also removes an #ifdef __GNUC__ (not needed any longer). Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18linux-user: improve flatload error checkingBlue Swirl1-1/+2
Because of the use of unsigned type, possible errors during load were ignored. Fix by using a signed type. This also avoids a warning with GCC flag -Wtype-limits. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18linux-user: fix types in a comparisonBlue Swirl1-1/+1
-1ul is unsigned long, which does not necessarily match abi_ulong type. Fix by using abi_long instead. This also avoids a warning with GCC flag -Wtype-limits. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18linux-user: fix socklen_t comparisonsBlue Swirl1-7/+13
On many systems, socklen_t is defined as unsigned. This means that checks for negative values are not meaningful. Fix by explicitly casting to a signed integer. This also avoids some warnings with GCC flag -Wtype-limits. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-09microblaze: User-mode emulation of hw-excp signalsEdgar E. Iglesias1-0/+31
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-08-09microblaze: Fix the target version of stat64 structEdgar E. Iglesias1-6/+8
MicroBlaze needs TARGET_STAT64_HAS_BROKEN_ST_INO. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
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.
2010-07-29linux-user: Protect against allocation failure in load_symbols.Richard Henderson1-0/+10
Cc: malc <av1474@comtv.ru> Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: malc <av1474@comtv.ru>
2010-07-29linux-user: Re-use load_elf_image for the main binary.Richard Henderson1-277/+103
This requires moving the PT_INTERP extraction and GUEST_BASE handling into load_elf_image. Key this off a non-null pointer argument to receive the interpreter name. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Extract load_elf_image from load_elf_interp.Richard Henderson1-174/+167
Moving toward a single copy of the elf binary loading code. Fill in the details of the loaded image into a struct image_info. Adjust create_elf_tables to read from such structures instead of from a collection of passed arguments. Don't return error values from load_elf_interp; always exit(-1) with a message to stderr. Collect elf_interpreter handling in load_elf_binary to a common spot. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Remove partial support for a.out interpreters.Richard Henderson1-70/+9
At the bottom of the a.out support was the unimplemented load_aout_interp function. There were other portions of the support that didn't look right; when I went to look in the Linux kernel for clarification, I found that the support for such interpreters has been removed from binfmt_elf. There doesn't seem to be any reason to keep this broken support in qemu. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Put the stack guard page at the top.Richard Henderson1-14/+17
There are no supported stack-grows-up targets. We were putting the guard page at the highest address, i.e. the bottom of the stack. Use the maximum of host and guest page size for the guard size. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Improve consistency checking in elf headers.Richard Henderson1-24/+33
Validate more fields of the elf header. Extract those checks into two common functions to be used in both load_elf_interp and load_elf_binary. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Load symbols from the interpreter.Richard Henderson1-88/+101
First, adjust load_symbols to accept a load_bias parameter. At the same time, read the entire section header table in one go, use pread instead f lseek+read for the symbol and string tables, and properly free allocated structures on error exit paths. Second, adjust load_elf_interp to compute load_bias. This requires finding out the built-in load addresses. Which allows us to honor a pre-linked interpreter image when possible, and eliminate the hard-coded INTERP_MAP_SIZE value. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Clean up byte-swapping in elfload.c.Richard Henderson1-71/+48
Remove ifdefs from code by defining empty inline functions when byte swapping isn't needed. Push loops over swapping arrays of structures into the swapping functions. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Define ELF_DATA generically.Richard Henderson1-24/+6
The only consideration on this value is the target endianness. The existing defines were incorrect for alpha and sh4eb. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Reduce lseek+reads while loading elf files.Richard Henderson3-71/+57
Define BPRM_BUF_SIZE to 1k and read that amount initially. If the data we want from the binary is in this buffer, use it instead of reading from the file again. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Reindent elfload.c.Richard Henderson1-510/+518
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29Add more DT_* and AT_* constants to qemu's copy of elf.h.Richard Henderson1-9/+0
Moving some PPC AT_* constants from elfload.c at the same time. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-29linux-user: Handle filesz < memsz for any PT_LOAD segment.Richard Henderson1-97/+55
I caught padzero not properly initializing the .bss segment on a statically linked Alpha program. Rather than a minimal patch, replace the gross code with a single mmap+memset. Share more code between load_elf_interp and load_elf_binary. Legally, an ELF program need not have just a single .bss; and PT_LOAD segment can have memsz > filesz. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
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>