pub struct ProgramLayout {
pub stack: DataCapEntry,
pub ro: Option<DataCapEntry>,
pub rw: Option<DataCapEntry>,
pub heap: Option<DataCapEntry>,
}Expand description
Full DATA-cap layout of a transpiler-emitted blob. stack is
always present; ro, rw, heap are present only when their
page count is non-zero. Args bytes are delivered separately
(kernel-allocated cap at bare-Frame slot 4), so they are not part
of the layout.
Fields§
§stack: DataCapEntry§ro: Option<DataCapEntry>§rw: Option<DataCapEntry>§heap: Option<DataCapEntry>Implementations§
Source§impl ProgramLayout
impl ProgramLayout
Sourcepub fn compute(
stack_pages: u32,
ro_pages: u32,
rw_pages: u32,
heap_pages: u32,
) -> Self
pub fn compute( stack_pages: u32, ro_pages: u32, rw_pages: u32, heap_pages: u32, ) -> Self
Compute the layout from per-region page counts. stack_pages
must be ≥ 1 in any sane build, but the function does not enforce
that. ro_pages, rw_pages, heap_pages of zero omit those
caps entirely.
Sourcepub fn data_caps(&self) -> impl Iterator<Item = &DataCapEntry> + '_
pub fn data_caps(&self) -> impl Iterator<Item = &DataCapEntry> + '_
Iterate every DATA cap entry in cap-index (and base-page) order: stack, ro?, rw?, heap?.
Sourcepub fn stack_top(&self) -> u64
pub 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.
Sourcepub fn total_data_pages(&self) -> u32
pub fn total_data_pages(&self) -> u32
Total pages across all DATA caps in this layout.
Trait Implementations§
Source§impl Clone for ProgramLayout
impl Clone for ProgramLayout
Source§fn clone(&self) -> ProgramLayout
fn clone(&self) -> ProgramLayout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ProgramLayout
impl RefUnwindSafe for ProgramLayout
impl Send for ProgramLayout
impl Sync for ProgramLayout
impl Unpin for ProgramLayout
impl UnsafeUnpin for ProgramLayout
impl UnwindSafe for ProgramLayout
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.