TRI-ARCH SOVEREIGNTY
====================
Rumpk now supports three major architectures:
- aarch64 (ARM64): VisionFive 2, RPi, AWS Graviton
- x86_64: Standard servers, trading, banking
- riscv64: Sovereign compute, satellites, drones
DIRECTORY STRUCTURE
-------------------
hal/arch/
├── aarch64/
│ ├── switch.S # ARM64 context switch (96 bytes)
│ └── constants.nim # LR_OFFSET=11, FP_OFFSET=10
├── x86_64/
│ ├── switch.S # System V ABI switch (56 bytes)
│ └── constants.nim # RIP_OFFSET=6
└── riscv64/
├── switch.S # RISC-V LP64 switch (112 bytes)
└── constants.nim # RA_OFFSET=0
UNIFIED FIBER.NIM
-----------------
Uses Nim's 'when defined()' for compile-time arch selection:
- CONTEXT_SIZE varies by arch (56/96/112)
- RET_ADDR_INDEX points to return address slot
- Halt instruction varies (hlt/wfi)
BUILD SYSTEM
------------
./build.sh [aarch64|x86_64|riscv64]
- Default: aarch64
- Output: build/rumpk-$ARCH.elf
- Auto-selects linker script if arch-specific exists
ABI SUMMARY
-----------
| Arch | Callee-Saved | Frame | Alignment |
|----------|------------------------|-------|-----------|
| aarch64 | x19-x30 | 96B | 16-byte |
| x86_64 | rbx,rbp,r12-r15 | 56B | 16-byte |
| riscv64 | ra,s0-s11 | 112B | 16-byte |
VERIFICATION
------------
ARM64 fibers still work:
[Fiber A] I am alive! Yielding to B...
[Fiber B] Hello from B! Yielding to A...
[Fiber A] I am back! Yielding to B...
One codebase. All profiles. NIIX philosophy enforced.
|
||
|---|---|---|
| .zig-cache | ||
| boot | ||
| core | ||
| hal | ||
| io | ||
| README.md | ||
| build.sh | ||
| build.zig | ||
| run.sh | ||
README.md
Rumpk: The Modular Unikernel
"The Kernel is a Library. The App is the OS."
Status: EXPERIMENTAL
Languages: Zig (L0) + Nim (L1)
Design: POSIX-hostile, Military-grade
Directory Structure
rumpk/
├── boot/ [L0] Entry & Architecture (Zig/Asm)
│ ├── start.S Multiboot2/EFI entry point
│ └── arch/ Architecture-specific code
├── hal/ [L0] Hardware Abstraction (Zig)
│ ├── mm.zig Physical/Virtual Memory
│ ├── irq.zig Interrupt handling
│ ├── serial.zig UART/Early logging
│ └── abi.zig C-ABI export to Nim
├── core/ [L1] Logic (Nim)
│ ├── kernel.nim kmain() entry
│ ├── sched.nim LWKT Scheduler
│ ├── fiber.nim Fiber/Context management
│ └── ring.nim Disruptor buffer
├── sys/ [L2] ABI Glue
│ └── syscall.zig System call handlers
├── payload/ [L3] NPL/NPK Loaders
│ └── loader.nim Signature verification
└── io/ I/O Subsystem
└── governor.nim Adaptive War/Peace mode
Key Features
- Adaptive I/O: War Mode (polling) ↔ Peace Mode (interrupts)
- Disruptor Ring: Lock-free inter-fiber communication
- SipHash IDs: Collision-resistant process identification
- Ed25519: Only signed code executes
Specifications
Build (Coming Soon)
cd core/rumpk
zig build # Build L0 HAL
nimble build # Build L1 Logic