diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-07-10 11:24:56 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-07-10 11:24:56 +0800 |
| commit | 1767d390fbf3d0c65389de46caf0b6d43ef3b6ad (patch) | |
| tree | 0f5e01cd7c7a05abb6b1c7472d7f00f49caf02cc /na/test/test_vmm.cc | |
| parent | 63dc025705f6533b91fb1a7d26e6ed864efd9900 (diff) | |
| download | lume-1767d390fbf3d0c65389de46caf0b6d43ef3b6ad.tar.gz lume-1767d390fbf3d0c65389de46caf0b6d43ef3b6ad.tar.xz | |
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.
Diffstat (limited to 'na/test/test_vmm.cc')
| -rw-r--r-- | na/test/test_vmm.cc | 15 |
1 files changed, 11 insertions, 4 deletions
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 <lume/selftest.h> +#include <lume/klog.h> +#include <lume/config.h> #include <lume/addr.h> #include <lume/vmm.h> #include <lume/pmm.h> #include <arch/config.h> -/* 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; |
