Master the fundamental concepts of build a mini kernel through this focused micro-challenge.
Firmware INT 15h AX=E820 returns address ranges and types (usable, reserved, ACPI). Kernels must not place page tables in reserved regions including MMIO holes.
Common ACPI types:
For example, a machine might report usable 0x00000000-0x0009FFFF and 0x00100000-0x7FEFFFFF with a hole for VGA framebuffer.
The E820 memory map you're parsing here is exactly what GRUB passes to every multiboot-compliant kernel, and it's the only way an OS learns which physical addresses are real RAM versus reserved for the VGA buffer, ACPI tables, or memory-mapped PCI devices. Allocating a page from a region you mistakenly marked usable is how kernels corrupt firmware data structures or write straight into device registers.
Before you call the implementation done, walk failure modes on purpose. Test empty structures, single-element edge cases, maximum concurrency, and errno paths that must not crash the program. OS code usually fails in production when happy-path tests pass but invariants break under contention or memory pressure.
Keep structures small and name fields after kernel counterparts when possible. That lets you read man pages and kernel source side by side while you work. Print observable events during development; remove noisy logs once tests pass reliably.
You will call the BIOS hook in your bootloader and store an array of regions for the kernel allocator. This exercise requires marking which ranges are safe for buddy allocation.
Simulate parsing a BIOS E820 memory map in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github