CHECKPOINT 7: Nuke LwIP, Fix Stack 🎯 PRIMARY ACHIEVEMENTS: - ✅ Interactive Mksh shell successfully boots and accepts input - ✅ Kernel-side LwIP networking disabled (moved to userland intent) - ✅ C-ABI handover fully operational (argc, argv, environ) - ✅ SPEC-130: Sovereign Filesystem Hierarchy formalized 🔧 KERNEL FIXES: 1. **Nuked Kernel LwIP** - Disabled membrane_init() in kernel.nim - Prevented automatic DHCP/IP acquisition - Network stack deferred to userland control 2. **Fixed C-ABI Stack Handover** - Updated rumpk_enter_userland signature: (entry, argc, argv, sp) - Kernel prepares userland stack at 0x8FFFFFE0 (top of user RAM) - Stack layout: [argc][argv[0]][argv[1]=NULL][envp[0]=NULL][string data] - Preserved kernel-passed arguments through subject_entry.S 3. **Fixed Trap Return Stack Switching** - Added sscratch swap before sret in entry_riscv.zig - Properly restores user stack and preserves kernel stack pointer - Fixes post-syscall instruction page fault 4. **Rebuilt Mksh with Fixed Runtime** - subject_entry.S no longer zeros a0/a1 - Arguments flow: Kernel -> switch.S -> subject_entry.S -> main() 📐 ARCHITECTURAL SPECS: - **SPEC-130: Sovereign Filesystem Hierarchy** - Tri-State (+1) Storage Model: /sysro, /etc, /run, /state - Declarative Stateless Doctrine (inspired by Clear Linux/Silverblue) - Ghost Writer Pattern: KDL recipes -> /etc generation - Bind-Mount Strategy for legacy app grafting - Database Contract for /state (transactional, encrypted) 🛠️ DEVELOPER EXPERIENCE: - Fixed filesystem.nim to fallback to .nexus/ for local builds - Prevents permission errors during development 🧪 VERIFICATION: Syscalls confirmed working: write (0x200, 0x204), read (0x203) NEXT: Implement proper TTY/PTY subsystem for full job control Co-authored-by: <voxis@nexus-os.org> |
||
|---|---|---|
| .. | ||
| fs | ||
| include | ||
| ion | ||
| loader | ||
| README.md | ||
| channel.nim | ||
| cstubs.c | ||
| fiber.nim | ||
| invariant.nim | ||
| ion.nim | ||
| kernel.nim | ||
| loader.nim | ||
| loader.zig | ||
| netswitch.nim | ||
| overrides.c | ||
| panicoverride.nim | ||
| re-symbol.txt | ||
| ring.nim | ||
| sched.nim | ||
| watchdog.nim | ||
| write_wrapper.nim | ||
README.md
Rumpk Core (L1)
Language: Nim
Purpose: Architecture-agnostic kernel logic
Module Index
| File | Purpose |
|---|---|
kernel.nim |
Main Orchestrator (kmain) |
ion.nim |
ION Control Plane & Channel API |
fiber.nim |
Cooperative fiber abstraction |
watchdog.nim |
Autonomous Immune System (Healer) |
ring.nim |
Lock-free Sovereign ring buffers |
panicoverride.nim |
Freestanding panic handler |
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_haltfrom HAL (Zig L0) - Imports
cpu_switch_tofrom arch-specific assembly - Uses
mm:arcmemory management (no GC)
Build
Built via ../build.sh [aarch64|x86_64|riscv64]