Skip to main content

Regions

Struct Regions 

Source
pub struct Regions {
    pub stack_pages: u32,
    pub ro_pages: u32,
    pub rw_pages: u32,
    pub heap_pages: u32,
}
Expand description

Data-region geometry: the page count of each of the four fixed regions. Placement is derived, not stored — regions stack linearly from DATA_BASE in the order stack, ro, rw, heap, so the page counts alone determine every base address.

A region with zero pages is omitted from Regions::iter entirely and occupies no address space.

Fields§

§stack_pages: u32§ro_pages: u32§rw_pages: u32§heap_pages: u32

Implementations§

Source§

impl Regions

Source

pub fn iter(&self) -> impl Iterator<Item = Region> + '_

Iterate every non-empty region in address (and RegionKind) order: stack, ro?, rw?, heap?.

Consumers that pack a content-addressed arena in insertion order depend on this order being stable; do not reorder it.

Source

pub fn get(&self, kind: RegionKind) -> Option<Region>

Look up one region by kind, or None if it is empty.

Source

pub const fn stack_top(&self) -> u64

Top-of-stack address (initial SP). RISC-V SP grows downward, so the first push lands at stack_top - 8.

Source

pub const fn total_pages(&self) -> u32

Total pages across all regions.

Source

pub const fn data_extent(&self) -> u64

Total data length in bytes, i.e. the size of the flat memory image a runtime must materialize at DATA_BASE.

Source

pub const fn data_end(&self) -> u64

One past the last data byte, in guest addresses.

Trait Implementations§

Source§

impl Clone for Regions

Source§

fn clone(&self) -> Regions

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Regions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Regions

Source§

fn default() -> Regions

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Regions

Source§

fn eq(&self, other: &Regions) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Regions

Source§

impl Eq for Regions

Source§

impl StructuralPartialEq for Regions

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.