Struct solana_rbpf::memory_region::MemoryRegion
source · [−]#[repr(C, align(32))]pub struct MemoryRegion {
pub host_addr: u64,
pub vm_addr: u64,
pub len: u64,
pub vm_gap_shift: u8,
pub is_writable: bool,
}
Expand description
Memory region for bounds checking and address translation
Fields
host_addr: u64
start host address
vm_addr: u64
start virtual address
len: u64
Length in bytes
vm_gap_shift: u8
Size of regular gaps as bit shift (63 means this region is continuous)
is_writable: bool
Is also writable (otherwise it is readonly)
Implementations
sourceimpl MemoryRegion
impl MemoryRegion
sourcepub fn new_from_slice(
slice: &[u8],
vm_addr: u64,
vm_gap_size: u64,
is_writable: bool
) -> Self
pub fn new_from_slice(
slice: &[u8],
vm_addr: u64,
vm_gap_size: u64,
is_writable: bool
) -> Self
Creates a new MemoryRegion structure from a slice
sourcepub fn vm_to_host<E: UserDefinedError>(
&self,
vm_addr: u64,
len: u64
) -> Result<u64, EbpfError<E>>
pub fn vm_to_host<E: UserDefinedError>(
&self,
vm_addr: u64,
len: u64
) -> Result<u64, EbpfError<E>>
Convert a virtual machine address into a host address Does not perform a lower bounds check, as that is already done by the binary search in MemoryMapping::map()
Trait Implementations
sourceimpl Clone for MemoryRegion
impl Clone for MemoryRegion
sourcefn clone(&self) -> MemoryRegion
fn clone(&self) -> MemoryRegion
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MemoryRegion
impl Debug for MemoryRegion
sourceimpl Default for MemoryRegion
impl Default for MemoryRegion
sourcefn default() -> MemoryRegion
fn default() -> MemoryRegion
Returns the “default value” for a type. Read more
sourceimpl Ord for MemoryRegion
impl Ord for MemoryRegion
sourceimpl PartialEq<MemoryRegion> for MemoryRegion
impl PartialEq<MemoryRegion> for MemoryRegion
sourcefn eq(&self, other: &MemoryRegion) -> bool
fn eq(&self, other: &MemoryRegion) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MemoryRegion) -> bool
fn ne(&self, other: &MemoryRegion) -> bool
This method tests for !=
.
sourceimpl PartialOrd<MemoryRegion> for MemoryRegion
impl PartialOrd<MemoryRegion> for MemoryRegion
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for MemoryRegion
impl StructuralEq for MemoryRegion
impl StructuralPartialEq for MemoryRegion
Auto Trait Implementations
impl RefUnwindSafe for MemoryRegion
impl Send for MemoryRegion
impl Sync for MemoryRegion
impl Unpin for MemoryRegion
impl UnwindSafe for MemoryRegion
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more