bootparam: bug fix on address convertion

Before pasing commandline from boot param, switch the phisical address
of param to virtaul address.

Signed-off-by: Zheng, Gen <gen.zheng@intel.com>
This commit is contained in:
Zheng, Gen 2018-04-16 12:42:38 +08:00 committed by Jack Ren
parent 2a37a4de71
commit db4e3f87bf
2 changed files with 4 additions and 4 deletions

View File

@ -103,7 +103,7 @@ int parse_hv_cmdline(void)
return -EINVAL; return -EINVAL;
} }
mbi = (struct multiboot_info *)((uint64_t)boot_regs[1]); mbi = (struct multiboot_info *)(HPA2HVA((uint64_t)boot_regs[1]));
dev_dbg(ACRN_DBG_PARSE, "Multiboot detected, flag=0x%x", mbi->mi_flags); dev_dbg(ACRN_DBG_PARSE, "Multiboot detected, flag=0x%x", mbi->mi_flags);
if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE)) { if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE)) {
@ -111,7 +111,7 @@ int parse_hv_cmdline(void)
return -EINVAL; return -EINVAL;
} }
start = (char *)(uint64_t)mbi->mi_cmdline; start = (char *)HPA2HVA((uint64_t)mbi->mi_cmdline);
dev_dbg(ACRN_DBG_PARSE, "hv cmdline: %s", start); dev_dbg(ACRN_DBG_PARSE, "hv cmdline: %s", start);
do { do {

View File

@ -176,12 +176,12 @@ static void efi_init(void)
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC) if (boot_regs[0] != MULTIBOOT_INFO_MAGIC)
ASSERT(0, "no multiboot info found"); ASSERT(0, "no multiboot info found");
mbi = (struct multiboot_info *)((uint64_t)(uint32_t)boot_regs[1]); mbi = (struct multiboot_info *)HPA2HVA(((uint64_t)(uint32_t)boot_regs[1]));
if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES)) if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES))
ASSERT(0, "no multiboot drivers for uefi found"); ASSERT(0, "no multiboot drivers for uefi found");
efi_ctx = (struct efi_ctx *)(uint64_t)mbi->mi_drives_addr; efi_ctx = (struct efi_ctx *)HPA2HVA((uint64_t)mbi->mi_drives_addr);
ASSERT(efi_ctx != NULL, "no uefi context found"); ASSERT(efi_ctx != NULL, "no uefi context found");
vm_sw_loader = uefi_sw_loader; vm_sw_loader = uefi_sw_loader;