--- hw/elf_ops.h | 2 ++ hw/loader.c | 7 +++++++ hw/loader.h | 2 ++ 3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/hw/elf_ops.h b/hw/elf_ops.h index 645d058..5bcba7e 100644 --- a/hw/elf_ops.h +++ b/hw/elf_ops.h @@ -247,6 +247,8 @@ static int glue(load_elf, SZ)(const char *name, int fd, glue(bswap_ehdr, SZ)(&ehdr); } + handlers->header_notify_fn(handlers->header_notify_opaque, &ehdr, SZ); + switch (elf_machine) { case EM_PPC64: if (EM_PPC64 != ehdr.e_machine) diff --git a/hw/loader.c b/hw/loader.c index cb430e0..6a43fda 100644 --- a/hw/loader.c +++ b/hw/loader.c @@ -239,11 +239,18 @@ static uint64_t elf_default_translate(void *opaque, uint64_t addr) return addr; } +static void elf_default_header_notify(void *opaque, void *ehdr, int bits) +{ + return; +} + ElfHandlers elf_default_handlers = { .translate_fn = elf_default_translate, .translate_opaque = NULL, .note_fn = elf_default_note, .note_opaque = NULL, + .header_notify_fn = elf_default_header_notify, + .header_notify_opaque = NULL, }; diff --git a/hw/loader.h b/hw/loader.h index 29d5c71..090b815 100644 --- a/hw/loader.h +++ b/hw/loader.h @@ -12,6 +12,8 @@ typedef struct ElfHandlers { void (*note_fn)(void *opaque, uint8_t *name, uint32_t name_len, uint8_t *desc, uint32_t desc_len, uint32_t type); void *note_opaque; + void (*header_notify_fn)(void *opaque, void *ehdr, int bits); + void *header_notify_opaque; } ElfHandlers; extern ElfHandlers elf_default_handlers; -- 1.6.0.2