boot: separate BIOS from UEFI
boot/bios/ now holds the MBR, the El Torito stub and the real-mode stage 2; boot/uefi/ is empty and documented. Separate directories rather than #ifdefs, because the two share almost nothing. A BIOS loader lives in 16-bit real mode, reaches the firmware through software interrupts, and walks itself up into long mode. A UEFI loader is a 64-bit PE that the firmware has already placed in long mode with paging on, calling services through a table of function pointers. What they do share is the hand-off contract, which boot/README.md now writes down: ELF segments placed, long mode, a 24-byte-entry memory map at E820_MAP_ADDR, framebuffer geometry at VBE_INFO_ADDR. That contract is the point of documenting it now. UEFI's GetMemoryMap returns EFI_MEMORY_DESCRIPTORs, and the right move is to translate them into the entries kernel/arch/x86_64/e820.c already parses rather than teach the kernel a second format. Build output paths under $(BUILD)/boot are unchanged; only sources moved.
This commit is contained in:
parent
8a4ac03ea9
commit
08a1a9033a
19 changed files with 125 additions and 33 deletions
|
|
@ -7,7 +7,7 @@
|
|||
// every byte above 224 MB is invisible. Measured before this file existed:
|
||||
// SchOS booted at 224 MB and triple faulted at 192 MB, for no reason at all.
|
||||
//
|
||||
// The firmware has known the answer the whole time. boot/stage2.S asks it with
|
||||
// The firmware has known the answer the whole time. boot/bios/stage2.S asks it with
|
||||
// INT 0x15 / E820 in real mode -- the same interface Linux's boot stub and GRUB
|
||||
// use -- and leaves the result in low memory. stage2main.c already parses it to
|
||||
// print detected RAM on the splash. The kernel simply never read it.
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
uint64 phystop = PHYSTOP_FALLBACK;
|
||||
|
||||
// Where stage2 left the map. Must match E820_COUNT_ADDR / E820_MAP_ADDR in
|
||||
// boot/stage2main.c, which are themselves relative to VBE_INFO_ADDR.
|
||||
// boot/bios/stage2main.c, which are themselves relative to VBE_INFO_ADDR.
|
||||
#define E820_COUNT_ADDR (0x30000 + 0x200)
|
||||
#define E820_MAP_ADDR (0x30000 + 0x208)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue