Repository navigation
Physical memory management, 4-level page tables, and a working MMU for the AArch64 bare-metal kernel, with the kernel relocated to run from the higher half of the address space.
Added
src/mm/pmm.s:page_alloc/page_free/pmm_init, a free-list physical page allocator over[_heap_start, RAM_END[src/mm/pgtable.s:map_page/map_range/translate, a 4-level, 4 KB granule translation table builder and software walkersrc/mm/mmu.s:mmu_config(MAIR_EL1/TCR_EL1),mmu_map_identity,mmu_map_high,mmu_enable,mmu_enable_cachessrc/exceptions/handlers.s:el_synchronousnow dispatches on the exception class, counts and skips data aborts, halts on anything else (fault_count)linker.ld: the kernel is linked at high virtual addresses (0xFFFF000040000000, translated throughTTBR1_EL1) but loaded at its physical address;_heap_startstays an absolute physical value for the allocatorsrc/boot/boot.s: position-independent early boot (adrinstead ofldr =), jump to the high-half entry point once the MMU and the high mapping are activesrc/tests/tests.s: 25 checks (MMU registers, the allocator, hardware address translation viaAT S1E1R/PAR_EL1, kernel location in the high half, identity/high aliasing, and read-only/unmapped page permissions)scripts/test.sh,make test: runs the kernel under QEMU and validates the test output automatically.github/workflows/ci.yml: builds and runs the test suite on every pushnotes/v04.md: full theory and implementation walkthrough (descriptor formats, MAIR/TCR/SCTLR configuration, the higher-half relocation, and the automated test suite)
Verification
The kernel boots on QEMU virt, builds the identity map and a direct high-half map of the RAM, enables the MMU and the caches, jumps to code running entirely from the high half, then runs the full automated test suite:
PASS: REGS: MAIR_EL1 holds MAIR_VALUE
...
PASS: PERM: unmapped read faults once
ALL TESTS PASSED