## 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: Voxis Forge <ai@voxisforge.dev> |
||
|---|---|---|
| .. | ||
| arch | ||
| crypto | ||
| README.md | ||
| abi.zig | ||
| channel.zig | ||
| entry_riscv.zig | ||
| framebuffer.zig | ||
| gpu.zig | ||
| hud.zig | ||
| main.zig | ||
| matrix.zig | ||
| stubs.zig | ||
| uart.zig | ||
| ui.zig | ||
| virtio_net.zig | ||
| virtio_pci.zig | ||
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