pub struct VmoMapping { /* private fields */ }Expand description
An active mapping of a Vmo in the root Vmar.
The mapped memory is kept mapped while the VmoMapping object is alive.
Implementations§
Source§impl VmoMapping
impl VmoMapping
Sourcepub fn map(
offset: usize,
size: usize,
vmo: Vmo,
) -> Result<MmioRegion<VmoMemory>, Status>
pub fn map( offset: usize, size: usize, vmo: Vmo, ) -> Result<MmioRegion<VmoMemory>, 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.
Errors:
- Status::OUT_OF_RANGE: if
size > isize::MAX. - Status::OUT_OF_RANGE: if the requested region falls outside of the vmo’s memory.
- An error returned by zx::Vmar::map: if the mapping fails.
Sourcepub fn map_with_cache_policy(
offset: usize,
size: usize,
vmo: Vmo,
cache_policy: CachePolicy,
) -> Result<MmioRegion<VmoMemory>, Status>
pub fn map_with_cache_policy( offset: usize, size: usize, vmo: Vmo, cache_policy: CachePolicy, ) -> Result<MmioRegion<VmoMemory>, Status>
Like VmoMapping::map but specifying a cache_policy.
NOTE: Code targeting a real MMIO mapped region must always use
CachePolicy::UnCachedDevice and production code should prefer to use
VmoMapping::map. This is exposed exclusively to allow test code to
pick a different cache policy when vmo is not in fact backed by an
actual MMIO VMO.
Trait Implementations§
Source§impl Drop for VmoMapping
Unmaps the memory.
impl Drop for VmoMapping
Unmaps the memory.
Auto Trait Implementations§
impl Freeze for VmoMapping
impl RefUnwindSafe for VmoMapping
impl Send for VmoMapping
impl Sync for VmoMapping
impl Unpin for VmoMapping
impl UnsafeUnpin for VmoMapping
impl UnwindSafe for VmoMapping
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