#[repr(C)]pub struct VmCtx {Show 26 fields
pub gas: AtomicI64,
pub futex: AtomicU32,
pub jump_into: AtomicU64,
pub program_counter: AtomicU32,
pub next_program_counter: AtomicU32,
pub arg: AtomicU32,
pub regs: [AtomicU64; 13],
pub next_native_program_counter: AtomicU64,
pub heap_info: VmCtxHeapInfo,
pub arg2: AtomicU32,
pub shm_memory_map_offset: AtomicU64,
pub shm_memory_map_count: AtomicU64,
pub shm_code_offset: AtomicU64,
pub shm_code_length: AtomicU64,
pub shm_jump_table_offset: AtomicU64,
pub shm_jump_table_length: AtomicU64,
pub sysreturn_address: AtomicU64,
pub uffd_enabled: AtomicBool,
pub heap_base: UnsafeCell<u32>,
pub heap_initial_threshold: UnsafeCell<u32>,
pub heap_max_size: UnsafeCell<u32>,
pub page_size: UnsafeCell<u32>,
pub counters: CacheAligned<VmCtxCounters>,
pub init: VmInit,
pub message_length: UnsafeCell<u32>,
pub message_buffer: UnsafeCell<[u8; 512]>,
/* private fields */
}
Expand description
The virtual machine context.
This is mapped in shared memory and used by the sandbox to keep its state in, as well as by the host to communicate with the sandbox.
Fields§
§gas: AtomicI64
The current gas counter.
futex: AtomicU32
The futex used to synchronize the sandbox with the host process.
jump_into: AtomicU64
Address to which to jump to.
program_counter: AtomicU32
The address of the instruction currently being executed.
next_program_counter: AtomicU32
The address of the next instruction to be executed.
arg: AtomicU32
A multipurpose field:
- the hostcall number that was triggered,
- the sbrk argument,
- the sbrk return value,
regs: [AtomicU64; 13]
A dump of all of the registers of the VM.
next_native_program_counter: AtomicU64
The address of the native code to call inside of the VM process, if non-zero.
heap_info: VmCtxHeapInfo
The state of the program’s heap.
arg2: AtomicU32
§shm_memory_map_offset: AtomicU64
Offset in shared memory to this sandbox’s memory map.
shm_memory_map_count: AtomicU64
Number of maps to map.
shm_code_offset: AtomicU64
Offset in shared memory to this sandbox’s code.
shm_code_length: AtomicU64
Length this sandbox’s code.
shm_jump_table_offset: AtomicU64
Offset in shared memory to this sandbox’s jump table.
shm_jump_table_length: AtomicU64
Length of sandbox’s jump table, in bytes.
sysreturn_address: AtomicU64
Address of the sysreturn routine.
uffd_enabled: AtomicBool
Whether userfaultfd-based memory management is enabled.
heap_base: UnsafeCell<u32>
Address to the base of the heap.
heap_initial_threshold: UnsafeCell<u32>
The initial heap growth threshold.
heap_max_size: UnsafeCell<u32>
The maximum heap size.
page_size: UnsafeCell<u32>
The page size.
counters: CacheAligned<VmCtxCounters>
Performance counters. Only for debugging.
init: VmInit
One-time args used during initialization.
message_length: UnsafeCell<u32>
Length of the message in the message buffer.
message_buffer: UnsafeCell<[u8; 512]>
A buffer used to marshal error messages.