diff options
author | Bibo Mao <maobibo@loongson.cn> | 2025-04-25 10:05:04 +0800 |
---|---|---|
committer | Bibo Mao <maobibo@loongson.cn> | 2025-05-06 09:17:32 +0800 |
commit | 73047c825e25a18127dddb89eff0c0bf97a26aed (patch) | |
tree | bc090cae5be1a8017ce94a315dead4ad875301ae | |
parent | a41a74ca5323f4d30ac7eb48ec1d54a09fae5baa (diff) | |
download | qemu-73047c825e25a18127dddb89eff0c0bf97a26aed.zip qemu-73047c825e25a18127dddb89eff0c0bf97a26aed.tar.gz qemu-73047c825e25a18127dddb89eff0c0bf97a26aed.tar.bz2 |
hw/loongarch/virt: Get physical entry address with elf file
With load_elf() api, image load low address and high address is converted
to physical address if parameter translate_fn is provided. However
executing entry address is still virtual address. Here convert entry
address into physical address, since MMU is disabled when system power on,
the first PC instruction should be physical address.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Song Gao <gaosong@loongson.cn>
-rw-r--r-- | hw/loongarch/boot.c | 1 | ||||
-rw-r--r-- | tests/tcg/loongarch64/system/kernel.ld | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/hw/loongarch/boot.c b/hw/loongarch/boot.c index 354cf45..0324d6a 100644 --- a/hw/loongarch/boot.c +++ b/hw/loongarch/boot.c @@ -245,6 +245,7 @@ static int64_t load_kernel_info(struct loongarch_boot_info *info) &kernel_entry, &kernel_low, &kernel_high, NULL, ELFDATA2LSB, EM_LOONGARCH, 1, 0); + kernel_entry = cpu_loongarch_virt_to_phys(NULL, kernel_entry); if (kernel_size < 0) { kernel_size = load_loongarch_linux_image(info->kernel_filename, &kernel_entry, &kernel_low, diff --git a/tests/tcg/loongarch64/system/kernel.ld b/tests/tcg/loongarch64/system/kernel.ld index f1a7c01..56d8588 100644 --- a/tests/tcg/loongarch64/system/kernel.ld +++ b/tests/tcg/loongarch64/system/kernel.ld @@ -3,7 +3,7 @@ ENTRY(_start) SECTIONS { /* Linux kernel legacy start address. */ - . = 0x9000000000200000; + . = 0x200000; _text = .; .text : { *(.text) |