SBPF.State — interpreter state #
The machine state of the sBPF interpreter, ported from vm_state.thy,
vm.thy, ebpf.thy, and the state section of Interpreter.thy. This module
defines the register file, the call-frame stack, the function registry, the
small-step result type, the VM constants, and the initial state.
Main definitions #
Solanalib.SBPF.RegMap— the eleven 64-bit registers as a function.Solanalib.SBPF.StackState— the call-frame stack.Solanalib.SBPF.BpfState— the small-step result (ok/success/eflag/err).Solanalib.SBPF.RegOutcome— an ALU step result (oks/okn/nok).
VM constants #
Number of scratch (caller-saved) registers, BR6–BR9.
Equations
Instances For
Base virtual address of the VM stack region.
Equations
- Solanalib.SBPF.mmStackStart = 8589934592
Instances For
Base virtual address of the program input region.
Equations
- Solanalib.SBPF.mmInputStart = 17179869184
Instances For
Maximum nested call depth.
Equations
Instances For
Size of a single stack frame, in bytes.
Equations
Instances For
Registers #
The register file: each of the eleven registers holds a 64-bit word.
Equations
Instances For
The all-zero register file (init_reg_map).
Equations
Instances For
Call frames and the stack #
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
The initial stack: depth 0, stack pointer at the top of the region, and
maxCallDepth default frames preallocated (init_stack_state).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Function registry #
The function registry: a partial map from a 32-bit key to a target address
(ebpf.thy's func_map).
Equations
Instances For
The empty function registry (init_func_map).
Equations
Instances For
Look up a function address by key (get_function_registry).
Equations
- Solanalib.SBPF.getFunctionRegistry key fm = fm key
Instances For
Step results #
The small-step result (bpf_state).
ok pc rs m ss sv fm curCu remainCu— a normal post-state.success v— the program returnedv.eflag— a runtime fault (out-of-bounds, fuel exhaustion, …).err— a malformed instruction the verifier should have rejected.
- ok (pc : U64) (rs : RegMap) (m : Mem) (ss : StackState) (sv : SBPFV) (fm : FuncMap) (curCu remainCu : U64) : BpfState
- success (v : U64) : BpfState
- eflag : BpfState
- err : BpfState
Instances For
The result of an ALU-style evaluation ('a option2, specialised to the
register file): oks carries the updated registers, okn signals a runtime
fault (EFlag), nok a malformed instruction (Err).
- nok : RegOutcome
- okn : RegOutcome
- oks (rs : RegMap) : RegOutcome
Instances For
The initial machine state: PC 0, BR10 pointing at the top of the stack,
memory m, version v, empty registry, and n units of fuel
(init_bpf_state).
Equations
- One or more equations did not get rendered due to their size.