Skip to main content

Crate nub_arch_local

Crate nub_arch_local 

Source
Expand description

In-process Arch impl: simulates the CPU + MMU substrate with Rust data structures. Runs directly in the host process; no sandbox, no cross-compilation.

Personality-agnostic: run_program takes a prepared ProgramSpec (code, flat memory image, overlays, registers) plus an [EcallHandler], wires it to [nub_exec::interp::Interpreter::run], and produces an [InvocationResult]. This is the in-process counterpart to nub-arch-x86’s JIT-driven enter_frame / build_frame_runtime. The personality lowers its own object types into a ProgramSpec (JAVM: javm::JavmLocal’s run_instance). For a program with no personality at all, program::PreparedProgram lowers a nub_program::ProgramBlob directly.

Re-exports§

pub use program::PrepareError;
pub use program::PreparedProgram;
pub use program::run_blob;

Modules§

program
Lower a [ProgramBlob] into a runnable ProgramSpec.

Structs§

ExitingEcallHandler
Minimal EcallHandler: every ecall / ecalli ends the run by surfacing the corresponding ExitReason, matching the JIT trampoline’s exit shape.
LocalArch
In-process Arch backend.
ProgramInstance
A prepared address space plus predecoded code, ready to execute.
ProgramSpec
Personality-agnostic program description for run_program: what to execute, over what memory, starting from which register file. The personality (JAVM: javm::JavmLocal’s run_instance) is responsible for lowering its own object types into this shape.
RoOverlay
A read-only overlay re-laid on top of the flat memory image: the bytes at image[image_off..image_off + len] become read-only at guest address start, so guest stores fault (matching the recompiler’s pinned direct maps).

Enums§

LocalArchError
Stub error type for the skeleton — the local backend cannot fail today. Replace with a real error enum when invocation lands.

Functions§

run_program
Run a prepared ProgramSpec through the PVM2 (RISC-V) interpreter, returning the same InvocationResult shape nub-arch-x86’s JIT path produces. The exit-reason mapping matches the JIT exit codes (HostCall=4, Trap=7, etc.) so the two backends agree on a well-formed program.