summaryrefslogtreecommitdiffstats
path: root/linux-user
Commit message (Collapse)AuthorAgeFilesLines
* 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/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* linux-user: update syscall listRiku Voipio2009-06-1611-0/+96
| | | | | | In preparation for supporting pipe2() Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* add futex wake opRiku Voipio2009-06-161-0/+2
| | | | Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: support private futexesMartin Mohring2009-06-161-5/+9
| | | | | | | Implemented the same way as in the kernel. From: Martin Mohring <martin.mohring@opensuse.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: include linux/fs.hMartin Mohring2009-06-161-0/+1
| | | | | | | | defines FIGETBSZ FIBMAP, allowing the respective ioctl's to be implemented. From: Martin Mohring <martin.mohring@opensuse.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags ↵Lionel Landwerlin2009-06-162-0/+20
| | | | | | | | | to setsockopt linux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags to setsockopt Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: Added IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP flags to setsockoptLionel Landwerlin2009-06-162-0/+45
| | | | | | | linux-user: Added IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP flags to setsockopt Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* Return EOPNOTSUPP instead of ENOSYS for *xattr* syscallsArnaud Patard2009-06-161-1/+2
| | | | | | | | | | | | In current code, we're sending ENOSYS to target when a syscall for the xattrs is done. This makes applications like ls complain loudly about that and breaks scripts parsing the output. Moreover, iirc, implemented features of filesystems are are sending EOPNOTSUPP (I've not checked so I may be a little bit wrong on that...). So, I'm proposing to return -EOPNOTSUPP and make ls happy Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* Fix struct termios host - target translationArnaud Patard2009-06-161-0/+2
| | | | | | | | | | | When converting the termios structure between host and target in target_to_host_termios and host_to_target_termios, the c_cc[] array is never initialised. Calling memset() before using it allows to run successfully "stty echo / stty -echo" on arm-linux-user target (host being x86 and mips). Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: fix utimensatRiku Voipio2009-06-161-14/+24
| | | | | | | | | | | | | | | The glibc function for utimensat glibc returns -EINVAL when the path is null which is a different behaviour with the syscall. path can be null because internally the glibc is using utimensat with path null when implmenting futimens. If path is null, call futimes instead. don't try to copy timespec from user if is NULL. Add configure check for older systems Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: strace now handles guest strings correctly [v2]Mika Westerberg2009-06-164-77/+1118
| | | | | | | | | | | | | | - to not to break strace with GUEST_BASE is set: - Strace now can load and print guest strings correctly. - Added printing support for commonly used flags in some syscalls (e.g open, creat, mmap etc.) v2: - fix strace.c build on etch - add futex print to strace Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: added x86 and x86_64 support for ELF coredumpMika Westerberg2009-06-161-0/+83
| | | | | Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: implemented ELF coredump support for ARM targetMika Westerberg2009-06-166-44/+1035
| | | | | | | | | | | | When target process is killed with signal (such signal that should dump core) a coredump file is created. This file is similar than coredump generated by Linux (there are few exceptions though). Riku Voipio: added support for rlimit Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* Implement shm* syscalls and fix 64/32bit errorsRiku Voipio2009-06-161-49/+250
| | | | | | | | | | | | | | | | | No regressions were observed on either 64bit or 32bit IA hosts. Patch based on original patches by: Kirill A. Shutemov <kirill@shutemov.name> - Implement shm* syscalls - Fix and cleanup IPCOP_shm* ipc calls handling Depends on "export mmap_find_vma for shmat" patch. Various whitespace uglifications applied to minimize patch size. Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* export mmap_find_vma for shmatRiku Voipio2009-06-162-1/+2
| | | | Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* fix gdbstub support for multiple threads in usermode, v3Nathan Froyd2009-06-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging multi-threaded programs, QEMU's gdb stub would report the correct number of threads (the qfThreadInfo and qsThreadInfo packets). However, the stub was unable to actually switch between threads (the T packet), since it would report every thread except the first as being dead. Furthermore, the stub relied upon cpu_index as a reliable means of assigning IDs to the threads. This was a bad idea; if you have this sequence of events: initial thread created new thread #1 new thread #2 thread #1 exits new thread #3 thread #3 will have the same cpu_index as thread #1, which would confuse GDB. (This problem is partly due to the remote protocol not having a good way to send thread creation/destruction events.) We fix this by using the host thread ID for the identifier passed to GDB when debugging a multi-threaded userspace program. The thread ID might wrap, but the same sort of problems with wrapping thread IDs would come up with debugging programs natively, so this doesn't represent a problem. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
* microblaze: linux-user support.Edgar E. Iglesias2009-05-265-4/+405
| | | | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* microblaze: Add syscall, signal and termbits defs for linux-user.Edgar E. Iglesias2009-05-264-0/+656
| | | | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* Only define __llseek if it is going to be usedPaul Brook2009-05-191-1/+1
| | | | Signed-off-by: Paul Brook <paul@codesourcery.com>
* Avoid implicit truncation compiler warningsPaul Brook2009-05-191-2/+2
| | | | Signed-off-by: Paul Brook <paul@codesourcery.com>
* support ELF_HWCAP for PPPCNathan Froyd2009-05-151-0/+58
| | | | | Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: malc <av1474@comtv.ru>
* linux-user: ppc signal handlingNathan Froyd2009-05-153-0/+604
| | | | | | | | | Implement setup_{,rt_}frame and do_{,rt_}sigreturn for PPC 32-bit. Use the same TARGET_QEMU_ESIGRETURN hack as for MIPS to avoid clobbering register state on a sigreturn. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: malc <av1474@comtv.ru>
* Replace gcc variadic macro extension with C99 versionBlue Swirl2009-05-133-13/+13
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix compiler warnings in nwfpe code.Paul Brook2009-05-045-86/+47Star
| | | | Signed-off-by: Paul Brook <paul@codesourcery.com>
* MIPS signal handling fixes.pbrook2009-04-213-4/+109
| | | | | | | | | | | | | | | | | | Also fixes a register corruption bug in do_sigreturn. When "returning" from sigreturn we are actually restoring the virtual cpu state from the signal frame. This is actually surprisingly hard to observe in practice. Typically an thread be blocked in a FUTEX_WAIT call when the signal arrives, so the effect is a spurious syscall success and the introduction of a subtle race condition. On x86/arm a syscall modifies a single word sized register, so do_sigreturn can just return that value. On MIPS a syscall clobbers multiple registers, so we need additional smarts. My solution is to invent a magic errno value that means "don't touch CPU state". git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7194 c046a42c-6fe2-441c-8c8c-71466251a162
* MIPS: Raise SIGSEGV, not SIGILL when an access faults.pbrook2009-04-211-0/+7
| | | | | | | Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7193 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix target_siginfo ordering for MIPS.pbrook2009-04-211-0/+6
| | | | | | | Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7192 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: Linux kernel's fchmodat and faccessat have three args (no 4th arg)aurel322009-04-191-9/+8Star
| | | | | | | | | | In Linux kernel, fchmodat() and faccessat() take tree args. 4th value <int flags> is only processed by libc. Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7187 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: fix IPCOP_sem* and implement sem*aurel322009-04-181-98/+188
| | | | | | | | | | | | | | | | | | Fix and cleanup IPCOP_sem* ipc calls handling and implement sem* syscalls. Riku: 1) Uglify whitespace so that diff gets smaller and easier to review 2) use __get_user in target_to_host_sembuf Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7184 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: fix inotify syscallsaurel322009-04-171-1/+2
| | | | | | | | | | Configure test was broken, so the breakage of the #ifdef'd code was not noticed. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7134 c046a42c-6fe2-441c-8c8c-71466251a162
* Translate signal values in exit status.pbrook2009-04-163-2/+18
| | | | | | | Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7131 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: fix getcwd syscallaurel322009-04-161-1/+1
| | | | | | | | | | | | | | The patch called "prefer glibc over direct syscalls" (commit 7118) has replaced the getcwd syscall with a call to the glibc. With this change, the syscall is returning -1 in error case and 0 otherwise. This is problematic as the sys_getcwd syscall should return the number of bytes written to the buffer including the '\0'. Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Acked-By: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7130 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: fix warnings introduced by r7118aurel322009-04-151-1/+1
| | | | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7120 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: proper exit code for uncaught signalsaurel322009-04-151-12/+25
| | | | | | | | | | | | | | | | The proper exit code for dieing from an uncaught signal is -<signal>. The kernel doesn't allow exit() or _exit() to pass a negative value. To get the proper exit code we need to actually die from an uncaught signal. A default signal handler is installed, we send ourself a signal and we wait for it to arrive. Patch originates from Scratchbox Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7119 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: prefer glibc over direct syscallsaurel322009-04-151-61/+253
| | | | | | | | | | | | | | | The openat/*at syscalls are incredibly common with modern coreutils, calling them directly via syscalls breaks for example fakeroot. Use glibc stubs whenever directly available and provide old syscall calling for people still using older libc. Patch originally from Mika Westerberg, Adapted to apply to current trunk and cleaned up by Riku Voipio. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7118 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: removed unnecessary MAX_SOCK_ADDR checks for socket syscallsaurel322009-04-151-10/+7Star
| | | | | | | | | | | | - This check is not needed because kernel will check whether given buffer is too small and there is no upper limit for size of the buffer. From: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7117 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: unix sockets - fix running dbusaurel322009-04-151-2/+27
| | | | | | | | | | | | | | | dbus sends too short (according to man 7 unix) addrlen for it's unix socket. I've been told that happens with other applications as well. Linux kernel doesn't appear to mind, so I guess we whould be tolerant as well. Expand sockaddr with +1 to fit the \0 of the pathname passed. (scratchbox1 qemu had a very different workaround for the same issue). Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7116 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: add support for passing contents of argv0aurel322009-04-151-1/+37
| | | | | | | | | | | | | Added switch -0 (zero) which can be used to pass argv[0] to target process. The main use is for a binfmt_misc wrapper when the "P - preserve-argv[0]" setting is used. From: Mika Westerberg Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7115 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: Added posix message queue syscalls except mq_notifyaurel322009-04-153-6/+126
| | | | | | | | | Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7114 c046a42c-6fe2-441c-8c8c-71466251a162
* Enable generic accepts-anything cpu by default for usermode emulation.pbrook2009-04-091-1/+1
| | | | | | | Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7051 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: fix fstatat64()/newfstatat() syscall implementationaurel322009-04-091-4/+25
| | | | | | | | | | | | | There are two different syscall names for the same goal. On systems with sizeof(long) == 64 it calls newfstatat. On systems with sizeof(long) == 32 it calls fstatat64. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7050 c046a42c-6fe2-441c-8c8c-71466251a162
* linux-user: fix problems with inotify syscallsaurel322009-04-081-3/+3
| | | | | | | | | | | | | | | | | The sys_inotify* calls are defined if the target supports them and the host supports the necessary syscalls. But the syscalls are handled if the target supports them. This situation leads to compilation failures when the host doesn't support the necessary syscalls, as the linker will complain about undefined functions. Fix this state of affairs by making the handling conditions the same as the call definition conditions. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Acked-By: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7038 c046a42c-6fe2-441c-8c8c-71466251a162
* Add --with-pkgversion.pbrook2009-04-081-1/+1
| | | | | | | | | | Allows distributors to identify their builds without needing to hack the sources. Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7036 c046a42c-6fe2-441c-8c8c-71466251a162