Skip to main content

VmoMemory

Struct VmoMemory 

Source
pub struct VmoMemory<H> { /* private fields */ }
Expand description

A wrapper around an UnsafeMmio underlying storage that permits injecting behavior on reads and writes to the underlying VMO.

The H handler type is an implementation of VmoMemoryHandler, which is tailored specifically for intersecting loads and stores to the underlying VMO.

Note that VmoMemory always operates on CachedVmoMemory, since the fakes are running in the same process as the test, and there’s no device/peripheral memory in play.

Implementations§

Source§

impl<H: VmoMemoryWrapper> VmoMemory<H>

Source

pub fn map( offset: usize, size: usize, vmo: Vmo, ) -> Result<MmioRegion<Self>, Status>

Maps a zx::Vmo into memory and wraps the resulting VmoMemory inside VmoMemory.

Source§

impl<H> VmoMemory<H>

Source

pub fn new(handler: H, vmo: CachedVmoMemory) -> Self

Creates a new VmoMemory with the provided handler and backing vmo.

Trait Implementations§

Source§

impl<H: VmoMemoryHandler> UnsafeMmio for VmoMemory<H>

Source§

fn len(&self) -> usize

Returns the size, in bytes, of the underlying MMIO region that can be accessed through this object.
Source§

fn align_offset(&self, align: usize) -> usize

Returns the first offset into this MMIO region that is suitably aligned foralign. Read more
Source§

unsafe fn load8_unchecked(&self, offset: usize) -> u8

Loads a u8 from this MMIO region at the given offset. Read more
Source§

unsafe fn load16_unchecked(&self, offset: usize) -> u16

Loads a u16 from this MMIO region at the given offset. Read more
Source§

unsafe fn load32_unchecked(&self, offset: usize) -> u32

Loads a u32 from this MMIO region at the given offset. Read more
Source§

unsafe fn load64_unchecked(&self, offset: usize) -> u64

Loads a u64 from this MMIO region at the given offset. Read more
Source§

unsafe fn store8_unchecked(&self, offset: usize, v: u8)

Stores a u8 to this MMIO region at the given offset. Read more
Source§

unsafe fn store16_unchecked(&self, offset: usize, v: u16)

Stores a u16 to this MMIO region at the given offset. Read more
Source§

unsafe fn store32_unchecked(&self, offset: usize, v: u32)

Stores a u32 to this MMIO region at the given offset. Read more
Source§

unsafe fn store64_unchecked(&self, offset: usize, v: u64)

Stores a u64 to this MMIO region at the given offset. Read more
Source§

fn write_barrier(&self)

Issues a memory write barrier. It is guaranteed that all stores preceding this barrier will appear to have happened before all stores following this barrier.
Source§

fn read_barrier(&self)

Issues a memory read barrier. It is guaranteed that all loads preceding this barrier will appear to have happened before all loads following this barrier. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the MMIO region has a length of 0.
Source§

impl<H: VmoMemoryWrapper> VmoMapper for VmoMemory<H>

Source§

fn map(offset: usize, size: usize, vmo: Vmo) -> Result<MmioRegion<Self>, Status>

Map the specified memory range of the given Vmo in the root Vmar for this process and return an object that maintains the mapping for its lifetime.

Auto Trait Implementations§

§

impl<H> Freeze for VmoMemory<H>
where H: Freeze,

§

impl<H> RefUnwindSafe for VmoMemory<H>
where H: RefUnwindSafe,

§

impl<H> Send for VmoMemory<H>
where H: Send,

§

impl<H> Sync for VmoMemory<H>
where H: Sync,

§

impl<H> Unpin for VmoMemory<H>
where H: Unpin,

§

impl<H> UnsafeUnpin for VmoMemory<H>
where H: UnsafeUnpin,

§

impl<H> UnwindSafe for VmoMemory<H>
where H: UnwindSafe,

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