| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch allows to really use the core dumped by qemu with guest
architecture 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
filesz 0x00000000 memsz 0x00100000 flags ---
0x1000000 off 0x00200000 vaddr 0x00100400 paddr 0x00000000 align 2**21
filesz 0x00000000 memsz 0x00080000 flags --- 6000000
AFTER:
LOAD off 0x00002000 vaddr 0x00040000 paddr 0x00000000 align 2**13
filesz 0x00000000 memsz 0x00001000 flags ---
LOAD off 0x00002000 vaddr 0x00041000 paddr 0x00000000 align 2**13
filesz 0x00000000 memsz 0x00000800 flags rw-
- it doesn't pad the note size to sizeof(int32_t).
On m68k the NT_PRSTATUS note size is 154 and
must not be rounded up to 156, because this value is checked by
objdump and gdb.
"gdb" symptoms:
"warning: Couldn't find general-purpose registers in core file."
"objdump -x" sample:
BEFORE:
Sections:
Idx Name Size VMA LMA File off Algn
0 note0 000001c4 00000000 00000000 000003b4 2**0
CONTENTS, READONLY
1 .auxv 00000070 00000000 00000000 00000508 2**2
CONTENTS
2 proc1 00100000 00000400 00000000 00200000 2**10
READONLY
AFTER:
Sections:
Idx Name Size VMA LMA File off Algn
0 note0 000001c4 00000000 00000000 000003b4 2**0
CONTENTS, READONLY
1 .reg/19022 00000050 00000000 00000000 0000040e 2**2
CONTENTS
2 .reg 00000050 00000000 00000000 0000040e 2**2
CONTENTS
3 .auxv 00000070 00000000 00000000 00000508 2**2
CONTENTS
4 load1 00000000 00040000 00000000 00002000 2**13
ALLOC, READONLY
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
|
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
|
|
|
|
|
|
| |
Cc: malc <av1474@comtv.ru>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: malc <av1474@comtv.ru>
|
|
|
|
|
|
|
|
|
| |
This requires moving the PT_INTERP extraction and GUEST_BASE
handling into load_elf_image. Key this off a non-null pointer
argument to receive the interpreter name.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 instead
of from a collection of passed arguments. Don't return error
values from load_elf_interp; always exit(-1) with a message to
stderr. Collect elf_interpreter handling in load_elf_binary
to a common spot.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
At the bottom of the a.out support was the unimplemented load_aout_interp
function. There were other portions of the support that didn't look
right; when I went to look in the Linux kernel for clarification, I found
that the support for such interpreters has been removed from binfmt_elf.
There doesn't seem to be any reason to keep this broken support in qemu.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
|
| |
There are no supported stack-grows-up targets. We were putting
the 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.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
|
| |
Validate more fields of the elf header. Extract those checks
into two common functions to be used in both load_elf_interp
and load_elf_binary.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First, adjust load_symbols to accept a load_bias parameter. At the same
time, read the entire section header table in one go, use pread instead
f lseek+read for the symbol and string tables, and properly free
allocated structures on error exit paths.
Second, adjust load_elf_interp to compute load_bias. This requires
finding out the built-in load addresses. Which allows us to honor a
pre-linked interpreter image when possible, and eliminate the hard-coded
INTERP_MAP_SIZE value.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
|
| |
Remove ifdefs from code by defining empty inline functions
when byte swapping isn't needed. Push loops over swapping
arrays of structures into the swapping functions.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
Define BPRM_BUF_SIZE to 1k and read that amount initially. If the
data we want from the binary is in this buffer, use it instead of
reading from the file again.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
| |
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
| |
Moving some PPC AT_* constants from elfload.c at the same time.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I caught padzero not properly initializing the .bss segment
on a statically linked Alpha program. Rather than a minimal
patch, replace the gross code with a single mmap+memset.
Share more code between load_elf_interp and load_elf_binary.
Legally, an ELF program need not have just a single .bss;
and PT_LOAD segment can have memsz > filesz.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
|
|
| |
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.
Signed-off-by: Paul Brook <paul@codesourcery.com>
|
|
|
|
|
|
| |
Allow pre-allocation of the guest virtual address space in usermode emulation.
Signed-off-by: Paul Brook <paul@codesourcery.com>
|
|
|
|
|
|
|
|
|
|
|
| |
189 was allocated in upstream binutils.
0xbaab was the old temporary value. Still used by some tools and the
linux kernel.
I've seen 115 in older gdb versions, but lets ignore that one.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
| |
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
|
|
| |
Avoid loading linux-user applications in address space already used/reserved
by the host.
Signed-off-by: Paul Brook <paul@codesourcery.com>
|
|
|
|
|
|
|
|
|
| |
The usermode PAGE_RESERVED code is not required by the current mmap
implementation, 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.
Signed-off-by: Paul Brook <paul@codesourcery.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The dynamic linker converts the Linux layout to the AIX layout and is
reentrant so it won't do it a second time if it's already been
converted. In short it work just fine with either register layout.
OTOH, statically linked binaries expect a Linux layout.
Remove code converting the Linux layout to AIX layout so that all
binaries are presented the Linux Layout.
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current default stack limit of 512kB is far too small; a fair
number of gcc testsuite failures (for all guests) are directly
attributable to this. Using the -s option in every invocation of
the emulator is annoying to say the least.
A reasonable compromise seems to be to honor the system rlimit.
At least on two Linux distributions, this is set to 8MB and 10MB
respectively. If the system does not limit the stack, then we're
no worse off than before.
At the same time, rename the variable from x86_stack_size and
change the ultimate fallback size from 512kB to 8MB.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
|
| |
Usermode virtual addresses are abi_ulong, not target_ulong.
Signed-off-by: Paul Brook <paul@codesourcery.com>
|
|
|
|
|
|
| |
Fix function signature for userspace disassembler symbol lookup.
Signed-off-by: Paul Brook <paul@codesourcery.com>
|
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
|
|
|
|
|
| |
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
| |
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
| |
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
| |
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
| |
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
|
|
|
|
| |
There's no sense in separately declaring target_{elf_greg,uid,gid,pid}_t
for every architecture. Just declare them once with appropriate
USE_UID16 handling.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
| |
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
| |
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
| |
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
|
| |
Update ARM hwcaps to match Linux kernel 2.6.31 state
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
|
|
|
|
|
|
|
|
|
|
| |
Make an "#if 0"'d printf() in load_elf_binary(), probably left to aid in
debugging, reflect what the actual code does. The current printf() will
only confuse those who "#if 1" it (it certainly confused me enough to
write this trivial patch).
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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. Something
like this _must_ be presented on the list first so people can provide input
and cope with it.
This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
|
|
|
|
|
| |
Some not so obvious bits, slirp and Xen were left alone for the time
being.
Signed-off-by: malc <av1474@comtv.ru>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Callers must pass ELF machine, byte swapping and symbol LSB clearing
information to ELF loader. A.out loader needs page size information, pass
that too as a parameter.
Extract prototypes to a separate file. Move loader.[ch] and elf_ops.h under hw.
Adjust callers. Also use target_phys_addr_t instead of target_ulong for
addresses: loader addresses aren't virtual.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,
f40d753718c72693c5f520f0d9899f6e50395e94,
96555a96d724016e13190b28cffa3bc929ac60dc and
3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile.
Solution: Avoid the conflict entirely by renaming the functions and the
file. Revert the previous hacks.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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:
|
|
|
|
| |
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: malc <av1474@comtv.ru>
|
|
|
|
|
|
| |
Rename ELF coredump types to avoid conflict with the corresponding host types.
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|