Skip to main content

Crate nub_arch_x86_abi

Crate nub_arch_x86_abi 

Source
Expand description

Wire format for the host ↔ guest “run this PVM program” RPC.

The host pre-publishes each Cap it wants the guest to see via the FN_ID_NUB_PUT_CAP RPC (rkyv-archived WireCap payload; see the state_cache module in nub-arch-x86 for the guest-side heap-resident directory it lands in), then ships a fixed-size InvokePacket referencing the published Cap::Instance by hash on every call. The invoke packet is #[repr(C)] bytes (no codec); the response is rkyv-archived (InvocationResult).

Structs§

ArchivedInvocationResult
An archived InvocationResult
BootInfo
Boot-time info published by the guest at a known location (linker section .boot_info). The host reads it after the sandbox boots to learn the VA of the guest’s cap directory, then dereferences the directory directly from host code (the kernel half is mapped at the same VA via the shallow-PML4-copy mechanism, so a directory-VA pointer is valid both in guest kernel mode and via the host’s mmap shadow of the kernel image).
InvocationResult
Invocation result. Both backends produce this shape on completion; rkyv-archived on the wire from the cached path’s response.
InvocationResultResolver
The resolver for an archived InvocationResult
InvokePacket
Fixed-layout invocation packet. Sent as raw #[repr(C)] bytes via the existing rkyv Request envelope (its payload field). The guest reads the bytes directly with core::ptr::read_unaligned.

Constants§

FN_ID_NUB_GET_BOOT_INFO
fn_id for the boot-info-read diagnostic RPC. Empty payload; the guest replies with the raw bytes of its BootInfo struct. The host can also obtain the same data by reading the kernel’s .boot_info ELF section directly — this RPC exists as a belt-and-braces fallback in case the ELF symbol lookup misses.
FN_ID_NUB_HEAP_STATS
fn_id for the nub_heap_stats diagnostic. Payload is empty; response is 32 bytes packing four LE u64s (allocated_bytes, allocation_count, fragment_count, available_bytes).
FN_ID_NUB_INVOKE_CACHED
fn_id for the cache-based RPC. Payload is a InvokePacket (host-side #[repr(C)] bytes, no rkyv); the guest dereferences cache VAs by instance_hash lookup, runs the JIT, and replies with rkyv-archived InvocationResult.
FN_ID_NUB_PUT_CAP
fn_id for the heap-resident cap directory put_cap RPC.
FN_ID_NUB_SMOKE
fn_id for the nub_smoke skeleton RPC (returns 42u64).
GUEST_FN_TABLE_SIZE
Number of guest-function slots reserved in the dispatch table. Must be at least max(FN_ID_*) + 1.

Type Aliases§

CapHash
32-byte Cap::Instance identity hash. Matches javm_cap::CapHash byte-wise (kept as a local alias here so nub-arch-x86-abi stays free of the javm-cap dependency, which pulls in alloc::collections etc.).