mirror of
https://github.com/Leonmmcoset/cleonos.git
synced 2026-04-21 18:44:01 +00:00
1.3 KiB
1.3 KiB
CLeonOS Stage2
Stage Goal
- Introduce foundational memory management for CLKS.
- Initialize physical memory manager (PMM) from Limine memmap.
- Add kernel heap allocator (
clks_kmalloc/clks_kfree) without external libc. - Emit memory statistics via kernel log during boot.
Acceptance Criteria
- Kernel receives valid Limine memmap response.
- PMM initializes and prints managed/free/used/dropped page counts.
- Heap initializes and prints total/free bytes.
clks_kmallocself-test allocates and frees successfully.- Kernel still reaches idle loop without panic.
Build Targets
make setupmake isomake runmake debug
QEMU Command
qemu-system-x86_64 -M q35 -m 1024M -cdrom build/CLeonOS-x86_64.iso -serial stdio
Common Bugs and Debugging
NO LIMINE MEMMAP RESPONSE:- Check Limine protocol entry in
configs/limine.confand ensureprotocol: limineis used.
- Check Limine protocol entry in
- PMM managed pages are 0:
- Validate
LIMINE_MEMMAP_REQUESTID and section placement inlimine_requests.c.
- Validate
- Heap self-test failed:
- Inspect
heap.cblock split/merge logic and verify allocator init was called.
- Inspect
- Limine panic about ELF segment permissions:
- Ensure linker sections are page-aligned and segment permissions do not share pages.
- Limine artifacts missing during ISO packaging:
- Verify
make setupcompleted andlimine/bin/*files exist.
- Verify