squib_core/lib.rs
1//! Portable types and traits at the heart of squib.
2//!
3//! This crate intentionally has zero OS dependencies: it defines the abstractions
4//! that backend crates (`squib-vz`, `squib-hvf`) implement, the device traits the
5//! VMM crate consumes, and the value types that flow through the API server. See
6//! `specs/squib-design.md` for the architectural picture.
7//!
8//! The crate is organized as:
9//!
10//! - [`error`] — the [`Error`] enum every fallible operation in squib returns.
11//! - [`memory`] — guest-physical address ranges and memory protection.
12//! - [`exit`] — the [`VmExit`] enum that subsumes KVM's `VcpuExit` and HVF/VZ exit shapes.
13//! - [`vcpu`] — register file, interrupt descriptors, and the [`Vcpu`] trait.
14//! - [`backend`] — the [`HypervisorBackend`] / [`Vm`] trait pair plus capability discovery.
15//! - [`lifecycle`] — the internal [`LifecyclePhase`] state machine and the wire-shape
16//! [`WireVmState`] surfaced by `GET /`.
17
18#![forbid(unsafe_code)]
19#![warn(missing_docs)]
20
21pub mod backend;
22pub mod error;
23pub mod exit;
24pub mod identifiers;
25pub mod lifecycle;
26pub mod memory;
27pub mod vcpu;
28
29pub use backend::{BackendCapabilities, BackendKind, HypervisorBackend, MAX_SUPPORTED_VCPUS, Vm};
30pub use error::{Error, Result};
31pub use exit::{DebugInfo, VmExit};
32pub use identifiers::{HOST_DEV_NAME_MAX_BYTES, HostDevName, IdentifierError};
33pub use lifecycle::{LifecyclePhase, WireVmState};
34pub use memory::{
35 GuestAddress, GuestMemory, GuestMemoryRegion, GuestRange, Protection, SliceGuestMemory,
36};
37pub use vcpu::{Irq, Regs, Vcpu};