Struct polkavm_common::zygote::VmCtx
source · #[repr(C)]pub struct VmCtx {
pub futex: CacheAligned<AtomicU32>,
pub rpc_address: UnsafeCell<u64>,
pub rpc_flags: UnsafeCell<u32>,
pub memory_config: UnsafeCell<SandboxMemoryConfig>,
pub new_memory_config: UnsafeCell<SandboxMemoryConfig>,
pub new_sysreturn_address: UnsafeCell<u64>,
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§
§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.
memory_config: UnsafeCell<SandboxMemoryConfig>
The current memory configuration of the sandbox.
new_memory_config: UnsafeCell<SandboxMemoryConfig>
The new memory configuration of the sandbox. Will be applied if the appropriate flag is set.
new_sysreturn_address: UnsafeCell<u64>
The new sysreturn trampoline address. Will be applied if the appropriate flag is set.
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 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 !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