History | View | Annotate | Download (87.3 kB)
target-i386: Replace cpuid_*features fields with a feature word array
This replaces the feature-bit fields on both X86CPU and x86_def_tstructs with an array.
With this, we will be able to simplify code that simply does the sameoperation on all feature words (e.g. kvm_check_features_against_host(),...
elfload: fix size of ABI-dependent fields in core dumps
Some fields in core dumps are 32-bit in 32-or-64 environments (ppc64abi32,sparc32plus). Use abi_long/ulong for those.
Also, the fields of target_elf_siginfo are ints. Use tswap32 to convert them....
elfload: fix size of registers for N32
Registers are 64-bit in size for the MIPS n32 ABI. Definetarget_elf_greg_t accordingly, and use the correct functionto do endian swaps.
Reviewed-by: Peter Maydell <peter.maydell@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
elfload: use tswapreg consistently in elf_core_copy_regs
Reviewed-by: Peter Maydell <peter.maydell@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
elfload: use abi_short/ushort instead of target_short/ushort
The alignment is a characteristic of the ABI, not the CPU.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
elfload: use abi_int/uint instead of target_int/uint
elfload: use abi_llong/ullong instead of target_llong/ullong
build: kill libdis, move disassemblers to disas/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
linux-user: remove two unchecked uses of strdup
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>...
linux-user: Factor out guest space probing into a function
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>
linux-user: Use init_guest_space when -R and -B are specified
Roll the code used to initialize the guest memory space when -Ror -B is used into 'init_guest_space' and then call 'init_guest_space'from the driver. This way the reserved guest memory space can...
target-or32: Add linux user support
Add QEMU OpenRISC linux user support.
Signed-off-by: Jia Liu <proljc@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Userspace ARM BE8 support
Add support for ARM BE8 userspace binaries.i.e. big-endian data and little-endian code.In principle LE8 mode is also possible, but AFAIK has never actuallybeen implemented/used.
System emulation doesn't have any useable big-endian board models,...
arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.
The cpu capabilities passed by the elf loader in AT_HWCAP wherea constant.Make AT_HWCAP reflect the emulated cpu features in order to givecorrect clues to eglibc.
Riku Voipio: fixed to apply to current head...
Rename CPUState -> CPUArchState
Scripted conversion: for file in .[hc] hw/.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done...
linux-user: Don't overuse CPUState
In target-specific code use CPU*State.
While at it, fix indentation on those lines.
Signed-off-by: Andreas Färber <afaerber@suse.de>
linux-user: save auxv length
We create our own AUXV segment on stack and save a pointer to it.However we don't save the length of it, so any code that wants todo anything useful with it later on has to walk it again.
Instead, let's remember the length of our AUXV segment. This...
elf: Improve symbol lookup (optimize, fix for bsd-user)
Coverity complained about local variable key which was only partiallyinitiated. Only key.st_value was set. As this was also the only partof key which was used in function symfind, the code could be optimized...
fix spelling in linux-user sub directory
Cc: Riku Voipio <riku.voipio@iki.fi>Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
linux-user/elfload.c: Don't memset(NULL..) if malloc() failed
If a malloc() in copy_elf_strings() failed we would call memset()before the "did malloc fail?" check. Fix this by moving to theglib alloc/free routines for this memory so we can use g_try_malloc0...
ppc64-linux-user: Properly interpret the entry function descriptor.
Don't confuse the load address with the load bias. They're equalfor ET_DYN objects (i.e. ld.so) but different for ET_EXEC objects(i.e. statically linked).
Signed-off-by: Richard Henderson <rth@twiddle.net>...
linux-user: Implement new ARM 64 bit cmpxchg kernel helper
Linux 3.1 will have a new kernel-page helper for ARM implementing64 bit cmpxchg. Implement this helper in QEMU linux-user mode: * Provide kernel helper emulation for 64bit cmpxchg...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
set ELF_HWCAP for SPARC and SPARC64
setting ELF_HWCAP fixes dynamic library loading for Linux/sparc64This patch allows loading busybox from Debian 6 initrd
Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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...
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: 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"):...
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>
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>
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/elfload: add FDPIC support
Signed-off-by: Mike Frysinger <vapier@gentoo.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: Protect against allocation failure in load_symbols.
Cc: malc <av1474@comtv.ru>Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: malc <av1474@comtv.ru>
linux-user: Reduce lseek+reads while loading elf files.
Define BPRM_BUF_SIZE to 1k and read that amount initially. If thedata we want from the binary is in this buffer, use it instead ofreading from the file again.
linux-user: Define ELF_DATA generically.
The only consideration on this value is the target endianness.The existing defines were incorrect for alpha and sh4eb.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
linux-user: Clean up byte-swapping in elfload.c.
Remove ifdefs from code by defining empty inline functionswhen byte swapping isn't needed. Push loops over swappingarrays of structures into the swapping functions.
linux-user: Load symbols from the interpreter.
First, adjust load_symbols to accept a load_bias parameter. At the sametime, read the entire section header table in one go, use pread insteadf lseek+read for the symbol and string tables, and properly free...
linux-user: Improve consistency checking in elf headers.
Validate more fields of the elf header. Extract those checksinto two common functions to be used in both load_elf_interpand load_elf_binary.
linux-user: Put the stack guard page at the top.
There are no supported stack-grows-up targets. We were puttingthe guard page at the highest address, i.e. the bottom of the stack.Use the maximum of host and guest page size for the guard size.
linux-user: Remove partial support for a.out interpreters.
At the bottom of the a.out support was the unimplemented load_aout_interpfunction. There were other portions of the support that didn't lookright; when I went to look in the Linux kernel for clarification, I found...
linux-user: Extract load_elf_image from load_elf_interp.
Moving toward a single copy of the elf binary loading code.Fill in the details of the loaded image into a struct image_info.
Adjust create_elf_tables to read from such structures insteadof from a collection of passed arguments. Don't return error...
linux-user: Re-use load_elf_image for the main binary.
This requires moving the PT_INTERP extraction and GUEST_BASEhandling into load_elf_image. Key this off a non-null pointerargument to receive the interpreter name.
linux-user: Handle filesz < memsz for any PT_LOAD segment.
I caught padzero not properly initializing the .bss segmenton a statically linked Alpha program. Rather than a minimalpatch, replace the gross code with a single mmap+memset.
Share more code between load_elf_interp and load_elf_binary....
Add more DT_* and AT_* constants to qemu's copy of elf.h.
Moving some PPC AT_* constants from elfload.c at the same time.
linux-user: Reindent elfload.c.
Usermode exec-stack fix
When loading a shared library that requires an executable stack,glibc uses the mprotext PROT_GROWSDOWN flag to achieve this.We don't support PROT_GROWSDOWN.Add a special case to handle changing the stack permissions in this way....
Pre-allocate guest address space
Allow pre-allocation of the guest virtual address space in usermode emulation.
Signed-off-by: Paul Brook <paul@codesourcery.com>
microblaze: Update elf machine nums.
189 was allocated in upstream binutils.
0xbaab was the old temporary value. Still used by some tools and thelinux kernel.
I've seen 115 in older gdb versions, but lets ignore that one.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
microblaze: Add linux-user core dumping support.
Remove PAGE_RESERVED
The usermode PAGE_RESERVED code is not required by the current mmapimplementation, and is already broken when guest_base != 0.Unfortunately the bsd emulation still uses the old mmap implementation,so we can't rip it out altogether....
Better default guest_base
Avoid loading linux-user applications in address space already used/reservedby the host.
linux-user/ppc: use the Linux register layout
The dynamic linker converts the Linux layout to the AIX layout and isreentrant so it won't do it a second time if it's already beenconverted. In short it work just fine with either register layout.
OTOH, statically linked binaries expect a Linux layout....
linux-user: Use RLIMIT_STACK for default stack size.
The current default stack limit of 512kB is far too small; a fairnumber of gcc testsuite failures (for all guests) are directlyattributable to this. Using the -s option in every invocation ofthe emulator is annoying to say the least....
Fix usermode virtual address type
Usermode virtual addresses are abi_ulong, not target_ulong.
Disassembler symbol lookup fix
Fix function signature for userspace disassembler symbol lookup.
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>
linux-user: use TARGET_ABI_FMT_lx to print abi_ulong types
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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
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>
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: 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)....
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>
elfload: fix coding style nit
Put space between = and * when dereferencing 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>
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....
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,...
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...
More NULL pointer fixes
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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>...
linux-user: implemented ELF coredump support for ARM target
When target process is killed with signal (such signal thatshould dump core) a coredump file is created. This file issimilar than coredump generated by Linux (there are few exceptionsthough)....
linux-user: added x86 and x86_64 support for ELF coredump
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
microblaze: linux-user support.
support ELF_HWCAP for PPPC
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>Signed-off-by: malc <av1474@comtv.ru>
Convert references to logfile/loglevel to use qemu_log*() macros
This is a large patch that changes all occurrences of logfile/loglevelglobal variables to use the new qemu_log*() macros.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
Remove all traces of powerpc
According to $GCC/gcc/config/rs6000/rs6000-c.c _ARCH_PPC is theubiquitous define which should be used to test whether gcc targetsPowerPC, on 64bit platforms _ARCH_PPC64 will be also defined.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6301 c046a42c-6fe2-441c-8c8c-71466251a162
Export x86_stack_size in qemu.h
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5427 c046a42c-6fe2-441c-8c8c-71466251a162
Silence some warnings about uninitialized variables
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5362 c046a42c-6fe2-441c-8c8c-71466251a162
Suppress gcc 4.x -Wpointer-sign (included in -Wall) warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5275 c046a42c-6fe2-441c-8c8c-71466251a162
Kludge to support linux-user on a PPC64
Some headers (e.g. signal.h) include asm/elf.h and the chaos of macroredefinitions ensues, this kludge avoids it.
Alternative way to fight that would be to change all ELF_XXX and someother definitions to QEMU_ELF_XXX or something to that effect....
Multithreaded locking fixes.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4692 c046a42c-6fe2-441c-8c8c-71466251a162
Implement AT_CLKTCK.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4113 c046a42c-6fe2-441c-8c8c-71466251a162
suppressed tgetx and tputx (initial patch by Thayne Harbaugh)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3653 c046a42c-6fe2-441c-8c8c-71466251a162
Linux user memory access API change (initial patch by Thayne Harbaugh)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3583 c046a42c-6fe2-441c-8c8c-71466251a162
Implement missing MIPS supervisor mode bits.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3472 c046a42c-6fe2-441c-8c8c-71466251a162
PowerPC user-mode fix: MSR is now entirelly set-up in the cpu_reset routine.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3457 c046a42c-6fe2-441c-8c8c-71466251a162
Use the new TARGET_ABI32 feature to implement a ppc64abi32-linux-user target (PowerPC 64 running in 32 bits mode).Use the new TARGET_ABI_DIR feature to implement a ppcemb-linux-user target (PowerPC 32 with 64 bits GPRs and vector extensions).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3409 c046a42c-6fe2-441c-8c8c-71466251a162
Support for 32 bit ABI on 64 bit targets (only enabled Sparc64)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3396 c046a42c-6fe2-441c-8c8c-71466251a162
Support for executing 32 bit SPARC32PLUS files for Sparc64 user emulator
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3378 c046a42c-6fe2-441c-8c8c-71466251a162
CRIS Linux userland emulation, part 2. By Edgar E. Iglesias.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3367 c046a42c-6fe2-441c-8c8c-71466251a162
Fix confusions between host and target long types.Fix start_data computation.Fix auxiliary infos setup.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3344 c046a42c-6fe2-441c-8c8c-71466251a162