Struct solana_rbpf::memory_region::AlignedMemoryMapping
source · pub struct AlignedMemoryMapping<'a> { /* private fields */ }
Expand description
Memory mapping that uses the upper half of an address to identify the underlying memory region.
Implementations§
source§impl<'a> AlignedMemoryMapping<'a>
impl<'a> AlignedMemoryMapping<'a>
sourcepub fn new(
regions: Vec<MemoryRegion>,
config: &'a Config,
sbpf_version: &'a SBPFVersion,
) -> Result<Self, EbpfError>
pub fn new( regions: Vec<MemoryRegion>, config: &'a Config, sbpf_version: &'a SBPFVersion, ) -> Result<Self, EbpfError>
Creates a new MemoryMapping structure from the given regions
sourcepub fn new_with_cow(
regions: Vec<MemoryRegion>,
cow_cb: MemoryCowCallback,
config: &'a Config,
sbpf_version: &'a SBPFVersion,
) -> Result<Self, EbpfError>
pub fn new_with_cow( regions: Vec<MemoryRegion>, cow_cb: MemoryCowCallback, config: &'a Config, sbpf_version: &'a SBPFVersion, ) -> Result<Self, EbpfError>
Creates a new MemoryMapping structure from the given regions.
cow_cb
is used to copy CoW regions on the first write access.
sourcepub fn map(
&self,
access_type: AccessType,
vm_addr: u64,
len: u64,
) -> ProgramResult
pub fn map( &self, access_type: AccessType, vm_addr: u64, len: u64, ) -> ProgramResult
Given a list of regions translate from virtual machine to host address
sourcepub fn load<T: Pod + Into<u64>>(&self, vm_addr: u64) -> ProgramResult
pub fn load<T: Pod + Into<u64>>(&self, vm_addr: u64) -> ProgramResult
Loads size_of::<T>()
bytes from the given address.
See MemoryMapping::load.
sourcepub fn store<T: Pod>(&self, value: T, vm_addr: u64) -> ProgramResult
pub fn store<T: Pod>(&self, value: T, vm_addr: u64) -> ProgramResult
Store value
at the given address.
See MemoryMapping::store.
sourcepub fn region(
&self,
access_type: AccessType,
vm_addr: u64,
) -> Result<&MemoryRegion, EbpfError>
pub fn region( &self, access_type: AccessType, vm_addr: u64, ) -> Result<&MemoryRegion, EbpfError>
Returns the MemoryRegion
corresponding to the given address.
sourcepub fn get_regions(&self) -> &[MemoryRegion]
pub fn get_regions(&self) -> &[MemoryRegion]
Returns the MemoryRegion
s in this mapping
sourcepub fn replace_region(
&mut self,
index: usize,
region: MemoryRegion,
) -> Result<(), EbpfError>
pub fn replace_region( &mut self, index: usize, region: MemoryRegion, ) -> Result<(), EbpfError>
Replaces the MemoryRegion
at the given index
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for AlignedMemoryMapping<'a>
impl<'a> !RefUnwindSafe for AlignedMemoryMapping<'a>
impl<'a> !Send for AlignedMemoryMapping<'a>
impl<'a> !Sync for AlignedMemoryMapping<'a>
impl<'a> Unpin for AlignedMemoryMapping<'a>
impl<'a> !UnwindSafe for AlignedMemoryMapping<'a>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more