Expand description
The run loop: a machine that owns its code, discovers more of it as the guest reaches it, and stops with a reason instead of an error.
Two things separate this from driving StandaloneEmulator directly.
The context is owned, not borrowed. Lifting new code mutates the module,
which a &Context cannot allow. This is why the VM is built on
StandaloneEmulator — the lifetime-free emulator that takes &Context per
call — rather than on Emulator<'ctx>, which would pin the module for as
long as the machine exists.
Stopping is a value. A guest that reads unmapped memory has not broken
the emulator; it has taken a fault, which a harness may want to report,
resume from, or count as a crash. So the loop returns VmExit and leaves
the machine intact and inspectable.
Structs§
- Executed
- Where an executor left the machine.
- Interrupt
- A stop at a user p-code operation, with what the host needs to act on it.
- Vm
- A machine: an owned module, a memory, and a position in the code.
Enums§
- Code
Error - Why a lifting attempt failed.
- Interrupt
Kind - What kind of operation stopped the machine.
- Resume
Error - Why
Vm::resumerefused. - VmExit
- Why the machine stopped.
Traits§
- Block
Executor - An alternative way to execute a block’s body.
- Code
Source - Supplies code the machine has not seen yet.