ruvix-types
Core kernel interface types for the RuVix Cognition Kernel (ADR-087).
Overview
This crate provides all kernel interface types for RuVix. It is designed to be no_std compatible with zero external dependencies, ensuring it can be used in both kernel code and RVF component code.
The Six Kernel Primitives
RuVix has exactly six kernel primitives:
| Primitive | Purpose | Analog |
|---|---|---|
| Task | Unit of concurrent execution with capability set | seL4 TCB |
| Capability | Unforgeable typed token granting access to a resource | seL4 capability |
| Region | Contiguous memory with access policy | seL4 Untyped + frame |
| Queue | Typed ring buffer for inter-task communication | io_uring SQ/CQ |
| Timer | Deadline-driven scheduling primitive | POSIX timer_create |
| Proof | Cryptographic attestation gating state mutation | Novel (ADR-047) |
Type Categories
Handle Types
All kernel objects are referenced through handles:
use ;
let task = new; // Task ID 1, generation 0
let cap = new; // Capability slot 42, epoch 1
let region = new; // Region at ID 0x1000
Capability Rights
Fine-grained access control through bitflags:
use CapRights;
let read_write = READ | WRITE;
let full_access = all;
let read_only = READ;
Available rights: READ, WRITE, GRANT, REVOKE, PROVE, GRANT_ONCE
Proof Types
Cryptographic proof tokens for mutation authorization:
use ;
// Proof tokens carry tier, nonce, timestamp, and hash
let tier = Reflex; // <100ns
let tier = Standard; // <100us
let tier = Deep; // <10ms
Region Policies
Memory access policies:
use RegionPolicy;
let immutable = Immutable; // Set once, never modified
let append = AppendOnly ; // Only append
let slab = Slab ; // Fixed-size slots
Constants
Important constants from ADR-087:
use ;
assert_eq!; // ADR-047 witness size
assert_eq!; // Section 20.2
assert_eq!; // 100ms cache TTL
assert_eq!; // 64 entry cache
Features
std(default): Enable standard library supportalloc: Enable alloc crate support for heap allocation
Design Philosophy
- Zero dependencies: Pure Rust, no external crates
no_stdcompatible: Works in kernel and embedded contextsforbid(unsafe_code): Safety guaranteed at compile time- Exhaustive docs: Every public item is documented
Integration
This crate is the foundation of the RuVix type system. All other ruvix crates depend on it:
ruvix-cap: Capability management usingCapHandle,CapRightsruvix-region: Memory regions usingRegionHandle,RegionPolicyruvix-queue: IPC queues usingQueueHandle,MsgPriorityruvix-proof: Proof engine usingProofToken,ProofTierruvix-vecgraph: Vector stores usingVectorKey,CoherenceMetaruvix-sched: Scheduler usingTaskHandle,TaskPriority
License
MIT OR Apache-2.0