mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
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:
parent
f216b57415
commit
835af7ef6a
@ -118,9 +118,6 @@ cpu_primary_start_64:
|
||||
/* save the MULTBOOT magic number & MBI */
|
||||
movl %edi, (boot_regs)
|
||||
movl %esi, (boot_regs+4)
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
movl %edx, (boot_regs+8)
|
||||
#endif
|
||||
|
||||
primary_start_long_mode:
|
||||
|
||||
@ -187,9 +184,6 @@ loop:
|
||||
boot_regs:
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
.long 0x00000000
|
||||
#endif
|
||||
|
||||
/* GDT table */
|
||||
.align 4
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#define MULTIBOOT_INFO_MAGIC 0x2BADB002
|
||||
#define MULTIBOOT_INFO_HAS_CMDLINE 0x00000004
|
||||
#define MULTIBOOT_INFO_HAS_MODS 0x00000008
|
||||
#define MULTIBOOT_INFO_HAS_DRIVES 0x00000080
|
||||
|
||||
struct multiboot_info {
|
||||
uint32_t mi_flags;
|
||||
|
Loading…
Reference in New Issue
Block a user