Skip to main content

nub_arch_x86/
lib.rs

1//! Generic nub guest-kernel library for Hyperlight.
2//!
3//! Houses the personality seam (`personality`), the CALL/HALT task
4//! loop (`task`), the generic RPC bodies + `register_guest_kernel!`
5//! (`guest_fns`), and the bare-metal substrate modules (page tables,
6//! JIT runtime, page allocator, ring-3 entry, segments). This crate
7//! produces **no** binaries: a personality crate (e.g.
8//! `rust/javm-guest-x86`, the Javm personality) plugs its state/cap
9//! system into the seam and owns the `[[bin]]` targets.
10//!
11//! Downstream personality-crate requirements:
12//!
13//! - a **direct, unrenamed** `hyperlight-guest-bin` dependency
14//!   (`register_guest_kernel!` expands `#[guest_function]` attrs whose
15//!   proc-macro resolves the crate by package name at the invoking
16//!   crate) plus `extern crate alloc;` and
17//!   `extern crate hyperlight_guest_bin;` at its lib root;
18//! - its own `link.x` next to its manifest — `nub_build::build`
19//!   resolves the linker script as `manifest_dir.join("link.x")`;
20//!   copy `rust/javm-guest-x86/link.x` (canonical script until
21//!   nub-build grows an explicit link-script parameter);
22//! - a `heap-diag = ["nub-arch-x86/heap-diag"]` feature — the
23//!   macro-stamped `nub_heap_stats` wrapper's `#[cfg(feature =
24//!   "heap-diag")]` resolves against the invoking crate.
25//!
26//! Guest modules are gated on `cfg(target_os = "none")` so the lib
27//! also compiles on host targets — host code imports the [`test_abi`]
28//! module for FN_ID constants without dragging in any bare-metal
29//! deps.
30
31#![cfg_attr(target_os = "none", no_std)]
32
33#[cfg(target_os = "none")]
34extern crate alloc;
35#[cfg(target_os = "none")]
36extern crate hyperlight_guest_bin;
37
38// Kernel modules — guest-only.
39#[cfg(target_os = "none")]
40pub mod execution_lane;
41#[cfg(target_os = "none")]
42pub mod guest_fns;
43#[cfg(target_os = "none")]
44pub mod jit_cache;
45#[cfg(target_os = "none")]
46pub mod jit_run;
47#[cfg(target_os = "none")]
48pub mod page_alloc;
49#[cfg(target_os = "none")]
50pub mod paging;
51#[cfg(target_os = "none")]
52pub mod personality;
53#[cfg(target_os = "none")]
54pub mod ring3;
55#[cfg(target_os = "none")]
56pub mod segments;
57#[cfg(target_os = "none")]
58pub mod task;
59
60/// FN_ID constants shared between the test/bench guest binaries and
61/// host-side test/bench drivers. Always compiled — host-visible.
62pub mod test_abi;