rumpk/core
Markus Maiwald ee594df8a7 feat(rumpk): Phase 4 - NPL Loader
THE PLATFORM HAS PURPOSE
========================

Rumpk now has a payload loading system: NPL (Nexus Payload).

OUTPUT
------
[NPL]  Verification PASSED
[NPL] Executing payload...
[NPL]  Payload returned!
[NPL]  Bad sig rejected

NPL FORMAT (128-byte header)
----------------------------
- Magic: \x7fNPL (4 bytes)
- Version: 1 (1 byte)
- Arch: 0xAA=ARM64, 0xEE=x86_64, 0x55=RISC-V (1 byte)
- Flags: 2 bytes
- Signature: 64 bytes (Ed25519 placeholder)
- Body Size: 8 bytes
- Reserved: 48 bytes

IMPLEMENTATION
--------------
core/npl.nim:
- NPLHeader struct (packed, 128 bytes)
- loadNpl() - validates magic, version, arch, signature
- buildTestPayload() - creates test NPL in memory
- Signature verification (mock: rejects 0xFF)

TESTS VERIFIED
--------------
1. Valid payload: Loads and executes RET instruction
2. Bad signature: Correctly rejected (0xFF in sig[0])
3. Cross-arch: Would reject wrong arch code

PHASE SUMMARY
-------------
 Phase 1: Documentation (SPEC-008/009/010)
 Phase 2: Pure Zig libc (Freestanding Doctrine)
 Phase 3: Cooperative Fibers (Ping Pong)
 Phase 4: NPL Loader (with mock signature)
→ Phase 4.2: Ed25519 verification (Monocypher)
→ Phase 5: VisionFive 2 RISC-V hardware

The unikernel can now load and execute signed payloads.
Next: Real Ed25519 verification.
2025-12-31 20:18:47 +01:00
..
include feat(rumpk): First successful Zig+Nim boot on QEMU ARM64 2025-12-31 20:18:47 +01:00
README.md docs(rumpk): Add module READMEs per Panopticum doctrine 2025-12-31 20:18:47 +01:00
cstubs.c feat(rumpk): First successful Zig+Nim boot on QEMU ARM64 2025-12-31 20:18:47 +01:00
fiber.nim feat(rumpk): Multi-Architecture HAL (aarch64, x86_64, riscv64) 2025-12-31 20:18:47 +01:00
kernel.nim feat(rumpk): Phase 4 - NPL Loader 2025-12-31 20:18:47 +01:00
npl.nim feat(rumpk): Phase 4 - NPL Loader 2025-12-31 20:18:47 +01:00
panicoverride.nim feat(rumpk): First successful Zig+Nim boot on QEMU ARM64 2025-12-31 20:18:47 +01:00
ring.nim feat: Initialize Rumpk Modular Unikernel 2025-12-31 20:18:47 +01:00

README.md

Rumpk Core (L1)

Language: Nim
Purpose: Architecture-agnostic kernel logic

Module Index

File Purpose
kernel.nim Main entry point (kmain), fiber test
fiber.nim Cooperative fiber abstraction
ring.nim Lock-free Disruptor ring buffer
panicoverride.nim Nim panic handler for freestanding

Architecture Independence

This folder contains no architecture-specific code. All platform-specific details are handled by the HAL layer (../hal/).

Compile-time architecture selection uses Nim's when defined():

when defined(amd64):
  const CONTEXT_SIZE = 56
elif defined(arm64):
  const CONTEXT_SIZE = 96
elif defined(riscv64):
  const CONTEXT_SIZE = 112

Dependencies

  • Imports console_write, rumpk_halt from HAL (Zig L0)
  • Imports cpu_switch_to from arch-specific assembly
  • Uses mm:arc memory management (no GC)

Build

Built via ../build.sh [aarch64|x86_64|riscv64]