See also: Main Boot Page, BIOS Boot Process, Roadmap
Phase |
Component |
Brief Description |
Mechanism / UEFI Protocol |
Preparation |
GPT Partitioning |
The disk must use a GUID Partition Table. The bootloader lives in the EFI System Partition (ESP). |
Hardware Standard (GPT); FAT32 filesystem. |
Entry |
EFI Main |
The entry point of the loader. It will receive a "Handle" to the image and a pointer to the "System Table." |
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys) |
System Info |
Memory Map |
UEFI maintains a much more detailed memory map than BIOS. The bootloader "exit boot services" later to own it. |
GetMemoryMap() via Boot Services. |
Graphics |
GOP (Graphics Output) |
UEFI does not use VGA. It must request a pointer to the linear framebuffer to draw pixels. |
EFI_GRAPHICS_OUTPUT_PROTOCOL |
File Access |
Simple File System |
It does not need to write a FAT32 driver; the firmware already has one. It just "Open" the kernel file. |
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL |
Kernel Prep |
Memory Allocation |
it must allocate specific memory pages for the kernel segments. |
AllocatePages() with AllocateAddress. |
The Hand-off |
Exit Boot Services |
CRITICAL: This shuts down firmware drivers and gives the kernel 100% control of the CPU. |
ExitBootServices() |
Transition |
Virtual Mapping |
(Optional but common) UEFI runs in identity-mapped long mode; it may set up its own page tables here. |
MOV CR3, <table_address> |
Handoff |
Final Jump |
Since UEFI is already in 64-bit (or 32-bit) mode, it simply cast your kernel address to a function pointer. |
void (*)(BOOT_Info*kernel_entry)(s_bootInfo); |