A from-scratch, no_std x86_64 Linux-ABI-compatible operating system kernel written in Rust (~25k lines of Rust including the UEFI bootloader).
Ferrite runs unmodified Linux x86_64 userspace binaries — zsh, curl, rustc/cargo (self-hosting its own release kernel), Sway + kitty + btop + fastfetch + Mesa llvmpipe, aplay, lsusb, and evtest — while stripping out decades of legacy x86 hardware and kernel baggage.
- Modern Linux x86_64 ABI, no legacy cruft. Binary compatibility with
x86_64-unknown-linux-gnuand-muslmeans standard Linux compilers, shells, Wayland compositors, audio tools, and closed userspace libraries run unmodified without a custom toolchain. Legacy surfaces (i386compat,vm86,a.out, 8259 PIC, PIT ticks) are omitted. - Modern x86-64-v3 hardware assumptions. Targets x2APIC + TSC-deadline tickless timers, invariant TSC,
SYSCALL/SYSRET,FSGSBASE,PCID/INVPCID,SMEP/SMAP,XSAVES, 1 GiB direct-map pages, and hybrid P-core / E-core awareness (CPUID 0x1A). - Fast hot paths by construction. Single per-thread work flags word on syscall exit, zero-bounce per-CPU run queues, vDSO timekeeping (
clock_gettime,gettimeofday,getcpu,getrandom), VFS path-lookup cache, PAT write-combining framebuffer mappings, zero-copy TCP receive loans, and scatter-gather chained DMA. - Differential correctness against mainline Linux. Every test binary and shell suite runs identically on both Ferrite and mainline Linux under the same QEMU/KVM configuration via
scripts/compare.sh, diffing outputs line by line.
- Core Kernel & SMP
- Symmetric multiprocessing (tested up to 24 CPUs), hybrid P-core/E-core topology awareness, per-CPU run queues, tickless TSC-deadline scheduling, adaptive halt-polling.
- Demand-paged B-tree VMAs, copy-on-write
fork, shared zero page, buddy frame allocator,mmap/munmap/mprotect/mremap,futex, POSIX signals,epoll,eventfd,timerfd,signalfd,memfd, UNIX domain sockets, dynamic ELF loading (glibc&musl). - Self-hosting: boots
rustc+cargo+rust-lldinside Ferrite to compile a verified Stage-2 releaseferritekernel (scripts/selfhost.sh).
- Graphics, Console & Wayland
- Linear framebuffer (
/dev/fb0) backed by Bochs VBE (QEMU) or UEFI GOP (efifb=), with PAT write-combiningmmap. - Built-in VT102/
TERM=linuxframebuffer console (fbcon) with auto 2× HiDPI scaling and UNIX98 PTYs (/dev/ptmx,/dev/pts/N). - Runs stock Wayland compositors (
Sway 1.12),kitty,btop,fastfetch, andMesa llvmpipeOpenGL ES 3D rendering.
- Linear framebuffer (
- Networking
virtio-net(MSI-X, zero-copy RX loans) and Intel I225-V 2.5GbE (igc, PCIe VFIO tested).smoltcp-based IPv4/TCP/UDP stack + loopback fast path; runs unmodifiedcurlover HTTPS/TLS.
- Audio
- Native ALSA character device ABI (
/dev/snd/controlC0,/dev/snd/pcmC0D0p,/proc/asound/*) with Linux'shw_paramsrefinement engine,MMAP_INTERLEAVED&RW_INTERLEAVED,poll/epoll, xrun recovery, andvirtio-sound-pcibackend. - Byte-for-byte identical
aplay -l,--dump-hw-params, andaplay -voutput compared to Linux; verified pure 440 Hz tone playback (scripts/sound-smoke.sh).
- Native ALSA character device ABI (
- USB, Input & Block Storage
- Native xHCI 1.1 host controller driver (MSI/MSI-X, Control, auto-rearming Interrupt IN, 64 KiB scatter-gather chained Bulk TRBs, Isochronous, and USB Hub class
0x09). - USB Core +
/sys/bus/usb/devices/*(lsusb), Linuxevdev(/dev/input/eventN,evtest), USB HID keyboard/mouse/tablet (wired to bothevdevand interactive console TTY withCtrl-C/SIGINT), and USB Mass Storage BOT+SCSI (/dev/sda).
- Native xHCI 1.1 host controller driver (MSI/MSI-X, Control, auto-rearming Interrupt IN, 64 KiB scatter-gather chained Bulk TRBs, Isochronous, and USB Hub class
- UEFI Bootloader & Bare-Metal Readiness
- Standalone
uefi-rsloader (loader/) withzstdinitramfs decompression, GOP framebuffer handoff, E820 conversion, and PVH trampoline (scripts/ovmf-boot.sh). - 128 GiB MMIO-hole-safe memory map, xAPIC→x2APIC transition, warm-reset RAM panic log ring, port
0x80POST codes, and a hard PCI safety blocklist.
- Standalone
- Experimental NVIDIA / CUDA RM Bring-Up (
--features nvidia)- Early OS-layer scaffolding for NVIDIA's open
nv-kernel.oRM core and/dev/nvidia*character devices (see docs/research/nvidia/PLAN.md).
- Early OS-layer scaffolding for NVIDIA's open
Ferrite is a single monolithic kernel mapped into the upper half of every address space, with all physical RAM direct-mapped at 0xffff_8000_0000_0000.
- Boot & Entry (
kernel/src/arch/,loader/): Under QEMU, Ferrite boots directly via Xen PVH (-kernel). On UEFI/OVMF,loader/loads the kernel ELF and (optionally.zst-compressed) initramfs from\EFI\ferrite\, records the UEFI memory map, ACPI RSDP, and GOP framebuffer (efifb=...), exits boot services, and jumps to the exact same PVH entry point via a low-memory trampoline. - Traps & Syscalls (
arch/syscall.rs,arch/trap.rs,syscall/): Syscalls, exceptions, and IRQs save a unifiedTrapFrame. Fast syscalls return viaSYSRETand check a single per-thread pending-work word;execveand signal delivery fall back toIRET. - Memory (
mm/): Global buddy allocator with per-page refcounts, 4-level paging withPCID/INVPCID,ioremap(UC/WC),vmalloc, and per-process B-tree VMA tables withrep movsbfault-handled user copies. - Scheduling (
task/): Per-CPU run queues with work stealing, tickless TSC-deadline preemption, futex waitqueues, and P/E-core-aware scheduling. - VFS & Devices (
fs/,sysfs.rs,tty.rs,input.rs,blk.rs,sound/,usb/): tmpfs root unpacked from cpio initramfs, path-lookup dcache,devtmpfs,procfs,sysfs, pipes, PTYs, ALSA PCM/CTL,evdev, block devices, and PCIe ECAM enumeration.
| Path | Description |
|---|---|
| kernel/ | no_std x86_64 Rust kernel (arch, mm, task, fs, syscall, sound, usb, nvidia, net/inet/igc/virtio*) |
| loader/ | Standalone x86_64-unknown-uefi bootloader (uefi-rs + ruzstd) handing off to PVH |
| vdso/ | Userspace vDSO (clock_gettime, gettimeofday, time, getcpu, getrandom) |
| third_party/smoltcp/ | Thin smoltcp fork with per-address neighbor-discovery rate limiting |
| user/ | Deterministic syscall tests, shell suites, microbenchmarks, and ALSA C regression tests |
| scripts/ | Build, differential test (compare.sh), fuzzing, benchmark, OVMF, self-host, USB, and sound runners |
| docs/ | ARCHITECTURE.md, benchmark raw logs, and subsystem design docs in docs/research/ |
Measured in identical QEMU/KVM configurations (-cpu host,+invtsc, pinned P-cores) against mainline Linux with mitigations=off nokaslr audit=0 tsc=reliable nowatchdog (docs/bench-ferrite.txt vs docs/bench-linux-tuned.txt, docs/netbench-raw-2026-12-03b.txt):
| Benchmark | Ferrite | Tuned Linux | Delta |
|---|---|---|---|
| Null syscall | 39.2 ns | 54.4 ns | 1.39× faster |
clock_gettime (vDSO) |
15.4 ns | 15.7 ns | 1.02× faster |
pread 4 KiB (tmpfs) |
94.5 ns | 144.6 ns | 1.53× faster |
stat (path cache) |
140.9 ns | 209.9 ns | 1.49× faster |
open + close |
254.4 ns | 341.3 ns | 1.34× faster |
| Page fault (anonymous) | 99.7 ns | 185.6 ns | 1.86× faster |
mmap + munmap 64 KiB |
339.4 ns | 610.2 ns | 1.80× faster |
| Pipe roundtrip | 767.2 ns | 1,423.1 ns | 1.85× faster |
fork + exit + wait |
8.84 µs | 13.54 µs | 1.53× faster |
fork + exec + wait |
17.63 µs | 27.13 µs | 1.54× faster |
Loopback TCP_RR (netperf) |
~497k tx/s | ~313k tx/s | 1.59× faster |
virtio-net TCP_CRR (netperf) |
~52.6k tx/s | ~43.3k tx/s | 1.21× faster |
USB 3.0 Mass Storage (dd 64 MiB SG-Bulk) |
1.1–1.2 GB/s | — | 64 KiB chained xHCI TRBs |
- Linux x86_64 host with KVM (
/dev/kvm) andqemu-system-x86_64 - Rust nightly toolchain (pinned in rust-toolchain.toml, with
rust-src,llvm-tools, andx86_64-unknown-nonetarget; addx86_64-unknown-uefito buildloader/) busybox,gcc,cpio(plusedk2-ovmf/mtoolsfor UEFI testing,alsa-utils/usbutils/evtestfor subsystem smoke tests)
# Build the kernel (debug and release)
cargo build
cargo build --release
# Differential test suite: runs 30 tests on both Ferrite and host Linux and diffs output
./scripts/compare.sh
# Syscall and SMP fuzzers
./scripts/fuzz.sh
SMP=8 ./scripts/fuzz-smp.sh
# Subsystem smoke tests
./scripts/usb-io-smoke.sh # xHCI, lsusb, HID->evdev, USB storage
./scripts/sound-smoke.sh ferrite virtio # ALSA + virtio-sound 440 Hz FFT check
./scripts/sound-smoke.sh ferrite virtio tests
# Boot through the Rust UEFI loader under OVMF
./scripts/ovmf-boot.sh -m 4G --smp 4 build/cmp/tests.cpio
# Bare-metal-style smoke test (24 CPUs, 16 GiB, USB hub + keyboard -> zsh on fbcon)
./scripts/bare-metal-smoke.sh
# Self-host: compile the Ferrite release kernel inside Ferrite
STAGE2=1 ./scripts/selfhost.shFerrite is an experimental research OS under active development. It has no security mitigations (KPTI, Spectre/Meltdown), no user/permission isolation guarantees, and is not intended for production workloads.
If you experiment with booting Ferrite on real hardware via loader/, review the PCI device safety blocklist in kernel/src/pci.rs first so host storage and firmware controllers are never touched.
