// BLACK0X80 — kernel series — rust — no gc — no mercy

black
metal
kernel

a series on writing kernel code in rust — zero-cost abstractions — bare metal — all variables prefixed black — no comments in the code — no hand-holding — just the machine and the type system

no_std no_main unsafe repr(C) asm! x86-64 spinlock SIMD virtio

// series — 08 episodes

// 01
the foundation — no_std and raw control
stripping the standard library — BlackSpinlock — two-phase TTAS — atomic acquire/release
no_std AtomicBool spinlock
// 02
custom allocator — owning the heap from birth
BlackBumpAllocator — lock-free SMP allocation — alignment arithmetic — GlobalAlloc
GlobalAlloc AtomicUsize bump alloc
// 03
interrupt handling — when hardware screams at you
BlackIdtEntry — naked functions — register context save/restore — EOI protocol
IDT naked fn iretq
// 04
SIMD memory operations — asm! on the critical path
AVX2 zeroing — non-temporal stores — movnti — sfence — cache pollution prevention
AVX2 movnti sfence
// 05
memory layout control — repr(C) as a weapon
BlackVirtqueue — virtio descriptor ring — packed structs — hardware-visible memory layout
repr(C) virtio DMA
// 06
the black_mutex — a lock that earns its existence
BlackMutex — UnsafeCell — Deref/DerefMut — RAII guard — Drop with Release semantics
UnsafeCell RAII Drop
// 07
the page table — direct address space construction
BlackPageTable — huge pages — CR3 — x86-64 paging hierarchy — compile-time BSS init
CR3 paging huge pages
// 08
closing transmission — what rust proves and what remains yours
the borrow checker as proof engine — unsafe boundaries — what no type system can verify
ownership unsafe Send/Sync