Struct polkavm_common::abi::MemoryMap

source ·
#[repr(C)]
pub struct MemoryMap { /* private fields */ }
Expand description

The memory map of a given guest program.

Implementations§

source§

impl MemoryMap

source

pub const fn empty() -> Self

Creates an empty memory map.

source

pub fn new( page_size: u32, ro_data_size: u32, rw_data_size: u32, stack_size: u32, ) -> Result<Self, &'static str>

Calculates the memory map from the given parameters.

source

pub fn page_size(&self) -> u32

The page size of the program.

source

pub fn heap_base(&self) -> u32

The address at which the program’s heap starts.

source

pub fn max_heap_size(&self) -> u32

The maximum size of the program’s heap.

source

pub fn ro_data_address(&self) -> u32

The address at where the program’s read-only data starts inside of the VM.

source

pub fn ro_data_size(&self) -> u32

The size of the program’s read-only data.

source

pub fn ro_data_range(&self) -> Range<u32>

The range of addresses where the program’s read-only data is inside of the VM.

source

pub fn rw_data_address(&self) -> u32

The address at where the program’s read-write data starts inside of the VM.

source

pub fn rw_data_size(&self) -> u32

The size of the program’s read-write data.

source

pub fn rw_data_range(&self) -> Range<u32>

The range of addresses where the program’s read-write data is inside of the VM.

source

pub fn stack_address_low(&self) -> u32

The address at where the program’s stack starts inside of the VM.

source

pub fn stack_address_high(&self) -> u32

The address at where the program’s stack ends inside of the VM.

source

pub fn stack_size(&self) -> u32

The size of the program’s stack.

source

pub fn stack_range(&self) -> Range<u32>

The range of addresses where the program’s stack is inside of the VM.

Trait Implementations§

source§

impl Clone for MemoryMap

source§

fn clone(&self) -> MemoryMap

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.