From a1ac35cf7195b73ffeab8bfd612af7b81f921b3b Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Wed, 13 May 2026 15:59:13 +0800 Subject: feat: update memblock to use page_map instead of frame_map in documentation and allocation functions --- na/include/lume/memblock.h | 6 +++--- na/mm/memblock.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/na/include/lume/memblock.h b/na/include/lume/memblock.h index 41baf34..cb9a76b 100644 --- a/na/include/lume/memblock.h +++ b/na/include/lume/memblock.h @@ -11,12 +11,12 @@ * * Lifetime: * 1. memblock_init() — discovers RAM via FDT, reserves kernel image - * 2. vmm_init() — uses memblock_alloc for page table pages & frame_map + * 2. vmm_init() — uses memblock_alloc for page table pages & page_map * 3. pmm_init() — absorbs remaining free regions into buddy * 4. memblock_retire() — marks memblock inactive; all alloc via PMM * * This eliminates the need for post-init pointer relocation when - * rebinding frame_map to a VMEMMAP virtual address. + * rebinding page_map to a VMEMMAP virtual address. */ #include @@ -30,7 +30,7 @@ void memblock_init(uint64 fdt_paddr); void memblock_reserve(uint64 base, uint64 size); /* Allocate `size` bytes aligned to `align` from top of free memory. - * Returns PA, or 0 on failure. Used for frame_map. */ + * Returns PA, or 0 on failure. Used for page_map. */ uint64 memblock_alloc_top(uint64 size, uint64 align); /* Allocate `size` bytes aligned to `align` from bottom of free memory. diff --git a/na/mm/memblock.cc b/na/mm/memblock.cc index ac71472..4cd0b16 100644 --- a/na/mm/memblock.cc +++ b/na/mm/memblock.cc @@ -106,14 +106,14 @@ void memblock_init(uint64 fdt_paddr) /* 2. Reserve firmware region [mem_base, kernel_start). * OpenSBI occupies the first 2MB of RAM on RISC-V virt. */ - uint64 ks_pa = va_to_pa(virt_addr( + uint64 ks_pa = boot_va_to_pa(virt_addr( reinterpret_cast(_stext))).raw; if (ks_pa > mem_base) { memblock_reserve(mem_base, ks_pa - mem_base); } /* 3. Reserve kernel image [_stext, _kernel_end) */ - uint64 ke_pa = va_to_pa(virt_addr( + uint64 ke_pa = boot_va_to_pa(virt_addr( reinterpret_cast(_kernel_end))).raw; memblock_reserve(ks_pa, ke_pa - ks_pa); -- cgit v1.2.3