Commit Graph

9 Commits

Author SHA1 Message Date
Markus Maiwald 8d4b581519 feat(hal): ARM64 port, VirtIO MMIO, dual-arch HAL (M3.1-M3.3) 2026-02-15 19:58:51 +01:00
Markus Maiwald 011e0b699e fix(rumpk): enable user stack access and repair boot process
- Enabled SUM (Supervisor Access to User Memory) in riscv_init to allow kernel loader to write to user stacks.
- Removed dangerous 'csrc sstatus' in kload_phys that revoked access.
- Aligned global fiber stacks to 4096 bytes to prevent unmapped page faults at stack boundaries.
- Restored 'boot.o' linking to fix silent boot failure.
- Implemented 'fiber_can_run_on_channels' stub to satisfy Membrane linking.
- Defined kernel stack in header.zig to fix '__stack_top' undefined symbol.
- Resolved duplicate symbols in overrides.c and nexshell.
2026-01-08 21:38:14 +01:00
Markus Maiwald 7207282236 feat(tinybox): graft toybox integration and build system automation
- Integrated ToyBox as git submodule
- Added src/nexus/builder/toybox.nim for automated cross-compilation
- Updated InitRD builder to support symlinks
- Refactored Kernel builder to fix duplicate symbol and path issues
- Modified forge.nim to orchestrate TinyBox synthesis (mksh + toybox)
- Updated SPEC-006-TinyBox.md with complete architecture
- Added mksh binary to initrd graft source
2026-01-08 21:18:08 +01:00
Markus Maiwald 6e78b7f458 Rumpk Stability, NipBox Boot, and Repository Cleanup
- Fixed Rumpk RISC-V Trap Handler (SSCRATCH swap, align(4), SUM bit) to prevent double faults.

- Stabilized Userland Transition (fence.i, MMU activation) allowing NipBox execution.

- Restored Forge pipeline to build NipBox from source.

- Documented critical RISC-V trap mechanics in .agent/tips.

- Committed pending repository cleanup (obsolete websites) and new core modules.
2026-01-04 21:39:06 +01:00
Markus Maiwald 1b4facd86b 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 46e7be6837 feat(rumpk): Phase 7 Verified - Subject Zero Launch
- Implemented Sovereign Syscall Table at 0x801FFF00
- Added cooperative yielding (s_yield) for Guest/Kernel concurrency
- Initialized Guest RX Ring and flows in Kernel
- Bridged LwIP in Guest via net_glue and ion_client overrides
- Validated TCP handshake and data transmission (Subject Zero -> Host)
- Confirmed 'Hello from the Membrane!' via UART and Network
2025-12-31 20:18:48 +01:00
Markus Maiwald 4cc268683d docs(rumpk): Add module READMEs per Panopticum doctrine
Added feature-colocated documentation for AI agent discoverability:
- core/README.md: L1 Nim logic overview
- hal/README.md: L0 Zig HAL overview, exported symbols
- boot/README.md: Linker scripts, memory layout

Panopticum Compliance: Each folder is now self-documenting.
2025-12-31 20:18:47 +01:00
Markus Maiwald 3b755cac06 feat(rumpk): First successful Zig+Nim boot on QEMU ARM64
THE RUBICON IS CROSSED
======================

Rumpk v0.1 successfully boots on QEMU ARM64 virt machine.
Zig L0 initializes HAL and hands off to Nim L1.

BOOT OUTPUT
-----------
[Rumpk L0] Stack: 16KB @ stack_bytes
[Rumpk L0] UART: 0x09000000 (QEMU virt)
[Rumpk L0] Handing off to Nim L1...
[Rumpk L1] Memory: ARC (Deterministic)
[Rumpk L1] POSIX: None (Hostile)
[Rumpk L1] Status: OPERATIONAL
[Rumpk L1] The Rubicon is crossed.
[Rumpk L1] Zig + Nim = Sovereign Metal.

IMPLEMENTATION
--------------
Layer 0 (Zig):
- hal/main.zig: Naked _start, stack setup, zig_entry
- hal/uart.zig: PL011 UART driver for QEMU virt

Layer 1 (Nim):
- core/kernel.nim: kmain() entry, FFI imports from Zig
- Compiled with --mm:arc --os:any for freestanding

Glue (C Stubs):
- core/include/: string.h, stdio.h, stdlib.h, signal.h, etc.
- core/cstubs.c: memcpy, memset, strlen, printf, exit stubs
- Provides minimal libc for Nim's generated C code

Build System:
- build.sh: Orchestrates Zig build-obj + Nim c + zig cc link
- run.sh: QEMU launch script
- boot/linker.ld: ARM64 linker script at 0x40080000

VERIFICATION
------------
$ qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -kernel build/rumpk.elf
→ Successfully prints L0 and L1 banners
→ Enters idle loop (wfi instruction)

NEXT STEPS
----------
Phase 2: Simple bump allocator for Nim heap
Phase 3: Two-fiber context switch (Ping/Pong)
Phase 4: NPL loading with Ed25519 verification
Phase 5: VisionFive 2 RISC-V hardware boot

This proves: POSIX is optional. GCC is optional. Zig + Nim = Sovereign Metal.
2025-12-31 20:18:47 +01:00
Markus Maiwald 694a753bed feat: Initialize Rumpk Modular Unikernel
STRATEGIC PIVOT: From Project to Doctrine
==========================================

This commit initializes Rumpk - a ground-zero Zig+Nim unikernel with
POSIX-hostile design, hard ABI barriers, and military-grade security.

DOCUMENTATION (3 New Specs)
---------------------------
• SPEC-008-RUMPK-ARCHITECTURE.md
  - L0 (Zig): Boot, PMM, IRQ, HAL
  - L1 (Nim): LWKT Scheduler, Fibers, Disruptor Ring
  - L2 (ABI): struct HAL function pointers (future Janus socket)
  - L3 (Payload): NPL/NPK loaders, optional POSIX shim
  - SipHash IDs + Ed25519 signed execution

• SPEC-009-RUMPK-IO.md
  - Disruptor Ring: Lock-free O(1) inter-fiber communication
  - Adaptive Governor: War Mode (polling) ↔ Peace Mode (interrupts)
  - Zero VM-exit design (Rumkv does NOT touch packets)

• SPEC-010-SOVEREIGN-HIERARCHY-V2.md
  - /Cas: Immutable Content-Addressable Storage
  - /Cell: Active Containers (Driver/, App/, Sensor/)
  - /Bus: Active Interfaces (replaces /dev)
  - /Data: Mutable Persistence (User/, Volume/)
  - 'The Unix Lie' compatibility layer for legacy apps

VISION.MD UPDATE
----------------
• Added dedicated Rumpk section differentiating from Rumk
• Documented 4-layer architecture with ASCII diagram
• Listed key innovations: Adaptive I/O, Disruptor, SipHash, Ed25519

REPOSITORY STRUCTURE (core/rumpk/)
----------------------------------
core/rumpk/
├── boot/header.zig      # Multiboot2/EFI entry
├── hal/abi.zig          # L0→L1 ABI contract (struct HAL)
├── core/kernel.nim      # kmain() entry point
├── core/ring.nim        # Disruptor ring buffer
├── io/governor.nim      # Adaptive War/Peace I/O
├── build.zig            # Zig build orchestration
└── README.md            # Feature index

DESIGN DECISIONS
----------------
• Hard ABI barrier: Zig exports C-compatible struct to Nim
• Language-agnostic: L1 can be swapped for Janus later
• No shared state: Fibers communicate via Channels only
• No JIT, No W^X violations: Code sections immutable

NEXT STEPS
----------
• Phase 1: Boot on QEMU (print 'Hello Rumpk')
• Phase 2: Nim runtime on bare metal
• Phase 3: Two fibers switching (Ping/Pong)
• Phase 4: NPL loading with signature verification
• Phase 5: VisionFive 2 hardware validation

This is the foundation for the 'OS Factory' vision.
Rumpk + Rumkv + NPL = Independent from Unix/Linux.

Tested: Directory structure validated
Status:  SCAFFOLD COMPLETE
2025-12-31 20:18:47 +01:00