crates

moho_abi

check proofs license minimum Rust version

The application binary interface (ABI) between a program and a capability kernel. It holds the five system call numbers, the method number of every operation on every kind of capability, the error codes, the rights bits and the shapes of the replies. The crate is no_std with no dependencies, and carries no code beyond constants, a handful of const fn helpers and tests. A kernel and the programs that run on it share this one definition, so a number cannot mean two things on the two sides of the system call boundary.

The contract

module what it holds
rendezvous, reply send, receive, call, reap, survey and badge; the one-shot answer
memory_region, usage, object_type retype, split, destroy and usage; which figure to ask for; what a page becomes
page_frame, address_space, address_wait map, revoke and slice; map, list, unmap, wait and wake; the address wait flags
thread_control_block, process, fault, survey threads and processes; the death message; the survey records
notification, timer, interrupt, cycle_counter doorbells, deadlines, interrupts and what a cycle read counts
virtual_io, uart, port_range, reboot, console device, console and machine methods (console holds one reserved number)

EXAMPLES

use moho_abi::{Error, SYSTEM_CALL_EXIT, SYSTEM_CALL_INVOKE, SYSTEM_CALL_YIELD, rendezvous};

assert_eq!([SYSTEM_CALL_EXIT, SYSTEM_CALL_YIELD, SYSTEM_CALL_INVOKE], [0, 1, 2]);
// Sending on a rendezvous is a method number, not a system call number.
assert_eq!(rendezvous::SEND, 0);
// Errors are negative, and "empty slot" is not "gone".
assert_eq!(Error::NoSuchSlot as i64, -1);
assert_ne!(Error::NoSuchSlot, Error::Gone);

What is proven

Nothing is machine-checked: there are no Kani harnesses. The pinned-values tests carry the compatibility claim.

Building and testing

cargo test
cargo build --lib --target x86_64-unknown-none   # also aarch64-unknown-none-softfloat, riscv64imac-unknown-none-elf

BUGS

Minimum Rust version

Rust 1.88.

License

Licensed under either of MIT (LICENSE-MIT) or Apache-2.0 (LICENSE-APACHE), at your option.