SlopOS
Development

Unsafe And FFI Boundaries

Where ABI and unsafe edges belong

SlopOS is Rust-first. Raw unsafe, naked assembly, linker symbols, and C ABI edges should stay inside the trusted core or inside narrow bridge modules that exist only to connect assembly, bootloader, or linker contracts.

Boundary categories

CategoryBelongs in
Raw CPU and architecture operationsOSTD architecture modules
Naked assembly entry and return pathsOSTD assembly or explicit bridge modules
Linker symbols and link-section declarationsOSTD FFI helpers or narrow boot/kernel bridges
Bootloader protocol ABIBoot protocol bridge
Scheduler and interrupt assembly ABIDedicated boundary modules
User pointer validation and raw copiesOSTD user-memory APIs
MMIO, port I/O, DMA, and PCI raw accessOSTD device and memory APIs

The exact allowlist is enforced in the source repo. Public docs describe the policy; the scripts define the current mechanical rule.

Rules

  • Prefer normal Rust functions and typed callback structs.
  • Put raw extern declarations behind OSTD wrappers or a dedicated boundary.
  • Keep linker symbols behind safe accessor functions.
  • Do not add ad hoc extern "C" blocks in feature code.
  • If an ABI edge needs unsafe, keep the unsafe block small and give it a concrete safety argument.
  • Extend unsafe-check exemptions only with a narrow, documented reason.

Checks

Use targeted rg scans around the code you touched when reviewing a boundary change:

rg 'extern "C"' <changed-subsystem>
rg 'unsafe' <changed-subsystem>
just check-framekernel

The first scans are review aids. The framekernel gate is the policy-enforcing check.

On this page