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:
Nexoniarz 2026-08-09 16:00:03 +02:00
commit 08a1a9033a
19 changed files with 125 additions and 33 deletions

View file

@ -39,7 +39,7 @@ vga_set_bg(uint32 color)
vga_bg = color;
}
// Written by boot/stage2.S's VBE call and read by boot/stage2main.c under
// Written by boot/bios/stage2.S's VBE call and read by boot/bios/stage2main.c under
// the same name (VBE_INFO_ADDR) — not 0x9000, since stage2's own code now
// runs up to nearly 0x9000 once the boot-menu/progress-bar logic is
// included, which would otherwise clobber a mode info block placed there.
@ -391,7 +391,7 @@ vga_text_at(int x, int y, const char *s, uint32 color)
// --- Logo ------------------------------------------------------------------
//
// The boot splash's logo is drawn by the *loader*, not here -- see splash() in
// boot/stage2main.c. It has to be, because the kernel does not reach vga_init()
// boot/bios/stage2main.c. It has to be, because the kernel does not reach vga_init()
// until roughly the last 300ms of a 2.8s boot: drawing it here put the logo on
// screen for one frame before console_takeover() wiped it, which is worse than
// not having one.