Fix build with -DNDEBUG in CFLAGS
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix usermode virtual address type
Usermode virtual addresses are abi_ulong, not target_ulong.
Signed-off-by: Paul Brook <paul@codesourcery.com>
linux-user: Fix mmap_find_vma returning invalid addresses.
Don't return addresses that aren't properly aligned for the guest,e.g. when the guest has a larger page size than the host. Don'treturn addresses that are outside the virtual address space for the...
linux-user: Use h2g_valid in qemu_vmalloc.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Update to a hopefully more future proof FSF address
See also 8167ee883931cb20c6264fc19d040ce2dc6ceaaa,530e7615ce3c01882e582c84dc6304ab98a3d5c5 andfad6cb1a565bb73f83fc0e2654489457b489e436.
linux-user: Save/restore fpu registers to signal context on sh4
As "todo" comment in source code.And modify restore_sigcontext() to have three args as kernel's does.
Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
linux-user: Fix syscall pipe2() retval on sh4
On linux/sh4 pipe() return values by r0:r1 as SH C calling convention. pipe2() return values on memory as traditional unix way.
Disassembler symbol lookup fix
Fix function signature for userspace disassembler symbol lookup.
alpha-linux-user: Implement signals.
Move userland PALcode handling into linux-user main loop so thatwe can send signals from there. This also makes alpha_palcode.csystem-level only, so don't build it for userland. Add definesfor GENTRAP PALcall mapping to signals....
target-alpha: Reduce internal processor registers for user-mode.
The existing set of IPRs is totally irrelevant to user-mode emulation.Indeed, they most are irrelevant to implementing kernel-mode emulation,and would only be relevant to PAL-mode emulation, which I suspect that...
Add cpu model configuration support..
This is a reimplementation of prior versions which addsthe ability to define cpu models for contemporary processors.The added models are likewise selected via -cpu <name>,and are intended to displace the existing convention...
Fix strace or FUTEX_PRIVATE_FLAG
FUTEX_PRIVATE_FLAG is a bit orred with an existing futex op,not a distinct value.
linux-user: adapt uname machine to emulated CPU
This patch for linux-user adapts the output of the emulated uname()syscall to match the configured CPU. Tested with x86, x86-64 and armemulation.
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>Signed-off-by: Loïc Minier <lool@dooz.org>
linux-user/mmap.c: fix warnings with _FORTIFY_SOURCE
CC i386-linux-user/mmap.occ1: warnings being treated as errors/usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c: In function 'mmap_frag':/usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c:253: error: ignoring return value of 'pread', declared with attribute warn_unused_result...
mmap_frag() users only check for -1 error
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
fix linux-user microblaze ELF_ARCH definition
Signed-off-by: Mike Frysinger <vapier@gentoo.org>Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
alpha: fix stat64 issue
The stat64/fstat64 syscalls are broken for alpha linux-user.
This is because Alpha, even though it is native 64-bits, has a stat64syscall that is different than regular stat. This means that the"TARGET_LONG_BITS==64" check in syscall.c isn't enough. Below is...
linux-user: fix build with gcc-4.1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
PPC: Make DCR uint32_t
For what I know DCR is always 32 bits wide, so we should also use uint32_t topass it along the stacks.
This fixes a warning when compiling qemu-system-ppc64 with KVM enabled, makingit compile without --disable-werror
Signed-off-by: Alexander Graf <agraf@suse.de>...
PPC64: Fix alternate timebase
Fix the alternate time base the same way as the default timebase. SPR_ATBLshould return a 64-bit value on 64 bit implementations.
PPC64: Fix timebase
On PPC we have a 64-bit time base. Usually (PPC32) this is accessed usingtwo separate 32 bit SPR accesses to SPR_TBU and SPR_TBL.
On PPC64 the SPR_TBL register acts as 64 bit though, so we get the full64 bits as return value. If we only take the lower ones, fine. But Linux...
linux-user: Add aliases for some Alpha syscalls
Alpha always used 32-bit uids, but never renamed the syscallsto match i386 when 32-bit uids were added there. This enablesthe proper bits in syscall.c.
Signed-off-by: Richard Henderson <rth@twiddle.net>...
linux-user: use TARGET_ABI_FMT_lx to print abi_ulong types
linux-user: fix ELF_USE_CORE_DUMP/USE_ELF_CORE_DUMP confusion
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
linux-user: commonify definitions of target typedefs
There's no sense in separately declaring target_{elf_greg,uid,gid,pid}_tfor every architecture. Just declare them once with appropriateUSE_UID16 handling.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>...
linux-user: fix ARM core dumps on opposite-endian hosts
linux-user: add core dump support for PPC
linux-user: add core dump support for MIPS
linux-user: add core dump support for M68K
linux-user: add core dump support for SH
linux-user: Fix mmap_lock ordering
mmap_lock() can be called while tb_lock() is being held. Toavoid deadlock when one thread is holding mmap_lock and anothertb_lock, always lock first tb_lock().
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
linux-user: cleanup force_sig() calls
Force_sig should be always called with TARGET_ signals.Not that it really matters with SEGV, so this patch isjust for cleanup and improving consistency.
target-alpha: Drop bogus UNIQ initial value on Linux.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-alpha: Fixes for alpha-linux syscalls.
1. Add correct definitions of error numbers.2. Implement SYS_osf_sigprocmask3. Implement SYS_osf_get/setsysinfo for IEEE_FP_CONTROL.
This last requires exposing the FPCR value to do_syscall.Since this value is actually split up into the float_status,...
Fix ARM userspace strex implementation.
linux-user: remove hardcoded value of _NSIG in signal.c
In a bunch of places, 64 is used as value of _NSIG but it's wrongat least on MIPS were _NSIG is 128.
Based on a patch from Arnaud Patard <arnaud.patard@rtp-net.org>
Add missing break.
ARM atomic ops rewrite
Implement ARMv6 atomic ops (ldrex/strex) using the same trick as PPC.
target-mips: rename CP0_LLAddr into lladdr
The variable CP0_LLAddr represent the full lladdr, not the actualregister value, which is only part of this value and depends on theCPU.
(x86/Sparc/PPC)-user: fix cpu_copy
b55a37c981914aa8ecd21b9a2a2fb37f39b917c5 moved the call to cpu_resetto user emulators. But cpu_copy also initializes a CPU structure, so add thecall also there.
user: move CPU reset call to main.c for x86/PPC/Sparc
Re: linux-user/syscall.c - don't add GUEST_BASE to NULL pointer
This patch fixes the mount call. GUEST_BASE shouldn't be added to a NULL pointer on arg5 . failing call:mount("rootfs", "/", 0x47a78, MS_MGC_VAL|MS_REMOUNT, 0x10000) = -1 EFAULT (Bad address)...
linux-user: KD/VT/FB ioctls
everything needed to run SDL on a framebuffer device in the userspace emulator
Signed-off-by: Ulrich Hecht <uli@suse.de>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: Update ARM hwcaps
Update ARM hwcaps to match Linux kernel 2.6.31 state
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: don't zero a buffer twice
prepare_binprm() zeroes bprm->buf. That buffer is already zeroed inmain() and hasn't been touched since so that is not necessary.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: fix ppc target_stat64 st_blocks layout
Swap __pad1 and st_blocks fields location to maintain proper alignment.This fixes incorrect 'du' and 'stat' report on ppc guest.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
implementations of dup3 and fallocate that are good enough to fool LTP
updated fallocate check to new configure, added dup3 check as suggestedby Jan-Simon Möller.
Riku: updated to apply to current git.
linux-user: getpriority errno fix
getpriority returned wrong errno; fixes LTP test getpriority02.
linux-user: fix "#if 0"'d printf()
Make an "#if 0"'d printf() in load_elf_binary(), probably left to aid indebugging, reflect what the actual code does. The current printf() willonly confuse those who "#if 1" it (it certainly confused me enough towrite this trivial patch)....
linux-user: fix up oversealous nitpicking
Looks like linux-user code was correct, just unreadable: what it wantedto do with "-=" was really assign a negative number, not decrement. Fixup accordingly.
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>...
Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.
The naming convention is goofy and it causes a massive merge problem. Somethinglike this must be presented on the list first so people can provide input...
Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the timebeing.
Signed-off-by: malc <av1474@comtv.ru>
linux-user: fix coding style nit
Put space between = and & when taking a pointer,to avoid confusion with old-style "&=".
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
elfload: fix coding style nit
Put space between = and * when dereferencing a pointer,to avoid confusion with old-style "*="
linux-user: fix old style decrement usage
Modern compilers do not parse "=-" as decrement:you must use "-=" for that.
__thread should be before real type
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
static and inline should came before the type of the functions
Export tables properly to avoid a Sparse warning
Fix Sparse warnings about using plain integer as NULL pointer
Compile loader only once
Callers must pass ELF machine, byte swapping and symbol LSB clearinginformation to ELF loader. A.out loader needs page size information, passthat too as a parameter.
Extract prototypes to a separate file. Move loader.[ch] and elf_ops.h under hw....
Revert "Fix Sparc/Linux host breakage by df70204db53e3611af986f434e74a882bce190ca"
This reverts commit 91b40c5be84a478e98c0416325844a7f66d0efae.
Fix Sparc/Linux host breakage by df70204db53e3611af986f434e74a882bce190ca
While i386, x86_64 and Sparc64/OpenBSD still worked afterdf70204db53e3611af986f434e74a882bce190ca, Sparc32 and Sparc64 Linux hostsbroke.
Partially revert the commit: make the restored code conditional to...
Fix text relocations in linux-user targets
There is a link hack in linux-user which produces an executable thatlooks like PIE, but always has text relocations since all object filesisn't position-independent (compiled without -fpic/-fpie). Dynamic loader...
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
F_DUPFD_CLOEXEC is not universally available
The same issue (and the same patch to the byte) was experienced/proposedby Vince Weaver.
Fix Sparse warnings: add "static"
linux-user: fadvise64 implementation
good enough to pass all LTP fadvise64 tests
linux-user: zero fstat buffer to initialize nsec fields
The fstat implementation does not initialize the nanosecond fields in thestat buffer; this caused funny values to turn up there, preventing, forinstance, cp -p from preserving timestamps because utimensat rejected...
linux-user: Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit targets
qemu's page table can be incomple if /proc/self/maps is unavailable orhost allocating a memory with mmap(), so we can't use it to find freememory area.
New version mmap_find_vma() uses mmap() without MAP_FIXED to find free...
m68k, linux-user: add setup_rt_frame
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: enable sigaltstack()
As setup_frame() and setup_rt_frame() are now implemented we can nowenable sigaltstack().
linux-user: fix mq_* compilation problems
mqueue.h is only available if _NR_mq_open is defined. So don't includeit unconditionally. Similarly, the mq* family of syscalls depend on_NR_mq_open. Finally, the copy{from,to}_user_mq_attr functions should...
linux-user: fcntl fixes for LTP
Fixes swaps on l_pid which were pretty much of random size. ImplementsF_SETLEASE, F_GETLEASE. Now passes all LTP fcntl tests.
linux-user: enable getdents for > 32-bit systems
works perfectly fine with the example from getdents(2) and passes the LTPtests (tested with s390x on x86_64 emulation)
m68k,linux-user: add setup_frame
This patch adds signals management for linux-user.
It implements setup_frame() which allows to call the user signalhandler.
setup_rt_frame() is always unimplemented.
linux-user: add eventfd support
Straightforward implementation. This syscall is rare enough that wedon't need to support the odder cases, just disable it if host glibcis too old.
Replace local ADDRX/PADDRX macros with TARGET_FMT_lx/plx
linux-user: compile envlist.c only once
user: compile path.c only once
Also merge bsd-user/path.c and linux-user/path.c.
Fix symfind.
this patch fixes an issue in symfind.
Assume you have the following symbols:
Address Size0045bca0 00000080 T s00045bd20 00000112 T s1
You'll notice that s1 is s0 + size.
So the current symfind will find that address 0045bd20 belongs to s0...
Sparc64: replace tsptr with helper routine
tl and tsptr of members sparc64 cpu state must be changedsimultaneously to keep trap state window in sync with currenttrap level. Currently translation of store to tl does not changetsptr, which leads to corrupt trap state on corresponding...
linux-user: make FUTEX_* calls honor timeout parameter
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>Signed-off-by: malc <av1474@comtv.ru>
linux-user: handle POWERPC_EXCP_STCX
We handle conditional stores as an exception so we can ensure that noother thread is changing memory out from underneath us.
More NULL pointer fixes
rename USE_NPTL to CONFIG_USE_NPTL
rename HAVE_GPROF to TARGET_GPROF
Use was not consistent, in Makefile was TARGET_GPROF and in *h HAVE_GPROF
rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIAN
Fix most warnings (errors with -Werror) when debugging is enabled
I used the following command to enable debugging:perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * /* *//*
Use correct byteswap routine for elf_note
All elf64_note structure members are Elf64_Word (which is 32bit value)hence using bswaptls to byteswap it on 64bit platforms is incorrect.
Avoid name clashes with symbols that leak from system headers
ELF codedump build failures
Rename ELF coredump types to avoid conflict with the corresponding host types.
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Userspace guest address offsetting
Re-implement GUEST_BASE support.Offset guest ddress space by default if the guest binary containsregions below the host mmap_min_addr.Implement support for i386, x86-64 and arm hosts.
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>...
Avoid SIGSEGV when dumping cpu state without enabled logging
consolidate user cpu_{in, out}[bwl] into ioport-user.c
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-staging
MIPS signal handling fix
Add explicit padding to MIPS signal frame structures.
MIPS atomic instructions
Implement MIPS ll/sc instructions using atomic compare+exchange.
Fix MIPS sys_clone
The clone syscall takes 6 args.
getrlimit conversion mix-up
Fixes getrlimit implementation that overwrote the result of the syscallinstead of converting it