mips: rlimit incorrectly converts values
Byte swap was applied in the wrong order with testing forRLIM_INFINITY. On mips bigendian from an amd64 system this results ininfinity being misinterpretted as 2^31-1.
This is a serious bug because it causes setrlimit stack size to kill...
mips: null pointer deref should segfault
Dereferencing a null pointer causes an exception 0xC (EXCP_AdEL)instead of EXCP_TLBL. This should also trigger a segfault.
Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
mips: missing syscall returns wrong errno
Return -TARGET_ENOSYS instead of -ENOSYS from linux-user/main.c * Caused strange 'Level 2 synchronization messages' instead ofcorrectly reporting the syscall was missing. * Made glibc simply fail instead of using older syscalls...
mips: sigaltstack args
The syscall sigaltstack takes two parameters, not zero. This patchshould have no impact as only values above 4 influence the runtimebehaviour. Nevertheless, it is wrong.
linux-user/syscall.c: Enforce pselect6 sigset size restrictions
Enforce the same restriction on the size of the sigset passed topselect6 as the Linux kernel does. This is both correct and silencesa gcc 4.6 warning about a write-only variable.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user: Implement prlimit64 syscall
Implement the prlimit64 syscall.
Slightly modified to apply upstream -Riku
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Add syscall numbers from kernel 2.6.39.2
Add syscall numbers for new syscall numbers; this brings usinto line with Linux 2.6.39.2.
linux-user: Add support for even more FB ioctls
This patch was validated with programs from DirectFB-1.0 andWebKit/DirectFB.
Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>Cc: Riku Voipio <riku.voipio@iki.fi>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Add support for more VT ioctls
DirectFB-1.0 uses at least two of the four added ioctls, and the twoothers were added for completeness. This patch was validated with theprogram "vlock -all/-new".
Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>...
linux-user: Add support for KD...LED ioctls
DirectFB-1.0 uses at least one of the four added ioctls, and the threeothers were added for completeness. This patch was validated with theprogram "setleds" and the following Makefile:
SETLEDS_INIT = setleds -v -num -caps -scroll...
user: Fix -d debug logging for usermode emulation
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Remove exec-all.h include directives
Most exec-all.h include directives are now useless, remove them.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
linux-user: syscall should use sanitized arg1
Looking at the other architectures, we should be using "how" not "arg1".
Signed-off-by: Juan Quintela <quintela@redhat.com>[peter.maydell@linaro.org: remove unnecessary initialisation of how]Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
flatload: end_code was only used in a debug message
Just unfold its definition in only use.
Signed-off-by: Juan Quintela <quintela@redhat.com>[peter.maydell@linaro.org: fixed typo in the debug code,added parentheses to fix precedence issue]Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
flatload: memp was a write-only variable
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: Bump do_syscall() up to 8 syscall arguments
On 32 bit MIPS a few syscalls have 7 arguments, and so to callthem via NR_syscall the guest needs to be able to pass 8 argumentsto do_syscall(). Raise the number of arguments do_syscall() takesaccordingly....
linux-user/signal.c: Remove only-ever-set variable fpu_save_addr
Move the access of fpu_save into the commented out skeleton code forrestoring FPU registers on SPARC sigreturn, thus silencing a gcc4.6 "variable set but never used" warning.(This doesn't affect the calculation of 'err' because in fact...
linux-user/signal.c: Remove unused fenab
Remove fenab as it is only written, never used. Add a FIXMEcomment about the discrepancy between our behaviour and thatof the Linux kernel for this routine.
linux-user: Fix sync_file_range on 32bit mips
As noticed while looking at "Bump do_syscall() up to 8 syscall arguments" patch, sync_file_range uses a pad argument on 32bit mips. Deal with itby reading the correct arguments when on mips.
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: Fix the computation of the requested heap size
There were several remaining bugs in the previous implementation ofdo_brk():
1. the value of "new_alloc_size" was one page too large when the requested brk was aligned on a host page boundary....
linux-user: add pselect6 syscall support
Some architectures (like Blackfin) only implement pselect6 (and skipselect/newselect). So add support for it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: Define AT_RANDOM to support target stack protection mechanism.
The dynamic linker from the GNU C library v2.10+ uses the ELFauxiliary vector AT_RANDOM [1] as a pointer to 16 bytes with randomvalues to initialize the stack protection mechanism. Technically the...
linuxload: id_change was a write only variable
syscall: really return ret code
We assign ret with the error code, but then return 0 unconditionally.
linux-user: Handle images where lowest vaddr is not page aligned
Fix a bug in the linux-user ELF loader code where it was not correctlyhandling images where the lowest vaddr to be loaded was not page aligned.The problem was that the code to probe for a suitable guest base address...
linux-user: Don't use MAP_FIXED in do_brk()
Since mmap() with MAP_FIXED will map over the top of existing mappings,it's a bad idea to use it to implement brk(), because brk() with alarge size is likely to overwrite important things like qemu itselfor the host libc. So we drop MAP_FIXED and handle "mapped but at...
linux-user: Fix the load of ELF files that have no "useful" symbol
This patch fixes a "double free()" due to "realloc(syms, 0)" in theloader when the ELF file has no "useful" symbol, as with the followingexample (compiled with "sh4-linux-gcc -nostdlib"):...
Don't translate pointer when in restore_sigcontext
Fixes crash in i386 when user emulation base address is non-zero.
21797 rt_sigreturn(8,1082124603,1,0,1082126048,1082126248)Exit reason and status: signal 11
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>...
Command line support for altering the log file location
Add command line support for logging to a location other than /tmp/qemu.log.
With logging enabled (command line option -d), the log is written tothe hard-coded path /tmp/qemu.log. This patch adds support for writing...
Merge remote branch 'rth/axp-next' into alpha-merge
Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is includedas they become redundant.
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
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....
target-alpha: Tidy exception constants.
There's no need to attempt to match EXCP_* values with PALcode entrypoint offsets. Instead, compress all the values to make for moreefficient switch statements within QEMU.
We will be doing TLB fill within QEMU proper, not within the PALcode,...
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
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.
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.
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...