Go to file
Markus Maiwald 33d08a2bf2 feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete
## Major Features

### 1. Dynamic ELF64 Binary Loading
- Implemented ELF parser with full header validation (core/loader/elf.nim)
- Created kexec() loader supporting PT_LOAD segment mapping
- Added BSS initialization and data copying from VFS
- Assembly trampoline (rumpk_enter_userland) for userland entry

### 2. Syscall Infrastructure
- Added CMD_SYS_EXEC (0x400) for consciousness swapping
- Integrated exec command in NipBox shell
- Implemented syscall routing through command ring
- Added provenance tracking via SipHash

### 3. Test Binary & Build System
- Created hello.c test program for alien binary execution
- Automated compilation and initrd inclusion in build.sh
- Added libnexus.h header for standalone C programs

### 4. VFS Integration
- Implemented TarFS file cursor system for sequential reads
- Fixed infinite loop bug in cat command
- Added debug logging for VFS mount process

## Technical Improvements

### Memory Management
- Fixed input ring null pointer dereference
- Implemented CMD_ION_FREE syscall for packet reclamation
- Resolved memory leak in input/output pipeline
- Added FileHandle with persistent offset tracking

### ABI Stability
- Split kprint into 1-arg (Nim) and kwrite (C ABI)
- Fixed cstring conversion warnings across codebase
- Corrected RISC-V assembly (csrw sie, zero)

### Documentation
- Comprehensive Phase 8 documentation (docs/PHASE-8-ELF-LOADER.md)
- Detailed implementation notes and debugging status

## Current Status

 ELF parser, loader, and syscall infrastructure complete
 Test binary compiles and embeds in VFS
 Shell integration functional
🔧 Debugging command ring communication (syscall not reaching kernel)

## Files Changed

Core:
- core/loader.nim, core/loader/elf.nim (NEW)
- core/kernel.nim, core/ion.nim (syscall handling)
- core/fs/tar.nim (file cursor system)
- hal/arch/riscv64/switch.S (userland trampoline)

Userland:
- npl/nipbox/nipbox.nim (exec command)
- libs/membrane/libc_shim.zig (syscall implementation)
- libs/membrane/ion.zig (command ring API)

Build & Test:
- build.sh (hello.c compilation)
- rootfs/src/hello.c, rootfs/src/libnexus.h (NEW)
- apps/subject_entry.S (NEW)

## Next Steps

1. Debug SysTable and command ring communication
2. Verify ION fiber polling of chan_cmd
3. Test full ELF loading and execution flow
4. Add memory protection (future phase)

Co-authored-by: Forge <ai@voxisforge.dev>
2025-12-31 20:18:49 +01:00
.zig-cache feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
apps feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
boot feat(rumpk): Phase 7 Verified - Subject Zero Launch 2025-12-31 20:18:48 +01:00
core feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
docs feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
hal feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
io feat: Initialize Rumpk Modular Unikernel 2025-12-31 20:18:47 +01:00
libs feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
npl feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
rootfs feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
src/npl/system feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
vendor/lwip feat(rumpk): Phase 7 Verified - Subject Zero Launch 2025-12-31 20:18:48 +01:00
README.md feat: Initialize Rumpk Modular Unikernel 2025-12-31 20:18:47 +01:00
build.sh feat(rumpk): Phase 8 - The Summoning (ELF Loader) - 95% Complete 2025-12-31 20:18:49 +01:00
build.zig feat(rumpk): Phase 3.5b Zicroui HUD Integration 2025-12-31 20:18:49 +01:00
run.sh feat(rumpk): First successful Zig+Nim boot on QEMU ARM64 2025-12-31 20:18:47 +01:00

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