Message ID | 20250219021758.190644-1-maobibo@loongson.cn (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | hw/elf_ops: Use physical address about kernel entry | expand |
diff --git a/include/hw/elf_ops.h.inc b/include/hw/elf_ops.h.inc index 9c35d1b9da..37ce7845a9 100644 --- a/include/hw/elf_ops.h.inc +++ b/include/hw/elf_ops.h.inc @@ -388,7 +388,11 @@ static ssize_t glue(load_elf, SZ)(const char *name, int fd, *pflags = ehdr.e_flags; } if (pentry) { - *pentry = ehdr.e_entry; + if (translate_fn) { + *pentry = translate_fn(translate_opaque, ehdr.e_entry); + } else { + *pentry = ehdr.e_entry; + } } glue(load_symbols, SZ)(&ehdr, fd, must_swab, clear_lsb, sym_cb);
With load_elf() API, if input parameter translate_fn is set, loading address is converted to physical address. It should be the same for entry address, since MMU is disabled when system power on, the first instruction of PC should be physical address. Signed-off-by: Bibo Mao <maobibo@loongson.cn> --- include/hw/elf_ops.h.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) base-commit: db7aa99ef894e88fc5eedf02ca2579b8c344b2ec