Skip to main content

run_instance

Function run_instance 

Source
pub fn run_instance(
    instance: &InstanceCap,
    image: &ImageCap,
    endpoint_idx: u8,
    args: [u64; 4],
    initial_gas: u64,
) -> InvocationResult
Expand description

Run an Instance 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.

Endpoint dispatch: endpoint_idx selects image.endpoints[endpoint_idx]; the endpoint’s entry_pc is used as the start PC. Caller-supplied args overlay φ[7..=10] on top of the endpoint’s initial_regs. Memory is seeded from the Instance’s mem DataCap (the whole RW extent), with pinned mappings re-laid read-only.