Markus Maiwald
|
c59c81808a
|
Phase 37: The Glass Cage - Memory Isolation Complete
VICTORY: All page faults (Code 12, 13, 15) eliminated. NipBox runs in isolated userspace.
Root Cause Diagnosed:
- Kernel BSS (0x84D5B030) was overwritten by NipBox loading at 0x84000000
- current_fiber corruption caused cascading failures
Strategic Fixes:
1. Relocated NipBox to 0x86000000 (eliminating BSS collision)
2. Expanded DRAM to 256MB, User region to 64MB (accommodating NipBox BSS)
3. Restored Kernel GP register in trap handler (fixing global access)
4. Conditionally excluded ion/memory from userspace builds (removing 2MB pool)
5. Enabled release build optimizations (reducing BSS bloat)
Results:
- Kernel globals: SAFE
- User memory: ISOLATED (Sv39 active)
- Syscalls: OPERATIONAL
- Scheduler: STABLE
- NipBox: ALIVE (waiting for stdin)
Files Modified:
- core/rumpk/apps/linker_user.ld: User region 0x86000000-0x89FFFFFF (64MB)
- core/rumpk/hal/mm.zig: DRAM 256MB, User map 32-256MB
- core/rumpk/hal/entry_riscv.zig: GP reload in trap handler
- core/rumpk/core/ion.nim: Conditional memory export
- core/rumpk/libs/membrane/ion_client.nim: Local type declarations
- core/rumpk/libs/membrane/net_glue.nim: Removed ion import
- core/rumpk/libs/membrane/compositor.nim: Stubbed unused functions
- src/nexus/builder/nipbox.nim: Release build flags
Next: Fix stdin delivery to enable interactive shell.
|
2026-01-04 02:03:01 +01:00 |
Markus Maiwald
|
232a97272f
|
Phase 31.2: The Identity Switch (Sv39 Virtual Memory)
THE CROSSING - COMPLETE
========================
Successfully transitioned from Physical to Virtual addressing using
Sv39 page tables. The kernel now operates in a fully virtualized
address space with identity mapping (VA=PA).
ARCHITECTURE
------------
1. Sv39 Page Table Infrastructure (hal/mm.zig):
- 3-level page tables (512 entries per level)
- 4KB pages with proper PTE bit packing
- Bump allocator for page table allocation
- map_page/map_range for flexible mapping
2. Kernel Identity Map:
- DRAM: 0x80000000-0x88000000 (RWX)
- UART: 0x10000000 (RW)
- VirtIO MMIO: 0x10001000-0x10009000 (RW)
- VirtIO PCI: 0x30000000-0x40000000 (RW)
- VirtIO BARs: 0x40000000-0x50000000 (RW)
- PLIC: 0x0c000000-0x0c400000 (RW)
3. Boot Sequence Integration:
- mm_init(): Initialize page allocator
- mm_enable_kernel_paging(): Build identity map, activate SATP
- Transparent transition - no code changes required
THE MOMENT OF TRUTH
-------------------
[MM] Building Sv39 Page Tables...
[MM] Activating Identity Map...
[MM] ✓ Virtual Memory Active. Reality is Virtual.
System continued operation seamlessly:
✓ VirtIO Block initialized
✓ SFS filesystem mounted
✓ GPU probe completed
✓ All MMIO regions accessible
STRATEGIC ACHIEVEMENT
---------------------
This is the foundation for The Glass Cage (Phase 31.3).
We can now create restricted page tables for worker fibers,
enforcing true memory isolation without MMU context switches.
Files:
- core/rumpk/hal/mm.zig: Complete Sv39 implementation
- core/rumpk/core/kernel.nim: Boot integration
- src/nexus/builder/kernel.nim: Build system integration
Next: Phase 31.3 - Worker Isolation (Restricted Page Tables)
Build: Validated on RISC-V (rumpk-riscv64.elf)
Status: Production-ready - The Sovereign ascends to Virtual Reality
|
2026-01-02 15:24:32 +01:00 |