Kernel drivers (sketch)
A driver is firmware that lives inside someone else's kernel. Buraaq's job is the same: one owner, explicit unsafe at the ABI, fast loops.
Shape
extern c → NTSTATUS / linux file_operations
safe Buraaq → parse, queues, policy
unsafe → MMIO, IRQL, DMA maps
You do not rewrite WDK or the Linux kbuild. You compile a module that exports the C entry points the OS already expects.
unsafe
extern c {
fn MmMapIoSpace(phys: u64, num: u64, cache: i32) -> *u8
}
fn read_status(mmio: *u8) -> u32 {
# volatile load: your wrapper, not a hidden runtime
...
}
Memory
- Pool allocations: wrap
ExAllocatePool/kmallocin a type that drops withExFreePool/kfree - IRP / sk_buff lifetimes: the kernel owns them: borrow for the duration of the dispatch, never store without an explicit take
- No GC, no unwinding across a DPC unless you designed it
Why not C++ for this
C++ in kernel is a dialect war (no exceptions, no RTTI, a subset of the STL). Buraaq is already that subset: no exceptions as control flow (throws is Result-shaped), no hidden constructors on the IRQ path if you do not write them.
Limits (read this)
No blessed WDK template in the compiler tree yet. Signing, INF, MODULE_LICENSE, and WHQL are your OS story. This chapter teaches how Buraaq *fits*: ownership, extern c, drop: so a 10-year driver engineer can sketch without learning a second language's lifetime puzzle.
Optional Windows GUI for tools that talk to a driver lives last: Lumen.
