* [Qemu-devel] [5513] Use load address when loading ELF images.
@ 2008-10-22 18:20 Paul Brook
0 siblings, 0 replies; only message in thread
From: Paul Brook @ 2008-10-22 18:20 UTC (permalink / raw)
To: qemu-devel
Revision: 5513
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5513
Author: pbrook
Date: 2008-10-22 18:20:20 +0000 (Wed, 22 Oct 2008)
Log Message:
-----------
Use load address when loading ELF images.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Modified Paths:
--------------
trunk/elf_ops.h
trunk/loader.c
trunk/sysemu.h
Modified: trunk/elf_ops.h
===================================================================
--- trunk/elf_ops.h 2008-10-22 16:14:08 UTC (rev 5512)
+++ trunk/elf_ops.h 2008-10-22 18:20:20 UTC (rev 5513)
@@ -177,7 +177,7 @@
return -1;
}
-static int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend,
+static int glue(load_elf, SZ)(int fd, int64_t address_offset,
int must_swab, uint64_t *pentry,
uint64_t *lowaddr, uint64_t *highaddr)
{
@@ -229,7 +229,9 @@
if (read(fd, data, ph->p_filesz) != ph->p_filesz)
goto fail;
}
- addr = ph->p_vaddr + virt_to_phys_addend;
+ /* address_offset is hack for kernel images that are
+ linked at the wrong physical address. */
+ addr = ph->p_paddr + address_offset;
cpu_physical_memory_write_rom(addr, data, mem_size);
Modified: trunk/loader.c
===================================================================
--- trunk/loader.c 2008-10-22 16:14:08 UTC (rev 5512)
+++ trunk/loader.c 2008-10-22 18:20:20 UTC (rev 5513)
@@ -282,7 +282,7 @@
#include "elf_ops.h"
/* return < 0 if error, otherwise the number of bytes loaded in memory */
-int load_elf(const char *filename, int64_t virt_to_phys_addend,
+int load_elf(const char *filename, int64_t address_offset,
uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr)
{
int fd, data_order, host_data_order, must_swab, ret;
@@ -317,10 +317,10 @@
lseek(fd, 0, SEEK_SET);
if (e_ident[EI_CLASS] == ELFCLASS64) {
- ret = load_elf64(fd, virt_to_phys_addend, must_swab, pentry,
+ ret = load_elf64(fd, address_offset, must_swab, pentry,
lowaddr, highaddr);
} else {
- ret = load_elf32(fd, virt_to_phys_addend, must_swab, pentry,
+ ret = load_elf32(fd, address_offset, must_swab, pentry,
lowaddr, highaddr);
}
Modified: trunk/sysemu.h
===================================================================
--- trunk/sysemu.h 2008-10-22 16:14:08 UTC (rev 5512)
+++ trunk/sysemu.h 2008-10-22 18:20:20 UTC (rev 5513)
@@ -160,7 +160,7 @@
int get_image_size(const char *filename);
int load_image(const char *filename, uint8_t *addr); /* deprecated */
int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz);
-int load_elf(const char *filename, int64_t virt_to_phys_addend,
+int load_elf(const char *filename, int64_t address_offset,
uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr);
int load_aout(const char *filename, target_phys_addr_t addr, int max_sz);
int load_uboot(const char *filename, target_ulong *ep, int *is_linux);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-22 18:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-22 18:20 [Qemu-devel] [5513] Use load address when loading ELF images Paul Brook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).