aboutsummaryrefslogtreecommitdiff
path: root/hw/riscv/boot.c
diff options
context:
space:
mode:
authorZhuang, Siwei (Data61, Kensington NSW) <Siwei.Zhuang@data61.csiro.au>2019-11-19 06:21:09 +0000
committerPalmer Dabbelt <palmerdabbelt@google.com>2019-11-25 12:34:52 -0800
commit6478dd745dca49d63250500cd1aeca1c41cd6f89 (patch)
treefbb21aee0c3a9399cab692e2921f8e8001d14a44 /hw/riscv/boot.c
parent9c0fb20c4bd50a99c3c6f6d515e05eaf8dd87fa4 (diff)
downloadqemu-6478dd745dca49d63250500cd1aeca1c41cd6f89.zip
qemu-6478dd745dca49d63250500cd1aeca1c41cd6f89.tar.gz
qemu-6478dd745dca49d63250500cd1aeca1c41cd6f89.tar.bz2
hw/riscv: Add optional symbol callback ptr to riscv_load_kernel()
This patch adds an optional function pointer, "sym_cb", to riscv_load_kernel() which provides the possibility to access the symbol table during kernel loading. The pointer is ignored, if supplied with Image or uImage file. The Spike board requires the access to locate the HTIF symbols. Fixes: 0ac24d56c5e7 ("hw/riscv: Split out the boot functions") Buglink: https://bugs.launchpad.net/qemu/+bug/1835827 Signed-off-by: Siwei Zhuang <siwei.zhuang@data61.csiro.au> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'hw/riscv/boot.c')
-rw-r--r--hw/riscv/boot.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 7fee98d..027303d 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -114,12 +114,13 @@ target_ulong riscv_load_firmware(const char *firmware_filename,
exit(1);
}
-target_ulong riscv_load_kernel(const char *kernel_filename)
+target_ulong riscv_load_kernel(const char *kernel_filename, symbol_fn_t sym_cb)
{
uint64_t kernel_entry, kernel_high;
- if (load_elf(kernel_filename, NULL, NULL, NULL,
- &kernel_entry, NULL, &kernel_high, 0, EM_RISCV, 1, 0) > 0) {
+ if (load_elf_ram_sym(kernel_filename, NULL, NULL, NULL,
+ &kernel_entry, NULL, &kernel_high, 0,
+ EM_RISCV, 1, 0, NULL, true, sym_cb) > 0) {
return kernel_entry;
}