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

@ -7,7 +7,7 @@
// solid logo. Whoever draws it picks the colour, so the palette stays in
// include/theme.h and can change without regenerating anything.
//
// Two pixels per byte, high nibble first. Included by boot/stage2main.c
// Two pixels per byte, high nibble first. Included by boot/bios/stage2main.c
// as well as kernel/dev/vga.c, and stage2 must fit below the 0x10000
// kernel-search buffer -- hence 4 bits rather than 8.

View file

@ -13,7 +13,7 @@
// Boot, console and shell share SCH_BG/SCH_FG. The panic screen keeps the
// full-bleed purple entirely to itself, which is what makes it mean something.
//
// Included by boot/stage2main.c (freestanding, pre-kernel), kernel/dev/vga.c,
// Included by boot/bios/stage2main.c (freestanding, pre-kernel), kernel/dev/vga.c,
// kernel/core/console.c and kernel/core/panic.c. Plain #defines only — no
// types, no code — because stage2 is compiled 32-bit against a different
// world than the kernel.