nub_arch_x86/lib.rs
1//! Nub Arch implementation for Hyperlight — library form.
2//!
3//! Houses the kernel modules (page tables, JIT runtime, page
4//! allocator, state cache, call loop) and the production guest-
5//! function table. Three binary targets link against this lib:
6//!
7//! - `nub-arch-x86` (`src/main.rs`) — production. Empty shell;
8//! `extern crate nub_arch_x86` pulls in the lib's
9//! `#[guest_function]` linkme contributions.
10//! - `nub-arch-x86-tests` (`src/bin/tests.rs`) — production fns +
11//! test-only RPCs (e.g. `nub_smoke`).
12//! - `nub-arch-x86-benches` (`src/bin/benches.rs`) — production
13//! fns + bench probes (e.g. `bench_arc_page_alloc`).
14//!
15//! Production deps + the kernel modules are gated on
16//! `cfg(target_os = "none")` so the lib also compiles on host
17//! targets — host code (`nub` crate) imports the [`test_abi`]
18//! module for FN_ID constants without dragging in any bare-metal
19//! deps.
20
21#![cfg_attr(target_os = "none", no_std)]
22
23#[cfg(target_os = "none")]
24extern crate alloc;
25#[cfg(target_os = "none")]
26extern crate hyperlight_guest_bin;
27
28// Kernel modules — guest-only.
29#[cfg(target_os = "none")]
30pub mod cached_cap;
31#[cfg(target_os = "none")]
32pub mod call_loop;
33#[cfg(target_os = "none")]
34pub mod execution_lane;
35#[cfg(target_os = "none")]
36pub mod jit_cache;
37#[cfg(target_os = "none")]
38pub mod jit_run;
39#[cfg(target_os = "none")]
40pub mod page_alloc;
41#[cfg(target_os = "none")]
42pub mod paging;
43#[cfg(target_os = "none")]
44pub mod ring3;
45#[cfg(target_os = "none")]
46pub mod segments;
47#[cfg(target_os = "none")]
48pub mod state_cache;
49
50/// Production guest function table — `#[guest_function]` linkme
51/// contributions. Any bin that `extern crate`s `nub_arch_x86` pulls
52/// these into its dispatch table.
53#[cfg(target_os = "none")]
54pub mod guest_prod;
55
56/// FN_ID constants shared between the test/bench guest binaries and
57/// host-side test/bench drivers. Always compiled — host-visible.
58pub mod test_abi;