projects
/
qemu
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove obsolete comment.
[qemu]
/
elf_ops.h
diff --git
a/elf_ops.h
b/elf_ops.h
index
4da755e
..
3fdde81
100644
(file)
--- 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 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;
{
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;
elf_word mem_size, addr;
uint8_t *data = NULL;
@@
-153,6
+155,9
@@
int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend,
glue(bswap_ehdr, SZ)(&ehdr);
}
glue(bswap_ehdr, SZ)(&ehdr);
}
+ if (ELF_MACHINE != ehdr.e_machine)
+ goto fail;
+
if (pentry)
*pentry = (uint64_t)ehdr.e_entry;
if (pentry)
*pentry = (uint64_t)ehdr.e_entry;
@@
-190,15
+195,23
@@
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;
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(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);
qemu_free(phdr);
return -1;
}
return total_size;
fail:
qemu_free(data);
qemu_free(phdr);
return -1;
}
-