Skip to main content

Crate nub_arch_x86

Crate nub_arch_x86 

Source
Expand description

Nub Arch implementation for Hyperlight: a bare-metal guest binary that runs the PVM in-kernel JIT path on real CPU + MMU.

Built with nub-buildcargo build --target=x86_64-unknown-none. Links against nub-arch-guestbin (our forked + trimmed hyperlight-guest-bin). Entry point is entrypoint (supplied by guestbin), which initialises the heap + GDT + IDT then calls hyperlight_main. We don’t define hyperlight_main ourselves; the weak default in guestbin is fine.

Guest functions are registered via #[guest_function(fn_id = N)] from nub-host-guest-macro, which slots them into a linkme distributed-slice (GUEST_FUNCTION_TABLE) at compile time. The host invokes them by fn_id via Hyperlight’s OUT-port + shared-memory function-call ABI, with rkyv-encoded Request / Response envelopes.

On host targets (target_os != “none”) this crate compiles to a trivial empty main so cargo build --workspace succeeds without dragging Hyperlight-guest deps onto host platforms. Only cargo build --target=x86_64-unknown-none produces a real guest ELF.

Functions§

main 🔒
Empty main so cargo build --workspace (host target) succeeds without including any of the bare-metal guest code. The real entry point on x86_64-unknown-none is entrypoint from the linked guestbin.