Skip to main content

GuestMemory

Struct GuestMemory 

Source
pub struct GuestMemory {
    pub brk: u64,
    pub brk_floor: u64,
    pub stack_top: u64,
    /* private fields */
}

Fields§

§brk: u64§brk_floor: u64§stack_top: u64

Implementations§

Source§

impl GuestMemory

Source

pub fn new() -> Self

Source

pub fn from_program(program: &ProgramImage) -> JitResult<Self>

Source

pub fn as_abi_mut(&mut self) -> *mut GuestMemoryAbi

Source

pub fn map_program(&mut self, program: &ProgramImage) -> JitResult<()>

Source

pub fn map_program_at( &mut self, program: &ProgramImage, bias: u64, ) -> JitResult<()>

Source

pub fn map_zeroed( &mut self, base: u64, size: u64, perms: PagePerms, ) -> JitResult<()>

Source

pub fn map_bytes( &mut self, base: u64, bytes: &[u8], perms: PagePerms, ) -> JitResult<()>

Source

pub fn can_map(&self, base: u64, size: u64) -> bool

Source

pub fn replace_mapping( &mut self, base: u64, size: u64, perms: PagePerms, bytes: &[u8], ) -> JitResult<()>

Source

pub fn protect(&mut self, base: u64, size: u64, perms: PagePerms) -> bool

Source

pub fn unmap(&mut self, base: u64, size: u64) -> JitResult<()>

Source

pub fn find_free_range(&self, start: u64, size: u64) -> Option<u64>

Source

pub fn range_is_free(&self, base: u64, size: u64) -> bool

Source

pub fn load_le(&self, addr: u64, size: usize) -> Option<u64>

Source

pub fn check_range(&self, addr: u64, size: usize, perms: PagePerms) -> bool

Source

pub fn load_bytes(&self, addr: u64, size: usize) -> Option<Vec<u8>>

Source

pub fn fetch_u16(&self, addr: u64) -> Option<u16>

Source

pub fn fetch_u32(&self, addr: u64) -> Option<u32>

Source

pub fn executable_end(&self, addr: u64) -> Option<u64>

Source

pub fn store_le(&mut self, addr: u64, size: usize, value: u64) -> bool

Source

pub fn store_bytes(&mut self, addr: u64, bytes: &[u8]) -> bool

Source

pub fn can_execute(&self, addr: u64) -> bool

Source

pub fn mappings(&self) -> Vec<(u64, u64, PagePerms)>

Source

pub fn mapped_pages(&self) -> impl Iterator<Item = (u64, PagePerms, &[u8])>

Trait Implementations§

Source§

impl Clone for GuestMemory

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Default for GuestMemory

Source§

fn default() -> Self

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

impl SyscallMemory for GuestMemory

Source§

fn can_write(&mut self, address: u64, size: usize) -> bool

Source§

fn load_bytes(&mut self, address: u64, size: usize) -> Option<Vec<u8>>

Source§

fn store_bytes(&mut self, address: u64, bytes: &[u8]) -> bool

Source§

fn read_string(&mut self, addr: u64, max: usize) -> Result<String, i32>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.