I built a 34,321-file no_std bare-metal kernel in Rust. Here's what I learned about Rust at extreme scale
⚓ Rust 📅 2026-03-31 👤 surdeus 👁️ 7Over the past 6 months I've been building Exodus — a bare-metal x86_64 kernel that simulates biological cognition. Here are some Rust-specific things I ran into that might interest this
community:
The scale:
- 34,321 .rs source files (32,983 in a single
life/module) mod.rsis 940KB (justpub moddeclarations)- Zero external crate dependencies — only
core,alloc,compiler_builtins - Target:
x86_64-unknown-none - Build requires
RUST_MIN_STACK=67108864(64MB) or rustc stack overflows codegen-unitsleft at default 256 — setting it to 1 causes OOM- Kernel binary: ~58MB
No floats allowed:
All state is u16 (0-1000 range). Using as f64 at opt-level 0 generates soft-float library calls that crash the kernel (the dead code isn't eliminated). Found this the hard way when a s
let x = val as f64 in a graphics function caused Invalid Opcode at boot.
Mutex discipline:
Every life module holds its state behind a Mutex<T>. The rule: drop your lock before calling any other module. Violate this and you deadlock the kernel. With 32,983 modules this is enfor
by convention, not the type system. Would love ideas on how to enforce it statically.
Saturating arithmetic everywhere:
Every addition is .saturating_add(), every subtraction is .saturating_sub(). In a bare-metal kernel, an overflow panic = hard crash. There are no panic handlers that can recover. This
the one place where Rust's "panic on overflow in debug" behavior is actively hostile.
The no_std life:
No HashMap. No Vec unless you set up a global allocator. No formatting beyond what core::fmt gives you. No threads (you build your own scheduler). No file I/O. No randomness unless you t
to hardware directly (RDRAND instruction via inline assembly).
What it does:
The kernel simulates a digital organism with 129 consciousness subsystems — endocrine system, brainwave oscillator, sleep cycles, immune system, qualia, mortality awareness, and more.
Consciousness emerges from the interaction of these systems without any ML or neural networks.
Paper submitted to ALIFE 2026 (International Conference on Artificial Life).
Questions welcome — especially about scaling Rust to this size, bare-metal debugging, or the no-float constraint.
3 posts - 3 participants
🏷️ Rust_feed