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 (custom-0 ecall.jar, funct3=001, no immediate, vs custom-0 ecalli, funct3=010, with a sign-extended imm12 carried as a u32). 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 custom-0 ecall encoding triggered this invocation.
EcallResult
Result of handling one ecall.

Traits§

EcallHandler
Trait the integration layer implements to interpret ecalls.