Struct polkavm_common::abi::GuestMemoryConfig
source · #[repr(C)]pub struct GuestMemoryConfig { /* private fields */ }
Expand description
The memory configuration used by a given guest program.
Implementations§
source§impl GuestMemoryConfig
impl GuestMemoryConfig
pub const fn empty() -> Self
pub const fn new( ro_data_size: u64, rw_data_size: u64, bss_size: u64, stack_size: u64 ) -> Result<Self, &'static str>
sourcepub const fn user_memory_address(self) -> u32
pub const fn user_memory_address(self) -> u32
The address at where the program memory starts inside of the VM.
sourcepub const fn user_memory_size(self) -> u32
pub const fn user_memory_size(self) -> u32
The size of the program memory inside of the VM, excluding the stack.
sourcepub fn clear_user_memory_size(&mut self)
pub fn clear_user_memory_size(&mut self)
Resets the size of the program memory to zero, excluding the stack.
sourcepub const fn ro_data_address(self) -> u32
pub const fn ro_data_address(self) -> u32
The address at where the program’s read-only data starts inside of the VM.
sourcepub const fn ro_data_size(self) -> u32
pub const fn ro_data_size(self) -> u32
The size of the program’s read-only data.
sourcepub const fn ro_data_range(self) -> Range<u32>
pub const fn ro_data_range(self) -> Range<u32>
The range of addresses where the program’s read-only data is inside of the VM.
sourcepub fn set_ro_data_size(
&mut self,
ro_data_size: u32
) -> Result<(), &'static str>
pub fn set_ro_data_size( &mut self, ro_data_size: u32 ) -> Result<(), &'static str>
Sets the program’s read-only data size.
sourcepub const fn rw_data_address(self) -> u32
pub const fn rw_data_address(self) -> u32
The address at where the program’s read-write data starts inside of the VM.
pub const fn rw_data_size(self) -> u32
sourcepub fn set_rw_data_size(
&mut self,
rw_data_size: u32
) -> Result<(), &'static str>
pub fn set_rw_data_size( &mut self, rw_data_size: u32 ) -> Result<(), &'static str>
Sets the program’s read-write data size.
sourcepub const fn bss_address(self) -> u32
pub const fn bss_address(self) -> u32
The address at where the program’s BSS section starts inside of the VM.
pub const fn bss_size(self) -> u32
sourcepub fn set_bss_size(&mut self, bss_size: u32) -> Result<(), &'static str>
pub fn set_bss_size(&mut self, bss_size: u32) -> Result<(), &'static str>
Sets the program’s BSS section size.
sourcepub const fn stack_address_low(self) -> u32
pub const fn stack_address_low(self) -> u32
The address at where the program’s stack starts inside of the VM.
sourcepub const fn stack_address_high(self) -> u32
pub const fn stack_address_high(self) -> u32
The address at where the program’s stack ends inside of the VM.
pub const fn stack_size(self) -> u32
pub const fn stack_range(self) -> Range<u32>
sourcepub fn set_stack_size(&mut self, stack_size: u32) -> Result<(), &'static str>
pub fn set_stack_size(&mut self, stack_size: u32) -> Result<(), &'static str>
Sets the program’s stack size.
pub fn clear_stack_size(&mut self)
sourcepub const fn heap_address(self) -> u32
pub const fn heap_address(self) -> u32
The address at where the program’s read-write memory starts inside of the VM.
sourcepub const fn heap_size(self) -> u32
pub const fn heap_size(self) -> u32
The total size of the program’s read-write memory, excluding the stack.
pub const fn heap_range(self) -> Range<u32>
Trait Implementations§
source§impl Clone for GuestMemoryConfig
impl Clone for GuestMemoryConfig
source§fn clone(&self) -> GuestMemoryConfig
fn clone(&self) -> GuestMemoryConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl PartialEq<GuestMemoryConfig> for GuestMemoryConfig
impl PartialEq<GuestMemoryConfig> for GuestMemoryConfig
source§fn eq(&self, other: &GuestMemoryConfig) -> bool
fn eq(&self, other: &GuestMemoryConfig) -> bool
self
and other
values to be equal, and is used
by ==
.