diff options
author | Samuel Holland <samuel.holland@sifive.com> | 2024-08-16 17:25:02 -0700 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2024-10-02 15:11:51 +1000 |
commit | 55c136599f512a86e3fec9f77b6b5a30a6b34cca (patch) | |
tree | bc06a7c8ff3de006a63ce83f84a3d10a13d05f9d /include/hw/riscv | |
parent | 6ffe9b6669757bc84bbb4c6218561823db431025 (diff) | |
download | qemu-55c136599f512a86e3fec9f77b6b5a30a6b34cca.zip qemu-55c136599f512a86e3fec9f77b6b5a30a6b34cca.tar.gz qemu-55c136599f512a86e3fec9f77b6b5a30a6b34cca.tar.bz2 |
hw/riscv: Respect firmware ELF entry point
When riscv_load_firmware() loads an ELF, the ELF segment addresses are
used, not the passed-in firmware_load_addr. The machine models assume
the firmware entry point is what they provided for firmware_load_addr,
and use that address to generate the boot ROM, so if the ELF is linked
at any other address, the boot ROM will jump to empty memory.
Pass back the ELF entry point to use when generating the boot ROM, so
the boot ROM can jump to firmware loaded anywhere in RAM. For example,
on the virt machine, this allows using an OpenSBI fw_dynamic.elf built
with FW_TEXT_START values other than 0x80000000.
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20240817002651.3209701-1-samuel.holland@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'include/hw/riscv')
-rw-r--r-- | include/hw/riscv/boot.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/hw/riscv/boot.h b/include/hw/riscv/boot.h index a2e4ae9..18bfe9f 100644 --- a/include/hw/riscv/boot.h +++ b/include/hw/riscv/boot.h @@ -35,13 +35,13 @@ target_ulong riscv_calc_kernel_start_addr(RISCVHartArrayState *harts, target_ulong firmware_end_addr); target_ulong riscv_find_and_load_firmware(MachineState *machine, const char *default_machine_firmware, - hwaddr firmware_load_addr, + hwaddr *firmware_load_addr, symbol_fn_t sym_cb); const char *riscv_default_firmware_name(RISCVHartArrayState *harts); char *riscv_find_firmware(const char *firmware_filename, const char *default_machine_firmware); target_ulong riscv_load_firmware(const char *firmware_filename, - hwaddr firmware_load_addr, + hwaddr *firmware_load_addr, symbol_fn_t sym_cb); target_ulong riscv_load_kernel(MachineState *machine, RISCVHartArrayState *harts, |