summaryrefslogtreecommitdiffstats
path: root/linux-user
Commit message (Collapse)AuthorAgeFilesLines
* target-mips: Add ASE DSP resources access checkJia Liu2012-10-311-0/+6
| | | | | | | Add MIPS ASE DSP resources access check. Signed-off-by: Jia Liu <proljc@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Merge branch 'linux-user-for-upstream' of ↵Aurelien Jarno2012-10-196-91/+188
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.linaro.org/people/rikuvoipio/qemu * 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu: linux-user: register align p{read, write}64 linux-user: ppc: mark as long long aligned tcg: Remove TCG_TARGET_HAS_GUEST_BASE define configure: Remove unnecessary host_guest_base code linux-user: If loading fails, print error as string, not number linux-user: Fix siginfo handling alpha-linux-user: Fix sigaltstack structure definition linux-user: Implement gethostname linux-user: Perform more checks on iovec lists linux-user: fix multi-threaded /proc/self/maps linux-user: fix statfs
| * linux-user: register align p{read, write}64Alexander Graf2012-10-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | pread64 and pwrite64 pass 64bit parameters which for some architectures need to be aligned to special argument pairs, creating a gap argument. Handle this special case the same way we handle it in other places of the code. Reported-by: Alex Barcelo <abarcelo@ac.upc.edu> Signed-off-by: Alexander Graf <agraf@suse.de> Tested-by: Alex Barcelo <abarcelo@ac.upc.edu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: ppc: mark as long long alignedAlexander Graf2012-10-121-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | The SysV PPC32 ABI dictates that long long (64bit) parameters are pass in odd/even register pairs. Because unlike ARM and MIPS we start at an odd register number, we can reuse the same aligning code that ARM and MIPS use. Clarified inline comment that it is SysV ABI that requires long long aligned parameters - Riku Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: If loading fails, print error as string, not numberPeter Maydell2012-10-122-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the attempt to load the guest executable fails, print the error message as a string, not a number. This requires us to fix a couple of places in loader_exec() where we were returning -1 instead of a valid negative errno. The change allows us to drop the "Unknown binary format" message because the strerror-enhanced message is now a more self-explanatory "Error while loading $guest-binary: Exec format error". Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Fix siginfo handlingRichard Henderson2012-10-123-20/+44
| | | | | | | | | | | | | | | | Compare signal numbers in the proper domain. Convert all of the fields for SIGIO and SIGCHLD. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * alpha-linux-user: Fix sigaltstack structure definitionRichard Henderson2012-10-121-3/+4
| | | | | | | | | | Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Implement gethostnameRichard Henderson2012-10-121-0/+13
| | | | | | | | | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: Perform more checks on iovec listsRichard Henderson2012-10-121-60/+102
| | | | | | | | | | | | | | | | Validate count between 0 and IOV_MAX. Limit total length of operation in the same way the kernel does. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: fix multi-threaded /proc/self/mapsAlexander Graf2012-10-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When reading our faked /proc/self/maps from a secondary thread, we get an invalid stack entry. This is because ts->stack_base is not initialized in non-primary threads. However, ts->info is, and the stack layout information we're looking for is there too. So let's use that one instead! Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
| * linux-user: fix statfsAlexander Graf2012-10-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The statfs syscall should always memset(0) its full struct extent before writing to it. Newer versions of the syscall use one of the reserved fields for flags, which would otherwise get stale values from uncleaned memory. This fixes libarchive for me, which got confused about the return value of pathconf("/", _PC_REC_XFER_ALIGN) otherwise, as it some times gave old pointers as return value. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* | microblaze: Update PC before simulating syscallEdgar E. Iglesias2012-10-191-1/+1
| | | | | | | | | | | | | | Fixes a clone() emulation bug were the new thread starts at the point of the syscall and thus clones in a loop. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* | microblaze: Support setting of TLS ptrEdgar E. Iglesias2012-10-191-0/+2
| | | | | | | | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* | target-sparc: Don't compute full flags value so oftenRichard Henderson2012-10-131-0/+5
|/ | | | | | | | | Avoid speculatively computing flags before every potentially trapping operation and instead do the flags computation when a trap actually occurs. This gives approximately 30% speedup in emulation. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge branch 'trivial-patches' of git://github.com/stefanha/qemuAurelien Jarno2012-10-061-2/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'trivial-patches' of git://github.com/stefanha/qemu: versatilepb: Use symbolic indices for ARM PIC qdev: kill bogus comment qemu-barrier: Fix compiler version check for future gcc versions hw: Add missing 'static' attribute for QEMUMachine cleanup useless return sentence qemu-sockets: Fix compiler warning (regression for MinGW) vnc: Fix spelling (hellmen -> hellman) in comment slirp: Fix spelling in comment (enought -> enough, insure -> ensure) tcg/arm: Use tcg_out_mov_reg rather than inline equivalent code cpu: Add missing 'static' attribute to qemu_global_mutex configure: Support empty target list (--target-list=) hw: Fix return value check for bdrv_read, bdrv_write
| * cleanup useless return sentenceAmos Kong2012-10-051-2/+0
| | | | | | | | | | | | | | | | This patch cleans up return sentences in the end of void functions. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* | linux-user: remove two unchecked uses of strdupJim Meyering2012-10-051-5/+7
|/ | | | | | | | | Remove two uses of strdup (use g_path_get_basename instead), and add a comment that this strncpy use is ok. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori2012-09-251-3/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stefanha/trivial-patches: w32: Always use standard instead of native format strings net/socket: Fix compiler warning (regression for MinGW) linux-user: Remove redundant null check and replace free by g_free qemu-timer: simplify qemu_run_timers TextConsole: saturate escape parameter in TTY_STATE_CSI curses: don't initialize curses when qemu is daemonized dtrace backend: add function to reserved words pflash_cfi01: Fix warning caused by unreachable code ioh3420: Remove unreachable code lm4549: Fix buffer overflow cadence_uart: Fix buffer overflow qemu-sockets: Fix potential memory leak qemu-ga: Remove unreachable code after g_error target-i386: Allow tsc-frequency to be larger then 2.147G
| * linux-user: Remove redundant null check and replace free by g_freeStefan Weil2012-09-231-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Report from smatch: linux-user/syscall.c:3632 do_ioctl_dm(220) info: redundant null check on big_buf calling free() 'big_buf' was allocated by g_malloc0, therefore free was also replaced by g_free. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* | Merge remote-tracking branch 'afaerber/qom-cpu' into stagingAnthony Liguori2012-09-251-4/+2
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | * afaerber/qom-cpu: target-alpha: Initialize env->cpu_model_str target-i386: Drop unused setscalar() macro target-i386: Kill cpudef config section support target-i386: x86_cpudef_setup() coding style change Eliminate cpus-x86_64.conf file target-i386: Move CPU models from cpus-x86_64.conf to C target-i386: Add missing CPUID_* constants Drop cpu_list_id macro target-i386: Fold -cpu ?cpuid, ?model output into -cpu help, drop ?dump MAINTAINERS: Add entry for QOM CPU
| * Drop cpu_list_id macroPeter Maydell2012-09-211-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | Since the only user of the extended cpu_list_id() format was the x86 ?model/?dump/?cpuid output, we can drop it completely. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* | linux-user: Use memcpy in get_user/put_user.Richard Henderson2012-09-211-32/+15
|/ | | | | | | | | When host and target have differing alignment rules, using a cast and direct memory operation can result in SIGBUS. Use memcpy instead, which the compiler will happily optimize when alignment is satisfied. Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Remove #if 0'd cpu_get_real_ticks() definitionPeter Maydell2012-09-141-13/+0
| | | | | | | | | Remove the cpu_get_real_ticks() definition from linux-user/main.c. This has been disabled via #if 0 and unused since commit 1dce7c3c22 in 2006; the definitions we actually use are in qemu-timer.h. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* linux-user: Clarify "Unable to reserve guest address space" errorPeter Maydell2012-08-271-1/+4
| | | | | | | | | | | Now that we default to reserving nearly 4GB of RAM for the guest address space when running a 32 bit linux-user guest on 64 bit hosts, users are much more likely to run into it. Reword the message to be more informative about what failed and provide suggestions for how to fix things. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: fix emulation of getdentsDmitry V. Levin2012-08-272-10/+9
| | | | | | | | | | | In case when TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64, the last byte of the target dirent structure (aka d_type byte) was never copied from the host dirent structure, thus breaking everything that relies on valid d_type value, e.g. glob(3). Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: arg_table need not have global scopeJim Meyering2012-08-271-3/+3
| | | | | | | | Declare arg_table to be "static const", and adjust the two users to also be const. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: do_msgrcv: don't leak host_mb upon TARGET_EFAULT failureJim Meyering2012-08-221-2/+2
| | | | | | | Also, use g_malloc to avoid NULL-deref upon OOM. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* linux-user: ARM: Ignore immediate value for svc in thumb modeAlexander Graf2012-08-141-2/+1
| | | | | | | | | | | | When running in thumb mode, Linux doesn't evaluate the immediate value of the svc instruction, but instead just always assumes the syscall number to be in r7. This fixes executing go_bootstrap while building go for me. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Use init_guest_space when -R and -B are specifiedMeador Inge2012-08-143-44/+56
| | | | | | | | | | | | | Roll the code used to initialize the guest memory space when -R or -B is used into 'init_guest_space' and then call 'init_guest_space' from the driver. This way the reserved guest memory space can be probed for. Calling 'mmap' just once as is currently done is not guaranteed to succeed since the host address space validation might fail. Signed-off-by: Meador Inge <meadori@codesourcery.com> [PMM: Fixed minor whitespace errors.] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Factor out guest space probing into a functionMeador Inge2012-08-142-33/+90
| | | | | | Signed-off-by: Meador Inge <meadori@codesourcery.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* flatload: fix bss clearingMike Frysinger2012-08-141-1/+1
| | | | | | | | | | The current bss clear logic assumes the target mmap address and host address are the same. Use g2h to translate from the target address space to the host so we can call memset on it. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_typeJing Huang2012-08-141-4/+16
| | | | | | Signed-off-by: Jing Huang <jing.huang.pku@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket optionJing Huang2012-08-141-0/+20
| | | | | | Signed-off-by: Jing Huang <jing.huang.pku@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: pass sockaddr from host to targetJing Huang2012-08-141-3/+13
| | | | | | Signed-off-by: Jing Huang <jing.huang.pku@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Move target_to_host_errno_table[] setup out of ioctl loopPeter Maydell2012-08-131-5/+6
| | | | | | | | | The code to initialise the target_to_host_errno_table[] array was accidentally inside the loop through checking and initialising all the supported ioctls. This was harmless but meant that we reinitialised the array several hundred times on startup. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitionsPeter Maydell2012-08-133-4/+7
| | | | | | | | | Fix the SNDCTL_DSP_MAP{IN,OUT}BUF ioctl definitions so that they refer to a suitably defined target struct layout rather than hardcoding the ioctl number. This fixes complaints from the syscall_init() consistency check when running an x86_64-to-x86_64 linux-user qemu. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Fix incorrect TARGET_BLKBSZGET, TARGET_BLKBSZSETPeter Maydell2012-08-131-2/+2
| | | | | | | | | | | | The definitions for the ioctl numbers TARGET_BLKBSZGET and TARGET_BLKBSZSET had the wrong size parameters (they are defined with size_t, not int, even though the ioctl implementations themselves read and write integers). Since commit 354a0008 we now have an ioctl wrapper definition for BLKBSZGET and so on an x86-64-to-x86-64 linux-user binary we were triggering the mismatch warning in syscall_init(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* unicore32-softmmu: Make UniCore32 cpuid & exceptions correct and runableGuan Xuetao2012-08-111-1/+2
| | | | | | | | | | This patch initializes the cpuid to exactly correct value because linux kernel will check it. In addition, the exception types are specified in proper situations. Then it could make exceptions generated correctly and timely. Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* sparc: fix expression with uninitialized initial valueBlue Swirl2012-08-091-5/+3
| | | | | | | | | err was uninitialized, it's not OK to use |=. Spotted by Clang compiler. Fix by implementing the earlier statement which initializes the variable. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* alpha-linux-user: Fix the getpriority syscallRichard Henderson2012-08-041-5/+15
| | | | | | | | | Alpha uses unbiased priority values in the syscall, with the a3 return value signaling error conditions. Therefore, properly interpret the libc getpriority as needed for the guest rather than passing the host value through unchanged. Signed-off-by: Richard Henderson <rth@twiddle.net>
* alpha-linux-user: Properly handle the non-rt sigprocmask syscall.Richard Henderson2012-08-042-3/+2
| | | | | | | | Name the syscall properly for QEMU, kernel source notwithstanding. Fix syntax errors in the code thus enabled within do_syscall. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
* alpha-linux-user: Fix a3 error return with v0 error bypass.Richard Henderson2012-08-041-7/+5
| | | | | | | We were failing to initialize a3 for syscalls that bypass the negative return value error check. Signed-off-by: Richard Henderson <rth@twiddle.net>
* linux-user: Translate pipe2 flags; add to straceRichard Henderson2012-08-042-1/+5
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
* linux-user: Allocate the right amount of space for non-fixed file mapsRichard Henderson2012-08-041-11/+19
| | | | | | | | | | | | If we let the kernel handle the implementation of mmap_find_vma, via an anon mmap, we must use the size as indicated by the user and not the size truncated to the filesize. This happens often in ld.so, where we initially mmap the file to the size of the text+data+bss to reserve an area, then mmap+fixed over the top to properly handle data and bss. Signed-off-by: Richard Henderson <rth@twiddle.net>
* linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATHRichard Henderson2012-08-042-2/+25
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
* linux-user: Sync fcntl.h bits with the kernelRichard Henderson2012-08-041-102/+92
| | | | | | | | For each target, only define the bits that appear in arch/target/include/asm/fcntl.h. Mirror the kernel's asm-generic layout by handling anything undefined afterward. Signed-off-by: Richard Henderson <rth@twiddle.net>
* alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properlyRichard Henderson2012-08-041-10/+51
| | | | | | | We weren't aggregating the exceptions, nor raising signals properly. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
* alpha-linux-user: Fix signal handlingRichard Henderson2012-08-042-1/+43
| | | | | | | | Proper signal numbers were not defined, and EXCP_INTERRUPT was unhandled, leading to all sorts of subtle confusion. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
* Support 'help' as a synonym for '?' in command line optionsPeter Maydell2012-08-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | For command line options which permit '?' meaning 'please list the permitted values', add support for 'help' as a synonym, by abstracting the check out into a helper function. This change means that in some cases where we were being lazy in our string parsing, "?junk" will now be rejected as an invalid option rather than being (undocumentedly) treated the same way as "?". Update the documentation to use 'help' rather than '?', since '?' is a shell metacharacter and thus prone to fail confusingly if there is a single character filename in the current working directory and the '?' has not been escaped. It's therefore better to steer users towards 'help', though '?' is retained for backwards compatibility. We do not, however, update the output of the system emulator's -help (or any documentation autogenerated from the qemu-options.hx which is the source of the -help text) because libvirt parses our -help output and will break. At a later date when QEMU provides a better interface so libvirt can avoid having to do this, we can update the -help text too. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Replace 'struct siginfo' with 'siginfo_t'.Richard W.M. Jones2012-08-011-4/+4
| | | | | | | | | | | | | | | glibc 2.16 will remove the undocumented definition of 'struct siginfo' from <bits/siginfo.h>. This change is already present in glibc 2.15.90, so qemu compilation of certain targets (eg. cris-user) breaks. This struct was always typedef'd to be the same as 'siginfo_t' which is what POSIX documents, so use that instead. Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud