Struct polkavm_common::zygote::VmCtx
source · #[repr(C)]pub struct VmCtx {
pub heap_info: VmCtxHeapInfo,
pub futex: CacheAligned<AtomicU32>,
pub rpc_address: UnsafeCell<u64>,
pub rpc_flags: UnsafeCell<u32>,
pub rpc_sbrk: UnsafeCell<u32>,
pub memory_config: UnsafeCell<SandboxMemoryConfig>,
pub is_memory_dirty: AtomicBool,
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§
§heap_info: VmCtxHeapInfo
The state of the program’s heap.
futex: CacheAligned<AtomicU32>
The futex used to synchronize the sandbox with the host process.
rpc_address: UnsafeCell<u64>
The address of the native code to call inside of the VM, if non-zero.
rpc_flags: UnsafeCell<u32>
Flags specifying what exactly the sandbox should do.
rpc_sbrk: UnsafeCell<u32>
The amount of memory to allocate.
memory_config: UnsafeCell<SandboxMemoryConfig>
The memory configuration of the sandbox.
is_memory_dirty: AtomicBool
Whether the memory of the sandbox is dirty.
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.
Implementations§
source§impl VmCtx
impl VmCtx
pub const fn gas(&self) -> &UnsafeCell<i64>
pub const fn heap_info(&self) -> &VmCtxHeapInfo
pub const fn hostcall(&self) -> &UnsafeCell<u32>
pub const fn regs(&self) -> &UnsafeCell<[u32; 13]>
pub const fn rip(&self) -> &UnsafeCell<u64>
pub const fn nth_instruction(&self) -> &UnsafeCell<u32>
Auto Trait Implementations§
impl !Freeze for VmCtx
impl !RefUnwindSafe for VmCtx
impl Send for VmCtx
impl !Sync for VmCtx
impl Unpin for VmCtx
impl UnwindSafe for VmCtx
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more