diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-07-10 11:31:46 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-07-10 11:31:46 +0800 |
| commit | e90b72ec3082588b296956730bd2930cf8d5d671 (patch) | |
| tree | 36ff6916af9b4176ea5a9662219d11e721f0b691 /na/test/test_vmm.cc | |
| parent | 1767d390fbf3d0c65389de46caf0b6d43ef3b6ad (diff) | |
| download | lume-e90b72ec3082588b296956730bd2930cf8d5d671.tar.gz lume-e90b72ec3082588b296956730bd2930cf8d5d671.tar.xz | |
refactor: promote new architecture to repository root
Archive the deprecated implementation under lume-legacy, make the new kernel the default root-level build, and update repository entry points without changing kernel behavior.
Diffstat (limited to 'na/test/test_vmm.cc')
| -rw-r--r-- | na/test/test_vmm.cc | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/na/test/test_vmm.cc b/na/test/test_vmm.cc deleted file mode 100644 index 635e3f3..0000000 --- a/na/test/test_vmm.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* Copyright (C) 2026 Richard Qin */ - -/* - * Boot Self-Test: VMM and Address Translation - */ - -#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> - -namespace { -constexpr uint64 kUartBase = 0x10000000ULL; -constexpr uint64 kPageOffsetMask = kPageSize - 1; -} - -void selftest_vmm() { - st_begin("vmm: virtual/physical address translation"); - { - PhysAddr pa = pmm_get_mem_base(); - VirtAddr va = pa_to_va(pa); - ST_ASSERT_EQ(va.raw, arch::g_direct_map_base + pa.raw); - ST_ASSERT_EQ(va_to_pa(va).raw, pa.raw); - - Pfn p = pa_to_pfn(pa); - ST_ASSERT_EQ(p.raw, pa.raw / kPageSize); - ST_ASSERT_EQ(pfn_to_pa(p).raw, pa.raw); - } - st_pass(); - - st_begin("vmm: page alignment macros"); - { - uint64 base = pmm_get_mem_base().raw; - 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); - ST_ASSERT_EQ(page_align_up(base), base); - } - st_pass(); - - st_begin("vmm: mapping kernel MMIO (driver API)"); - { - /* 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; - ST_ASSERT(va >= arch::g_direct_map_base); - } - st_pass(); -} |
