summaryrefslogtreecommitdiff
path: root/elf_ops.h
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-01 17:56:37 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-01 17:56:37 +0000
commit74287114c98ecb969b7ce4b5c959da8a8a431d0f (patch)
treed82c33d09efeb9dff7a5b9b20324ee507f0458d1 /elf_ops.h
parent4f14e88c5991877085b1090508ee222d6f3ef088 (diff)
downloadqemu-74287114c98ecb969b7ce4b5c959da8a8a431d0f.tar.gz
qemu-74287114c98ecb969b7ce4b5c959da8a8a431d0f.tar.bz2
qemu-74287114c98ecb969b7ce4b5c959da8a8a431d0f.zip
Improved initrd support for mips.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2574 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'elf_ops.h')
-rw-r--r--elf_ops.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/elf_ops.h b/elf_ops.h
index abcce093ef..3fdde81287 100644
--- a/elf_ops.h
+++ b/elf_ops.h
@@ -139,11 +139,13 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab)
}
int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend,
- int must_swab, uint64_t *pentry)
+ int must_swab, uint64_t *pentry,
+ uint64_t *lowaddr, uint64_t *highaddr)
{
struct elfhdr ehdr;
struct elf_phdr *phdr = NULL, *ph;
int size, i, total_size;
+ elf_word low = 0, high = 0;
elf_word mem_size, addr;
uint8_t *data = NULL;
@@ -193,12 +195,20 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend,
cpu_physical_memory_write_rom(addr, data, mem_size);
total_size += mem_size;
+ if (!low || addr < low)
+ low = addr;
+ if (!high || (addr + mem_size) > high)
+ high = addr + mem_size;
qemu_free(data);
data = NULL;
}
}
qemu_free(phdr);
+ if (lowaddr)
+ *lowaddr = (uint64_t)low;
+ if (highaddr)
+ *highaddr = (uint64_t)high;
return total_size;
fail:
qemu_free(data);