summaryrefslogtreecommitdiffstats
path: root/linux-user
Commit message (Collapse)AuthorAgeFilesLines
* Fix Sparse warnings: add "static"Blue Swirl2009-09-051-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* linux-user: Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit ↵Kirill A. Shutemov2009-08-251-36/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | targets qemu's page table can be incomple if /proc/self/maps is unavailable or host allocating a memory with mmap(), so we can't use it to find free memory area. New version mmap_find_vma() uses mmap() without MAP_FIXED to find free memory. Tested-by: Martin Mohring <martin.mohring@opensuse.org> : quite some time ago this patch had been sent by Kirill to the QEMU ml. At that time, the patch was rejected. Now we found out why the current user mode memory allocator sometimes fails: - Kernel Bug linux/fs/proc/task_mmu.c (fixed after 2.6.27) http://bugzilla.kernel.org/attachment.cgi?id=17219 - use of proc file system to find memory mappings => bad idea So I please apply the attached patch from Kirill to qemu to fix this longstanding bug, because it causes all older linux distros (using kernel 2.6.26 or older) to fail the QEMU memory allocator in user mode. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: zero fstat buffer to initialize nsec fieldsUlrich Hecht2009-08-251-0/+1
| | | | | | | | | | | The fstat implementation does not initialize the nanosecond fields in the stat buffer; this caused funny values to turn up there, preventing, for instance, cp -p from preserving timestamps because utimensat rejected the out-of-bounds nanosecond values. Resetting the entire structure to zero fixes that. Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: fadvise64 implementationUlrich Hecht2009-08-251-3/+14
| | | | | | | good enough to pass all LTP fadvise64 tests Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: enable getdents for > 32-bit systemsUlrich Hecht2009-08-251-5/+1
| | | | | | | | works perfectly fine with the example from getdents(2) and passes the LTP tests (tested with s390x on x86_64 emulation) Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: fcntl fixes for LTPUlrich Hecht2009-08-252-12/+29
| | | | | | | | Fixes swaps on l_pid which were pretty much of random size. Implements F_SETLEASE, F_GETLEASE. Now passes all LTP fcntl tests. Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: fix mq_* compilation problemsNathan Froyd2009-08-251-2/+5
| | | | | | | | | | | mqueue.h is only available if __NR_mq_open is defined. So don't include it unconditionally. Similarly, the mq_* family of syscalls depend on __NR_mq_open. Finally, the copy_{from,to}_user_mq_attr functions should not be defined unconditionally, but only if we're going to use the mq_* syscalls. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* m68k, linux-user: enable sigaltstack()Laurent Vivier2009-08-251-1/+2
| | | | | | | | As setup_frame() and setup_rt_frame() are now implemented we can now enable sigaltstack(). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* m68k, linux-user: add setup_rt_frameLaurent Vivier2009-08-251-3/+202
| | | | | | | This patch implements setup_rt_frame(). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* m68k,linux-user: add setup_frameLaurent Vivier2009-08-251-0/+183
| | | | | | | | | | | | This patch adds signals management for linux-user. It implements setup_frame() which allows to call the user signal handler. setup_rt_frame() is always unimplemented. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: add eventfd supportRiku Voipio2009-08-251-0/+15
| | | | | | | | Straightforward implementation. This syscall is rare enough that we don't need to support the odder cases, just disable it if host glibc is too old. Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* Replace local ADDRX/PADDRX macros with TARGET_FMT_lx/plxBlue Swirl2009-08-161-3/+3
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* linux-user: compile envlist.c only onceBlue Swirl2009-08-152-269/+0
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* user: compile path.c only onceBlue Swirl2009-08-152-161/+0
| | | | | | Also merge bsd-user/path.c and linux-user/path.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix symfind.Laurent Desnogues2009-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | this patch fixes an issue in symfind. Assume you have the following symbols: Address Size 0045bca0 00000080 T s0 0045bd20 00000112 T s1 You'll notice that s1 is s0 + size. So the current symfind will find that address 0045bd20 belongs to s0 instead of s1. Laurent Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* Sparc64: replace tsptr with helper routineIgor Kovalenko2009-08-041-1/+1
| | | | | | | | | | | | | | | | | | | tl and tsptr of members sparc64 cpu state must be changed simultaneously to keep trap state window in sync with current trap level. Currently translation of store to tl does not change tsptr, which leads to corrupt trap state on corresponding trap level. This patch removes tsptr from sparc64 cpu state and replaces all uses with call to helper routine. Changes v0->v1: - reimplemented helper routine with tcg generator - on cpu reset trap type and pstate are populated with power-on reset values, including tl=maxtl Signed-off-by: igor.v.kovalenko@gmail.com Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* linux-user: make FUTEX_* calls honor timeout parameterNathan Froyd2009-08-031-8/+16
| | | | | Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: malc <av1474@comtv.ru>
* linux-user: handle POWERPC_EXCP_STCXNathan Froyd2009-08-031-0/+68
| | | | | | | | We handle conditional stores as an exception so we can ensure that no other thread is changing memory out from underneath us. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: malc <av1474@comtv.ru>
* More NULL pointer fixesBlue Swirl2009-08-012-2/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* rename USE_NPTL to CONFIG_USE_NPTLJuan Quintela2009-07-274-18/+18
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIANJuan Quintela2009-07-272-4/+4
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rename HAVE_GPROF to TARGET_GPROFJuan Quintela2009-07-271-3/+3
| | | | | | | Use was not consistent, in Makefile was TARGET_GPROF and in *h HAVE_GPROF Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix most warnings (errors with -Werror) when debugging is enabledBlue Swirl2009-07-203-10/+12
| | | | | | | I used the following command to enable debugging: perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * */* */*/* Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Use correct byteswap routine for elf_notemalc2009-07-181-3/+3
| | | | | | | All elf64_note structure members are Elf64_Word (which is 32bit value) hence using bswaptls to byteswap it on 64bit platforms is incorrect. Signed-off-by: malc <av1474@comtv.ru>
* Avoid name clashes with symbols that leak from system headersmalc2009-07-182-41/+41
| | | | Signed-off-by: malc <av1474@comtv.ru>
* ELF codedump build failuresLaurent Desnogues2009-07-171-29/+30
| | | | | | Rename ELF coredump types to avoid conflict with the corresponding host types. Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
* Userspace guest address offsettingPaul Brook2009-07-173-0/+71
| | | | | | | | | | Re-implement GUEST_BASE support. Offset guest ddress space by default if the guest binary contains regions below the host mmap_min_addr. Implement support for i386, x86-64 and arm hosts. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Paul Brook <paul@codesourcery.com>
* Update to a hopefully more future proof FSF addressBlue Swirl2009-07-168-23/+8
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Avoid SIGSEGV when dumping cpu state without enabled loggingmalc2009-07-151-1/+2
| | | | Signed-off-by: malc <av1474@comtv.ru>
* consolidate user cpu_{in, out}[bwl] into ioport-user.cIsaku Yamahata2009-07-091-33/+0
| | | | | Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge commit 'linux-user/linux-user-for-upstream' into tmp-stagingAnthony Liguori2009-07-093-82/+110
|\
| * getrlimit conversion mix-upUlrich Hecht2009-07-081-2/+2
| | | | | | | | | | | | | | | | Fixes getrlimit implementation that overwrote the result of the syscall instead of converting it Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
| * wrap path for access syscallUlrich Hecht2009-07-081-1/+1
| | | | | | | | | | Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
| * 64-bit clean socketcall syscallUlrich Hecht2009-07-081-65/+65
| | | | | | | | | | | | | | makes socketcall 64-bit clean so it works on 64-bit big-endian systems Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
| * pipe argument should not be signedUlrich Hecht2009-07-081-1/+1
| | | | | | | | | | | | | | | | pipedes is an address, it should not be signed (breaks for addresses > 0x80000000) Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
| * linux-user/syscall.c: remove warning: ‘array’ may be used uninitialized ↵vibi sreenivasan2009-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | in this function Removes the following warning CC i386-linux-user/syscall.o cc1: warnings being treated as errors /media/nfs/qemu/linux-user/syscall.c: In function ‘do_syscall’: /media/nfs/qemu/linux-user/syscall.c:2219: warning: ‘array’ may be used uninitialized in this function Signed-off-by: Vibi Sreenivasan <vibi_sreenivasan@cms.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
| * linux-user: check some parameters for some socket syscalls.Arnaud Patard2009-07-081-8/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is fixing following issues : - commit 8fea36025b9d6d360ff3b78f88a84ccf221807e8 was applied to do_getsockname instead of do_accept. - Some syscalls were not checking properly the memory addresses passed as argument - Add check before syscalls made for cases like do_getpeername() where we're using the address parameter after doing the syscall - Fix do_accept to return EINVAL instead of EFAULT when parameters invalid to match with linux behaviour Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
| * linux-user: increment MAX_ARG_PAGESArnaud Patard2009-07-082-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a error When doing something like that : find / -type f -print0 | xargs -0 echo [ done in a arm chroot with qemu-arm and linux binfmt stuff or with find / -type f -print0 | qemu-arm -L <path> <path>/usr/bin/xargs -0 echo ] Doing this outsite qemu is fine. The problem was the huge number of parameters. Increasing MAX_ARG_PAGES is fixing that. While I was at it, I've modified linux-user/main.c to report error code of loader_exec. It helps to debug/know what's wrong. Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* | MIPS signal handling fixPaul Brook2009-07-091-0/+2
| | | | | | | | | | | | Add explicit padding to MIPS signal frame structures. Signed-off-by: Paul Brook <paul@codesourcery.com>
* | MIPS atomic instructionsPaul Brook2009-07-091-0/+60
| | | | | | | | | | | | Implement MIPS ll/sc instructions using atomic compare+exchange. Signed-off-by: Paul Brook <paul@codesourcery.com>
* | Fix MIPS sys_clonePaul Brook2009-07-091-1/+1
|/ | | | | | The clone syscall takes 6 args. Signed-off-by: Paul Brook <paul@codesourcery.com>
* Fix missing strnlen problemsBlue Swirl2009-07-011-11/+0
| | | | | | | Fix missing strnlen (a GNU extension) problems by using qemu_strnlen used for user emulators also for system emulators. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* microblaze: Support the latest mmu-kernel stat64 ABI.Edgar E. Iglesias2009-06-231-2/+3
| | | | | | | | | Microblaze recently changed their ABI. The new is not backwards compatible and there doesn't seem to be a way to distinguish old/new binaries. Let's support the latest ABI for now and hope someone figures out a way to hande both ABI's later. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* linux-user: strace now handles guest stringscorrectly [v2]Riku Voipio2009-06-193-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Tue, Jun 16, 2009 at 08:19:23PM -0500, Anthony Liguori wrote: > malc wrote: >> >> On my system the above line causes gcc to emit: >> >> In file included from /home/malc/x/rcs/git/qemu/linux-user/strace.c:12: >> /usr/include/linux/futex.h:48: error: field `__user' has incomplete type >> /usr/include/linux/futex.h:48: error: syntax error before '*' token >> /usr/include/linux/futex.h:63: error: field `list' has incomplete type >> /usr/include/linux/futex.h:83: error: field `__user' has incomplete type >> /usr/include/linux/futex.h:83: error: syntax error before '*' token >> make[1]: *** [strace.o] Error 1 > We had the same problem with usb-linux.c. It's broken system headers, > the __user stuff is supposed to get removed as part of the headers > installation. > It builds fine on my system (Fedora 10). Howabout something like this: commit eb8387cb0eda32a18880664eb5f0ca5c8bf05b45 Author: Riku Voipio <riku.voipio@iki.fi> Date: Thu Jun 18 22:44:31 2009 +0300 Subject: linux-user: include futex defines directly Since some common distributions have broken linux/futex.h, stop including it. Instead add the defines directly. Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: remove duplicate tswap32() from do_getsockopt()Laurent Vivier2009-06-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This issue has been detected with tests/linux-tests.c: linux-test.c:330: getsockopt 327 len = sizeof(val); 328 chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len)); 329 if (val != SOCK_STREAM) 330 error("getsockopt"); In linux-user/syscall.c:do_getsockopt(), we have: ... val = tswap32(val); ... if (put_user_u32(val, optval_addr)) ... whereas "put_user_u32" calls in the end "__put_user" which uses "tswap32". So the "val = tswap32(val);" is useless and wrong. This patch removes it. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user/syscall.c: define _ATFILE_SOURCEEduardo Habkost2009-06-161-0/+1
| | | | | | | Needed to make sure the xxxat() functions are available. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: initialize mmap_mutex properlyNathan Froyd2009-06-161-1/+1
| | | | | | | | We initialize mmap_mutex in any child threads/processes, but we need to correctly statically initialize it for the original process. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* RFC: fix fcntl support in linux-user - new tryArnaud Patard (Rtp)2009-06-162-24/+73
| | | | | | | | | | | | | | | | | Hi, This is a new try to fix the fcntl support in linux-user. I tried to adress all comments but as the previous version is several weeks old, it's possible that I've missed some. This patch doesn't handle linux specific fcntl flags. My plan is to get this version of the patch reviewed/fixed and then, add them if wanted. Thanks, Arnaud Signed-off-by: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: add tee, splice and vmsplicevibisreenivasan2009-06-161-0/+40
| | | | | | | | | | | | | Add support for tee, splice and vmsplice. Originally from: vibi sreenivasan <vibi_sreenivasan@cms.com> Riku: squashed patches together, added a test to configure and removed compliler warning by picking up correct type for splice param Signed-off-by: vibisreenivasan <vibi_sreenivasan@cms.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: implement pipe2 [v3]Riku Voipio2009-06-161-18/+37
| | | | | | | | | implement pipe2 syscall. [v2] fix do_pipe on mips and sh4 [v3] use pipe2 to ensure atomicity, but only when it is available. Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
OpenPOWER on IntegriCloud