hw/loongarch/virt: Fix virt_to_phys_addr function

The virt addr should mask TARGET_PHYS_ADDR_SPACE_BITS to
get the phys addr, and this is used by loading kernel elf.

Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230327112313.3042829-1-zhaotianrui@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
This commit is contained in:
Tianrui Zhao 2023-03-27 19:23:13 +08:00 committed by Song Gao
parent efcd0ec14b
commit 51d54503e8
No known key found for this signature in database
GPG Key ID: 40A2FFF239263EDF

View File

@ -399,7 +399,7 @@ static struct _loaderparams {
static uint64_t cpu_loongarch_virt_to_phys(void *opaque, uint64_t addr)
{
return addr & 0x1fffffffll;
return addr & MAKE_64BIT_MASK(0, TARGET_PHYS_ADDR_SPACE_BITS);
}
static int64_t load_kernel_info(void)