diff options
author | Alistair Francis <alistair.francis@xilinx.com> | 2016-09-22 18:13:08 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-09-22 18:13:08 +0100 |
commit | 70bb1d16f4e8576eb9370ae6be244312cd96df78 (patch) | |
tree | e442d9fa5e168c1866a2cbc44fe589603ca0e86c /include/hw/loader.h | |
parent | 3e76099aacb4dae0d37ebf95305369e03d1491e6 (diff) | |
download | qemu-70bb1d16f4e8576eb9370ae6be244312cd96df78.zip qemu-70bb1d16f4e8576eb9370ae6be244312cd96df78.tar.gz qemu-70bb1d16f4e8576eb9370ae6be244312cd96df78.tar.bz2 |
loader: Add AddressSpace loading support to ELFs
Add a new function load_elf_as() that allows the caller to specify an
AddressSpace to use when loading the ELF. The original load_elf()
function doesn't have any change in functionality.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 8b5cefecdf56fba4ccdff2db880f0b6b264cf16f.1474331683.git.alistair.francis@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw/loader.h')
-rw-r--r-- | include/hw/loader.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/hw/loader.h b/include/hw/loader.h index 815a8d6..fdf0a51 100644 --- a/include/hw/loader.h +++ b/include/hw/loader.h @@ -45,7 +45,7 @@ int load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz); #define ELF_LOAD_WRONG_ENDIAN -4 const char *load_elf_strerror(int error); -/** load_elf: +/** load_elf_as: * @filename: Path of ELF file * @translate_fn: optional function to translate load addresses * @translate_opaque: opaque data passed to @translate_fn @@ -59,6 +59,8 @@ const char *load_elf_strerror(int error); * @data_swab: Set to order of byte swapping for data. 0 for no swap, 1 * for swapping bytes within halfwords, 2 for bytes within * words and 3 for within doublewords. + * @as: The AddressSpace to load the ELF to. The value of address_space_memory + * is used if nothing is supplied here. * * Load an ELF file's contents to the emulated system's address space. * Clients may optionally specify a callback to perform address @@ -71,7 +73,16 @@ const char *load_elf_strerror(int error); * If @elf_machine is EM_NONE then the machine type will be read from the * ELF header and no checks will be carried out against the machine type. */ +int load_elf_as(const char *filename, + uint64_t (*translate_fn)(void *, uint64_t), + void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr, + uint64_t *highaddr, int big_endian, int elf_machine, + int clear_lsb, int data_swab, AddressSpace *as); +/** load_elf: + * Same as load_elf_as(), but doesn't allow the caller to specify an + * AddressSpace. + */ int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t), void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr, int big_endian, int elf_machine, |