Skip to main content

Module ecall

Module ecall 

Source
Expand description

EcallHandler trait: how the execution engine dispatches ecalls to the integration layer.

Per architecture: the engine knows there are ecalls and that each carries a kind (PVM ecall opcode 3 with no immediate, vs PVM ecalli opcode 10 with a u32 immediate). It doesn’t know what the kind means. The caller supplies an EcallHandler that interprets ecalls as MGMT operations, host-call selectors, CALL / HALT / yield transfers, etc.

The handler may either:

  • Return Continue — engine continues at the current PC (already advanced past the ecall instruction before the handler runs). Used for purely-stateful ecalls (MGMT_COPY, MGMT_MOVE, etc.) that just mutate regs / mem and resume.

  • Return Exit(reason) — engine returns this ExitReason from execute(). Used for control-flow ecalls (HALT, yield, CALL into another Instance) that require the integration layer.

Structs§

PanickingHandler
A no-op handler: every ecall exits with Panic. Useful as a default for tests where the engine isn’t supposed to encounter ecalls.

Enums§

EcallKind
Which PVM ecall opcode triggered this invocation.
EcallResult
Result of handling one ecall.

Traits§

EcallHandler
Trait the integration layer implements to interpret ecalls.