Skip to main content

VmAddressRegion

Struct VmAddressRegion 

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

A contiguous region of the virtual address space.

Implementations§

Source§

impl VmAddressRegion

Source

pub fn create_sub_vmar( &self, offset: usize, size: usize, align_pow2: u8, vmar_flags: u32, name: &CStr, ) -> Result<RefPtr<VmAddressRegion>, Status>

Creates a subregion of this region.

Source

pub fn create_vm_mapping( &self, mapping_offset: usize, size: usize, align_pow2: u8, vmar_flags: u32, vmo: RefPtr<VmObject>, vmo_offset: u64, arch_mmu_flags: ArchMmuFlags, name: &CStr, ) -> Result<MapResult, Status>

Creates a VmMapping within this region.

To avoid leaks, this should be paired with a call to VmMapping::destroy if desired; dropping MapResult::mapping will not destroy the mapping.

Source

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

Destroys this region and recursively destroys child VMARs.

Source

pub fn base(&self) -> VAddr

Returns the base address of this region.

Source

pub fn size(&self) -> usize

Returns the size in bytes of this region.

Source

pub fn flags(&self) -> u32

Returns the creation flags of this region.

Source

pub fn name(&self) -> &CStr

Returns the name of this region.

Source

pub fn has_parent(&self) -> bool

Returns true if this region has a parent region.

Source

pub fn set_memory_priority( &self, priority: MemoryPriority, ) -> Result<(), Status>

Applies the given memory priority to this region and all subregions.

Source

pub unsafe fn unmap( &self, base: VAddr, size: usize, op_children: VmAddressRegionOpChildren, ) -> Result<(), Status>

Unmaps a subset of the region of memory in the containing address space.

§Safety

Caller must ensure the specified virtual address region to unmap is no longer used.

Source

pub fn protect( &self, base: VAddr, size: usize, new_arch_mmu_flags: ArchMmuFlags, op_children: VmAddressRegionOpChildren, ) -> Result<(), Status>

Changes protections on a subset of the region of memory in the containing address space.

Source

pub fn reserve_space( &self, name: &CStr, base: usize, size: usize, arch_mmu_flags: ArchMmuFlags, ) -> Result<(), Status>

Reserves a memory region within this VMAR without allocating physical pages.

Trait Implementations§

Source§

impl HasRefCount for VmAddressRegion

Source§

fn ref_count(&self) -> &RefCounted

Returns a reference to the contained RefCounted field.
Source§

impl Recyclable for VmAddressRegion

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 VmAddressRegion

§

impl RefUnwindSafe for VmAddressRegion

§

impl Send for VmAddressRegion

§

impl Sync for VmAddressRegion

§

impl !Unpin for VmAddressRegion

§

impl UnsafeUnpin for VmAddressRegion

§

impl UnwindSafe for VmAddressRegion

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.