UEFI: change the efi_ctx passing method

Save the pointer of efi_ctx in mi_drivers_addr field of
multiboot structure and pass to hypervisor, not by
saving in register RDX(the third default parameter in
64bit call function).

With this method, we can be compatible with the original
32bit boot parameters passing method and no need to
large the array size of boot_regs in hypervisor.

Signed-off-by: Zheng, Gen <gen.zheng@intel.com>
This commit is contained in:
Zheng, Gen
2018-03-30 12:31:35 +08:00
committed by Jack Ren
parent b240450064
commit fde0789ccc
4 changed files with 19 additions and 11 deletions

View File

@@ -155,7 +155,7 @@ struct acpi_table_header {
UINT32 asl_compiler_revision; /* ASL compiler version */
};
typedef void(*hv_func)(int, struct multiboot_info*, struct efi_ctx*);
typedef void(*hv_func)(int, struct multiboot_info*);
EFI_IMAGE_ENTRY_POINT get_pe_entry(CHAR8 *base);
static inline void hv_jump(EFI_PHYSICAL_ADDRESS hv_start,
@@ -177,7 +177,7 @@ static inline void hv_jump(EFI_PHYSICAL_ADDRESS hv_start,
asm volatile ("cli");
/* jump to acrn hypervisor */
hf(MULTIBOOT_INFO_MAGIC, mbi, efi_ctx);
hf(MULTIBOOT_INFO_MAGIC, mbi);
}
EFI_STATUS get_path(CHAR16* name, EFI_LOADED_IMAGE *info, EFI_DEVICE_PATH **path)
@@ -410,6 +410,9 @@ again:
mbi->mi_cmdline = (UINTN)"uart=disabled";
mbi->mi_mmap_addr = (UINTN)mmap;
mbi->mi_flags |= MULTIBOOT_INFO_HAS_DRIVES;
mbi->mi_drives_addr = (UINT32)(UINTN)efi_ctx;
efi_ctx->rsdp = rsdp;
//Print(L"start 9!\n");

View File

@@ -138,7 +138,7 @@ int uefi_sw_loader(struct vm *vm, struct vcpu *vcpu)
vlapic_restore(vcpu->arch_vcpu.vlapic, &uefi_lapic_regs);
vcpu->entry_addr = efi_ctx->rip;
vcpu->entry_addr = (void *)efi_ctx->rip;
cur_context->guest_cpu_regs.regs.rax = efi_ctx->rax;
cur_context->guest_cpu_regs.regs.rbx = efi_ctx->rbx;
cur_context->guest_cpu_regs.regs.rdx = efi_ctx->rcx;
@@ -171,8 +171,18 @@ void *get_rsdp_from_uefi(void)
static void efi_init(void)
{
efi_ctx = (struct efi_ctx *)(uint64_t)(uint32_t)boot_regs[2];
ASSERT(efi_ctx != NULL, "");
struct multiboot_info *mbi = NULL;
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC)
ASSERT(0, "no multiboot info found");
mbi = (struct multiboot_info *)((uint64_t)(uint32_t)boot_regs[1]);
if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES))
ASSERT(0, "no multiboot drivers for uefi found");
efi_ctx = (struct efi_ctx *)(uint64_t)mbi->mi_drives_addr;
ASSERT(efi_ctx != NULL, "no uefi context found");
vm_sw_loader = uefi_sw_loader;