From fef28891aa401e8f9d048c65f32067f51d695f4e Mon Sep 17 00:00:00 2001 From: Stefano Garzarella Date: Wed, 24 Jul 2019 16:31:03 +0200 Subject: loader: Handle memory-mapped ELFs This patch allows handling an ELF memory-mapped, taking care the reference count of the GMappedFile* passed through rom_add_elf_program(). In this case, the 'data' pointer is not heap-allocated, so we cannot free it. Suggested-by: Paolo Bonzini Signed-off-by: Stefano Garzarella Message-Id: <20190724143105.307042-2-sgarzare@redhat.com> Signed-off-by: Paolo Bonzini --- include/hw/loader.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/hw/loader.h') diff --git a/include/hw/loader.h b/include/hw/loader.h index 3e1b3a4..07fd928 100644 --- a/include/hw/loader.h +++ b/include/hw/loader.h @@ -258,8 +258,9 @@ MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len, FWCfgCallback fw_callback, void *callback_opaque, AddressSpace *as, bool read_only); -int rom_add_elf_program(const char *name, void *data, size_t datasize, - size_t romsize, hwaddr addr, AddressSpace *as); +int rom_add_elf_program(const char *name, GMappedFile *mapped_file, void *data, + size_t datasize, size_t romsize, hwaddr addr, + AddressSpace *as); int rom_check_and_register_reset(void); void rom_set_fw(FWCfgState *f); void rom_set_order_override(int order); -- cgit v1.1