rumpk/hal
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
..
arch Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
crypto feat(rumpk): Phase 7 Verified - Subject Zero Launch 2025-12-31 20:18:48 +01:00
README.md docs(rumpk): Add module READMEs per Panopticum doctrine 2025-12-31 20:18:47 +01:00
abi.zig feat(rumpk): Sovereign Core Stabilization & Membrane IPC Hardening 2025-12-31 20:18:49 +01:00
channel.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
crypto.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
entry_riscv.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
fb_wrapper.zig Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
framebuffer.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
gpu.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
hud.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
main.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
matrix.zig feat(rumpk): Sovereign Core Stabilization & Membrane IPC Hardening 2025-12-31 20:18:49 +01:00
mm.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
stubs.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
surface.zig Phase 37: The Glass Cage - Memory Isolation Complete 2026-01-04 02:03:01 +01:00
uart.zig Phase 34: Orbital Drop - Fix console echo and eliminate 'R' flood regression 2026-01-03 18:07:18 +01:00
ui.zig feat(rumpk): Sovereign Core Stabilization & Membrane IPC Hardening 2025-12-31 20:18:49 +01:00
virtio_block.zig Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
virtio_net.zig feat(rumpk): Sovereign Ledger - VirtIO Block Driver & Persistence 2025-12-31 22:35:30 +01:00
virtio_pci.zig Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00

README.md

Rumpk HAL (L0)

Language: Zig + Assembly
Purpose: Hardware Abstraction Layer

Module Index

File Purpose
main.zig Entry point (_start), stack setup, calls Nim kmain
stubs.zig Freestanding libc (memcpy, malloc, printf, etc.)
uart.zig PL011 UART driver (QEMU virt)
abi.zig C ABI structs shared with Nim

Architecture Directory (arch/)

Contains per-architecture implementations:

arch/
├── aarch64/        # ARM64 (VisionFive 2, RPi, AWS Graviton)
│   ├── switch.S    # Context switch (96 bytes)
│   └── constants.nim
├── x86_64/         # System V ABI (servers, trading)
│   ├── switch.S    # Context switch (56 bytes)
│   └── constants.nim
└── riscv64/        # RISC-V LP64 (satellites, drones)
    ├── switch.S    # Context switch (112 bytes)
    └── constants.nim

Freestanding Doctrine

This HAL provides ALL C ABI symbols. No glibc, no musl.

Exported Symbols:

  • Memory: memcpy, memset, memmove, memcmp
  • Strings: strlen, strcmp, strcpy
  • Heap: malloc, free, realloc, calloc
  • I/O: printf, puts, putchar
  • Exit: exit, abort
  • Signals: signal, raise (no-op stubs)

Build

Compiled via zig build-obj -target <arch>-freestanding-none