Skip to main content

VmMapping

Struct VmMapping 

Source
pub struct VmMapping { /* private fields */ }
Expand description

A leaf mapping that maps a VMO into the address space.

This is an opaque FFI wrapper around Zircon’s C++ VmMapping class.

Implementations§

Source§

impl VmMapping

Source

pub fn destroy(&self) -> Result<(), Status>

Destroys this mapping, unmapping all pages and removing dependencies on the underlying VMO.

Source

pub fn base(&self) -> usize

Returns the base virtual address of this mapping.

Source

pub fn size(&self) -> usize

Returns the size in bytes of this mapping.

Source

pub fn flags(&self) -> u32

Returns the creation flags of this mapping.

Source

pub fn object_offset(&self) -> u64

Returns the offset into the underlying VMO for this mapping.

Source

pub fn decommit_range(&self, offset: usize, len: usize) -> Result<(), Status>

Convenience wrapper for vmo()->DecommitRange() with the necessary offset modification and locking.

Source

pub fn map_range( &self, offset: usize, len: usize, commit: bool, ignore_existing: bool, ) -> Result<(), Status>

Map in pages from the underlying vm object, optionally committing pages as it goes. |ignore_existing| controls whether existing hardware mappings in the specified range should be ignored or treated as an error. |ignore_existing| should only be set to true for user mappings where populating mappings may already be racy with multiple threads, and where we are already tolerant of mappings being arbitrarily created and destroyed.

Source

pub fn debug_unmap(&self, base: usize, size: usize) -> Result<(), Status>

Unlocked convenience wrapper around unmap for testing.

Source

pub fn debug_protect( &self, base: usize, size: usize, new_arch_mmu_flags: ArchMmuFlags, ) -> Result<(), Status>

Unlocked convenience wrapper around protect for testing.

Source

pub fn vmo(&self) -> Option<RefPtr<VmObject>>

Returns the underlying VMO backing this mapping.

Trait Implementations§

Source§

impl HasRefCount for VmMapping

Source§

fn ref_count(&self) -> &RefCounted

Returns a reference to the contained RefCounted field.
Source§

impl Recyclable for VmMapping

Source§

unsafe fn recycle(ptr: NonNull<Self>)

Recycles the object. Read more
Source§

fn allocate(_value: Self) -> Result<NonNull<Self>, AllocError>

Allocates a new instance of Self.
Source§

unsafe fn recycle_ffi(ptr: *mut c_void)

Helper for FFI functions to call recycle. Read more

Auto Trait Implementations§

§

impl Freeze for VmMapping

§

impl RefUnwindSafe for VmMapping

§

impl Send for VmMapping

§

impl Sync for VmMapping

§

impl !Unpin for VmMapping

§

impl UnsafeUnpin for VmMapping

§

impl UnwindSafe for VmMapping

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Init<T> for T

§

unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> PinInit<T> for T

§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.