target-alpha: Rationalize internal processor registers.
Delete all the code that tried to emulate the real IPRs of someunnamed CPU. Replace those with just 3 slots that we can use tocommunicate trap information between the helper functions thatsignal exceptions and the OS trap handler....
Merge branch 's390-next' of git://repo.or.cz/qemu/agraf
Delete unused tb_invalidate_page_range
tb_invalidate_page_range() was intended to be used to invalidate anarea of a TB which the guest explicitly flushes from i-cache. However,QEMU detects writes to code areas where TBs have been generated, sohis has never been useful....
s390x: s390x-linux-user support
This patch adds support for running s390x binaries in the linux-user emulationcode.
Signed-off-by: Ulrich Hecht <uli@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
linux-user: Replace deprecated function
Function bzero is deprecated, so replace it by function memset.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Fix spelling in comments (intruction -> instruction)
Fix typos in comments (neccessary -> necessary)
Fix typo in comment (truely -> truly)
Fix typo in comment (dieing -> dying)
linux-user: Fix compilation for "old" linux versions
Debian Lenny and other installations with older linux versionsfailed to compile linux-user because some CLONE_xxx macros areundefined.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Fix buffer overrun in sched_getaffinity
Zeroing of the cpu array should start from &cpus[kernel_ret]not &cpus[num_zeros_to_fill].
This fixes a crash in EFL's edje_cc running under qemu-arm.
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
Don't zero out buffer in sched_getaffinity
The kernel doesn't fill the buffer provided to sched_getaffinitywith zero bytes, so neither should QEMU.
linux-user: add ioctl(SIOCGIWNAME, ...) support.
Allow to run properly following program from linux-user:
/* cc -o wifi wifi.c */
#include <stdio.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <linux/wireless.h> #include <netinet/in.h>...
linux-user: add s390x to llseek list
We keep a list of host architectures that do llseek with the samesyscall as lseek. S390x is one of them, so let's add it to the list.
Original-patch-by: Ulrich Hecht <uli@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>...
linux-user: untie syscalls from UID16
Quite a number of uid/gid related syscalls are only defined on systemswith USE_UID16 defined. This is apperently based on the idea that thesesystem calls would never be called on non-UID16 systems. Make thesesyscalls available for all architectures that define them....
[v2] linux-user: bigger default stack
PTHREAD_STACK_MIN (16KB) is somewhat inadequate for a new stack for newQEMU threads. Set new limit to 256K which should be enough, yet doesn'tincrease memory pressure significantly.
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>...
linux-user: improve traces
Add trace details for getpid(), kill(), _llseek(), rt_sigaction(),rt_sigprocmask(), clone().
Signed-off-by: Laurent Vivier <laurent@vivier.eu>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: convert ioctl(SIOCGIFCONF, ...) result.
The result needs to be converted as it is stored in an array of structifreq and sizeof(struct ifreq) differs according to target and hostalignment rules.
This patch allows to execute correctly the following program on arm...
linux-user/arm/nwfpe: rename REG_PC to ARM_REG_PC
The REG_PC constant used in the ARM nwfpe code is fine in the kernelbut when used in qemu can clash with a definition in the host systeminclude files (in particular on Ubuntu Lucid SPARC, including signal.h...
softfloat: rename float*_eq() into float*_eq_quiet()
float*_eq functions have a different semantics than other comparisonfunctions. Fix that by first renaming float*_quiet() into float*_eq_quiet().
Note that it is purely mechanical, and the behaviour should be unchanged....
unicore32: necessary modifications for other files to support unicore32
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
unicore32: add necessry headers in linux-user/unicore32 for unicore32 support
microblaze: Correct ec mask in debug print
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
linux-user: Fix unlock_user() call in return from poll()
Correct the broken attempt to calculate the third argumentto unlock_user() in the code path which unlocked the pollfdarray on return from poll() and ppoll() emulation. (Thisonly caused a problem if unlock_user() wasn't a no-op, eg...
linux-user: Fix large seeks by 32 bit guest on 64 bit host
When emulating a 32 bit Linux user-mode program on a 64 bit targetwe implement the llseek syscall in terms of lseek. Correct a bugwhich meant we were silently casting the result of host lseek()...
linux-user: fix compile failure if !CONFIG_USE_GUEST_BASE
If CONFIG_USE_GUEST_BASE is not defined, gcc complains: linux-user/mmap.c:235: error: comparison of unsigned expression >= 0 is always true
because RESERVED_VA is #defined to 0. Since mmap_find_vma_reserved()...
linux-user: add rmdir() strace
Signed-off-by: Laurent Vivier <laurent@vivier.eu>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: in linux-user/strace.c, tswap() is useless
Syscall parameters are already swapped by the caller.
This patch removes useless tswap() from strace.c
$ QEMU_STRACE=1 chroot /m68k mknod myramdisk b 1 1with tswap()...29944 mknod("myramdisk",026630200000) = 0...
linux-user: Support the epoll syscalls
Support the epoll family of syscalls: epoll_create(), epoll_create1(),epoll_ctl(), epoll_wait() and epoll_pwait(). Note that epoll_create1()and epoll_pwait() are later additions, so we have to test separatelyin configure for their presence....
linux-user: correct core dump format
This patch allows to really use the core dumped by qemu with guestarchitecture tools.
- it adds a missing bswap_phdr() for the program headers of memory regions.
"objdump -x" sample:
BEFORE:
0x1000000 off 0x00200000 vaddr 0x00000400 paddr 0x00000000 align 2**21...
linux-user/arm: fix compilation failures using softfloat's struct types
Add uses of the float32/float64 boxing and unboxing macros so thatthe ARM linux-user targets will compile with USE_SOFTFLOAT_STRUCT_TYPESenabled.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user/elfload: add FDPIC support
Signed-off-by: Mike Frysinger <vapier@gentoo.org>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: add ppoll syscall support
Some architectures (like Blackfin) only implement ppoll (and skip poll).So add support for it using existing poll code.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Mike Frysinger <vapier@gentoo.org>...
linux-user: decode MAP_{UNINITIALIZED,EXECUTABLE} in strace
linux-user/FLAT: fix auto-stack sizing
The current auto-stack sizing works like it does on a NOMMU system; theproblem is that this only works if the envp/argv arrays are fairly slim.On a desktop system, this is rarely the case, and can easily blow past...
linux-user/FLAT: allow targets to override FLAT processing
This brings flatload.c more in line with the current Linux FLAT loaderwhich allows targets to handle various FLAT aspects in their own way.For the common behavior, the new functions get stubbed out....
linux-user: implement sched_{g,s}etaffinity
linux-user: fix build errors for mmap2-only ports
The current print_mmap func is only enabled when the target supports themmap syscall, but both mmap and mmap2 syscalls use it. This leads to abuild failure when the target supports mmap2 but not mmap....
linux-user: fix for loopmount ioctl
In case a chrooted build uses XEN or KVM, a looped mount needs to be done to setup the chroot.The ioctl for loop mount works correctly for arm, mips, ppc32 and sh4, so its now activated.
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: Add support for -version option
Add support to the linux-user qemu for the -version command lineoption, bringing it into line with the system emulation qemu.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: Fix possible realloc memory leak
Extract from "man realloc":"If realloc() fails the original block is left untouched;it is not freed or moved."
Fix a possible memory leak (reported by cppcheck).
Cc: Riku Voipio <riku.voipio@iki.fi>Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
linux-user: fix sizeof handling for getsockopt
linux-user: avoid gcc array overrun warning for sparc
Suppress a gcc array bounds overrun warning when filling in the SPARCsignal frame by adjusting our definition of the structure so that thefp and callers_pc membes are part of the ins[] array rather than...
Delete useless 'extern' qualifiers for functions
'extern' qualifier is useless for function declarations. Deletethem.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
linux-user: ARM: clear the IT bits when invoking a signal handler
When invoking a signal handler for an ARM target, make sure the ITbits in the CPSR are cleared. (This would otherwise cause incorrectexecution if the IT state was non-zero when an exception occured....
linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP
Add a configure check for the existence of linux/fiemap.h and theIOC_FS_FIEMAP ioctl. This fixes a compilation failure on Linuxsystems which don't have that header file.
Remove dead code for ARM semihosting commandline handling
There are some bits in the code which were used to store the commandline forthe semihosting call. These bits are now write-only and can be removed.
Signed-off-by: Wolfgang Schildbach <wschi@dolby.com>...
linux-user: Fix incorrect NaN detection in ARM nwfpe emulation
The code in the linux-user ARM nwfpe emulation was incorrectlychecking only for quiet NaNs when it should have been checkingfor any kind of NaN. This is probably because the code inquestion was taken from the Linux kernel, whose copy of the...
linux-user: Implement FS_IOC_FIEMAP ioctl
Implement the FS_IOC_FIEMAP ioctl using the new support forcustom handling of ioctls; this is needed because the structthat is passed includes a variable-length array.
linux-user: Support ioctls whose parameter size is not constant
Some ioctls (for example FS_IOC_FIEMAP) use structures whose size isnot constant. The generic argument conversion code in do_ioctl()cannot handle this, so add support for implementing a special-case...
linux-user: Implement sync_file_range{,2} syscalls
Implement the missing syscalls sync_file_range and sync_file_range2.The latter in particular is used by newer versions of apt on Ubuntufor ARM.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
softfloat: Rename float*_is_nan() functions to float*_is_quiet_nan()
The softfloat functions float*_is_nan() were badly misnamed,because they return true only for quiet NaNs, not for all NaNs.Rename them to float*_is_quiet_nan() to more accurately reflect...
ARM: fix ldrexd/strexd
Correct ldrexd and strexd code to always read and write thehigh word of the 64-bit value from addr+4.Also make ldrexd and strexd agree that for a 64 bit value theaddress in env->exclusive_addr is that of the low word.
This fixes the issues reported in...
linux-user: fix mips and ppc to use UID16
Signed-off-by: Martin Mohring <martin.mohring@5edatasoft.com>Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: Translate getsockopt level option
n setsockopt, the socket level options are translated to the hosts'architecture before the real syscall is called, e.g.TARGET_SO_TYPE -> SO_TYPE. This patch does the same with getsockopt.
Tested on a x86 host emulating MIPS. Without it:-...
ARM: linux-user: Correct size of padding in target_ucontext_v2
The padding in the target_ucontext_v2 is defined by the size ofthe target's sigset_t type, not the host's. (This bug only causesproblems when we start using the uc_regspace[] array to expose...
ARM: linux-user: Expose VFP registers to signal handlers
For ARM linux-user mode signal handlers, fill in the ucontext withVFP register contents in the same way that the kernel does. We onlydo this for v2 format sigframe (2.6.12 and above); this is actually...
ARM: linux-user: Restore VFP state from ucontext on sigreturn
Restore the VFP registers from the ucontext on return from a signalhandler in linux-user mode. This means that signal handlers cannotaccidentally corrupt the interrupted code's VFP state, and allows...
ARM: linux-user: Expose iWMMXT registers to signal handlers
ARM: linux-user: Restore iWMMXT state from ucontext on sigreturn
linux-user: fix compiler error on nptl
Some compilers detect that new_stack isnt used after dd75d784
linux-user: mmap_reserve() not controlled by RESERVED_VA
mmap_reserve() should be called only when RESERVED_VA is enabled.Otherwise, unmaped virtual address space will never be reusable. Thisbug will exhaust virtual address space in extreme conditions....
linux-user: fix memory leaks with NPTL emulation
Running programs that create large numbers of threads, such as thissnippet from libstdc++'s pthread7-rope.cc:
const int max_thread_count = 4; const int max_loop_count = 10000; ... for (int j = 0; j < max_loop_count; j++)...
linux-user: remove unnecessary local from __get_user(), __put_user()
Remove an unnecessary local variable from the _get_user() and_put_user() macros. This avoids confusing compilation failuresif the name of the local variable ('size') happens to be the...
microblaze: target-ify target_ucontext
Rename the members of target_ucontext so that they don't conflictwith possible host macros for ucontext members. This has alreadybeen done for the other targets.
Signed-off-by: Richard Henderson <rth@twiddle.net>...
linux-user: Fix typo m86k -> m68k
Replace m86k_sim_stat by m68k_sim_stat.
Cc: Riku Voipio <riku.voipio@iki.fi>Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Add new user mode option -ignore-environment
An empty environment is sometimes useful in user mode.The new option provides it for linux-user and bsd-user(darwin-user still has no environment related options).
The patch also adds the documentation for other...
Replace most gcc format attributes by macro GCC_FMT_ATTR (format checking)
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))...
linux-user: fix socklen_t comparisons
On many systems, socklen_t is defined as unsigned. This means thatchecks for negative values are not meaningful.
Fix by explicitly casting to a signed integer.
This also avoids some warnings with GCC flag -Wtype-limits....
linux-user: fix types in a comparison
-1ul is unsigned long, which does not necessarily match abi_ulongtype.
Fix by using abi_long instead.
This also avoids a warning with GCC flag -Wtype-limits.
linux-user: improve flatload error checking
Because of the use of unsigned type, possible errors duringload were ignored.
Fix by using a signed type.
microblaze: User-mode emulation of hw-excp signals
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
microblaze: Fix the target version of stat64 struct
MicroBlaze needs TARGET_STAT64_HAS_BROKEN_ST_INO.
linux-user: fix build on hosts not using guest base
Commit 68a1c816868b3e35a1da698af412b29e61b1948a broke qemu on hosts notusing guest base. It uses reserved_va unconditionally in mmap.c. Toavoid to many #ifdef #endif blocks, define RESERVED_VA as either...
linux-user: Protect against allocation failure in load_symbols.
Cc: malc <av1474@comtv.ru>Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: malc <av1474@comtv.ru>
linux-user: Reduce lseek+reads while loading elf files.
Define BPRM_BUF_SIZE to 1k and read that amount initially. If thedata we want from the binary is in this buffer, use it instead ofreading from the file again.
linux-user: Define ELF_DATA generically.
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>
linux-user: Clean up byte-swapping in elfload.c.
Remove ifdefs from code by defining empty inline functionswhen byte swapping isn't needed. Push loops over swappingarrays of structures into the swapping functions.
linux-user: Load symbols from the interpreter.
First, adjust load_symbols to accept a load_bias parameter. At the sametime, read the entire section header table in one go, use pread insteadf lseek+read for the symbol and string tables, and properly free...
linux-user: Improve consistency checking in elf headers.
Validate more fields of the elf header. Extract those checksinto two common functions to be used in both load_elf_interpand load_elf_binary.
linux-user: Put the stack guard page at the top.
There are no supported stack-grows-up targets. We were puttingthe 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.
linux-user: Remove partial support for a.out interpreters.
At the bottom of the a.out support was the unimplemented load_aout_interpfunction. There were other portions of the support that didn't lookright; when I went to look in the Linux kernel for clarification, I found...
linux-user: Extract load_elf_image from load_elf_interp.
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 insteadof from a collection of passed arguments. Don't return error...
linux-user: Re-use load_elf_image for the main binary.
This requires moving the PT_INTERP extraction and GUEST_BASEhandling into load_elf_image. Key this off a non-null pointerargument to receive the interpreter name.
linux-user: Handle filesz < memsz for any PT_LOAD segment.
I caught padzero not properly initializing the .bss segmenton a statically linked Alpha program. Rather than a minimalpatch, replace the gross code with a single mmap+memset.
Share more code between load_elf_interp and load_elf_binary....
Add more DT_* and AT_* constants to qemu's copy of elf.h.
Moving some PPC AT_* constants from elfload.c at the same time.
linux-user: Reindent elfload.c.
microblaze: Pass a ucontext * as 3rd sighandler arg
There is disagreement between microblaze glibc and the kernelto what the third arg of signal handlers should point to.
Change QEMU linux-user to match the kernel port. glibc patchesare pending.
linux-user: display cpu list.
As it is done for qemu-system with "-cpu ?", when cpu_list_id() is missingfor a target, call cpu_list() instead.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
microblaze: Correct signal frame setup.
Pass the context in r7.
Strace mprotect flags.
Teach strace code about linux specific mprotect flags.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Usermode exec-stack fix
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....
s390x: Avoid _llseek.
There's no _llseek on s390x either. Replace the existingtest 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>
rename CONFIG_QEMU_PREFIX
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
linux-user: honor low bit of entry PC for MIPS
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Pre-allocate guest address space
Allow pre-allocation of the guest virtual address space in usermode emulation.
alpha-linux-user: Fill in SI_CODE for SIGSEGV.
linux-user: Use qemu-malloc.c.
Since we're no longer setting PAGE_RESERVED, there's no need toimplement qemu_malloc via mmap.
linux-user: Fix compilation with DEBUG defined
Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
linux-user: do not warn for missing pselect6
Libc will fallback gracefully if pselect6 is not available. Thus putpselect6 to nowarn until the atomicity issues of the original pselect6patch are dealt with.