From 1767d390fbf3d0c65389de46caf0b6d43ef3b6ad Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Fri, 10 Jul 2026 11:24:56 +0800 Subject: feat: establish bootable new architecture checkpoint Replace the compressed boot path with a relocatable higher-half RISC-V entry, expand memory and SMP support, and add the driver, TTY, VFS, exec, signal, syscall, initramfs, and self-test infrastructure needed for a bootable kernel checkpoint. --- na/test/test_vmm.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'na/test/test_vmm.cc') diff --git a/na/test/test_vmm.cc b/na/test/test_vmm.cc index 049570f..635e3f3 100644 --- a/na/test/test_vmm.cc +++ b/na/test/test_vmm.cc @@ -6,12 +6,17 @@ */ #include +#include +#include #include #include #include #include -/* Assuming pmap namespace is accessible or we can test basic structures */ +namespace { +constexpr uint64 kUartBase = 0x10000000ULL; +constexpr uint64 kPageOffsetMask = kPageSize - 1; +} void selftest_vmm() { st_begin("vmm: virtual/physical address translation"); @@ -30,7 +35,7 @@ void selftest_vmm() { st_begin("vmm: page alignment macros"); { uint64 base = pmm_get_mem_base().raw; - uint64 addr = base + 0xFFF; + uint64 addr = base + kPageOffsetMask; ST_ASSERT_EQ(page_align_down(addr), base); ST_ASSERT_EQ(page_align_up(addr), base + kPageSize); ST_ASSERT_EQ(page_align_down(base), base); @@ -40,8 +45,10 @@ void selftest_vmm() { st_begin("vmm: mapping kernel MMIO (driver API)"); { - uint64 mmio_pa = pmm_get_mem_base().raw; - vmm_map_kernel_mmio(mmio_pa, 0x1000); + /* Use UART MMIO address (0x10000000 on RISC-V virt). + * Must NOT use pmm_get_mem_base() — that's PMP-protected firmware. */ + uint64 mmio_pa = kUartBase; + vmm_map_kernel_mmio(mmio_pa, kPageSize); // Verify it doesn't crash and address is reachable in higher half uint64 va = pa_to_va(phys_addr(mmio_pa)).raw; -- cgit v1.2.3