i386/relocator: Add grub_relocator64_efi relocator
Add grub_relocator64_efi relocator. It will be used on EFI 64-bit platforms when multiboot2 compatible image requests MULTIBOOT_TAG_TYPE_EFI_BS. Relocator will set lower parts of %rax and %rbx accordingly to multiboot2 specification. On the other hand processor mode, just before jumping into loaded image, will be set accordingly to Unified Extensible Firmware Interface Specification, Version 2.4 Errata B, section 2.3.4, x64 Platforms, boot services. This way loaded image will be able to use EFI boot services without any issues. Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
This commit is contained in:
parent
e563928ba4
commit
9862b24121
8 changed files with 186 additions and 9 deletions
|
@ -30,6 +30,17 @@
|
|||
#define MULTIBOOT_MBI_REGISTER ebx
|
||||
#define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_I386
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#ifdef __x86_64__
|
||||
#define MULTIBOOT_EFI_INITIAL_STATE { .rax = MULTIBOOT_BOOTLOADER_MAGIC, \
|
||||
.rcx = 0, \
|
||||
.rdx = 0, \
|
||||
}
|
||||
#define MULTIBOOT_EFI_ENTRY_REGISTER rip
|
||||
#define MULTIBOOT_EFI_MBI_REGISTER rbx
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MULTIBOOT_ELF32_MACHINE EM_386
|
||||
#define MULTIBOOT_ELF64_MACHINE EM_X86_64
|
||||
|
||||
|
|
|
@ -65,6 +65,20 @@ struct grub_relocator64_state
|
|||
grub_addr_t cr3;
|
||||
};
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#ifdef __x86_64__
|
||||
struct grub_relocator64_efi_state
|
||||
{
|
||||
grub_uint64_t rax;
|
||||
grub_uint64_t rbx;
|
||||
grub_uint64_t rcx;
|
||||
grub_uint64_t rdx;
|
||||
grub_uint64_t rip;
|
||||
grub_uint64_t rsi;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
grub_err_t grub_relocator16_boot (struct grub_relocator *rel,
|
||||
struct grub_relocator16_state state);
|
||||
|
||||
|
@ -76,4 +90,11 @@ grub_err_t grub_relocator64_boot (struct grub_relocator *rel,
|
|||
struct grub_relocator64_state state,
|
||||
grub_addr_t min_addr, grub_addr_t max_addr);
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#ifdef __x86_64__
|
||||
grub_err_t grub_relocator64_efi_boot (struct grub_relocator *rel,
|
||||
struct grub_relocator64_efi_state state);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
|
||||
#define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
|
||||
#define MULTIBOOT_HEADER_TAG_EFI_BS 7
|
||||
#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
|
||||
|
||||
#define MULTIBOOT_ARCHITECTURE_I386 0
|
||||
#define MULTIBOOT_ARCHITECTURE_MIPS32 4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue