pub struct VmAspace { /* private fields */ }Implementations§
Source§impl VmAspace
impl VmAspace
Sourcepub fn create_with_opts(
base: usize,
size: usize,
type_: Type,
name: &CStr,
share_opt: ShareOpt,
) -> Option<RefPtr<VmAspace>>
pub fn create_with_opts( base: usize, size: usize, type_: Type, name: &CStr, share_opt: ShareOpt, ) -> Option<RefPtr<VmAspace>>
Creates an address space of the type specified in type_ with name name.
The returned aspace will start at base and span size.
If share_opt is ShareOpt::Shared, we’re creating a shared address space, and the
underlying ArchVmAspace will be initialized using the
init_shared method instead of the normal
init method.
If share_opt is ShareOpt::Restricted, we’re creating a restricted address space, and
the underlying ArchVmAspace will be initialized using the
init_restricted method.
Although reference counted, the returned VmAspace must be explicitly destroyed via
destroy.
Returns None on failure (e.g. due to resource starvation).
Sourcepub unsafe fn create_unified(
shared: *mut VmAspace,
restricted: *mut VmAspace,
name: &CStr,
) -> Option<RefPtr<VmAspace>>
pub unsafe fn create_unified( shared: *mut VmAspace, restricted: *mut VmAspace, name: &CStr, ) -> Option<RefPtr<VmAspace>>
Creates a unified address space that consists of the given constituent address spaces.
The passed in address spaces must meet the following criteria:
- They must manage non-overlapping regions.
- The shared
VmAspacemust have been created with the shared argument set to true.
Although reference counted, the returned VmAspace must be explicitly destroyed via
destroy. Note that it must be destroyed before the shared and
restricted VmAspaces; destroying the constituent VmAspaces before destroying
this one will trigger asserts.
Returns None on failure (e.g. due to resource starvation).
§Safety
The caller must ensure that shared and restricted are valid pointers to address
spaces initialized as shared and restricted respectively.
Sourcepub fn destroy(&self) -> Result<(), Status>
pub fn destroy(&self) -> Result<(), Status>
Destroys this address space.
destroy does not free this object, but rather allows it to be freed when the last
retaining RefPtr is destroyed.
Sourcepub fn arch_aspace(&self) -> &ArchVmAspace
pub fn arch_aspace(&self) -> &ArchVmAspace
Returns a reference to the architecturally specific part of the address space
(ArchVmAspace). This is internally locked and does not need to be guarded by lock_.
Sourcepub fn is_aslr_enabled(&self) -> bool
pub fn is_aslr_enabled(&self) -> bool
Returns true if ASLR is enabled for this address space.
Sourcepub fn is_destroyed(&self) -> bool
pub fn is_destroyed(&self) -> bool
Returns true if this address space has been destroyed.
Sourcepub fn kernel_aspace() -> Option<RefPtr<VmAspace>>
pub fn kernel_aspace() -> Option<RefPtr<VmAspace>>
Returns the singleton kernel address space.
Sourcepub fn root_vmar(&self) -> Option<RefPtr<VmAddressRegion>>
pub fn root_vmar(&self) -> Option<RefPtr<VmAddressRegion>>
Returns the root address region (RootVmar) for this address space.
Sourcepub fn attach_to_thread(&self, thread: ThreadPtr)
pub fn attach_to_thread(&self, thread: ThreadPtr)
Sets the per-thread address space pointer to this address space.
Sourcepub fn drop_all_user_page_tables()
pub fn drop_all_user_page_tables()
Drops all user page tables across all user address spaces.
Sourcepub fn drop_user_page_tables(&self)
pub fn drop_user_page_tables(&self)
Drops all user page tables for this address space.
Sourcepub fn dump_all_aspaces(verbose: bool)
pub fn dump_all_aspaces(verbose: bool)
Dumps all address spaces in the system.
Sourcepub fn harvest_all_user_accessed_bits(
non_terminal_action: NonTerminalAction,
terminal_action: TerminalAction,
)
pub fn harvest_all_user_accessed_bits( non_terminal_action: NonTerminalAction, terminal_action: TerminalAction, )
Harvests all accessed information across all user mappings and updates any page age information for terminal mappings, and potentially harvests page tables depending on the passed in action.
This requires holding aspaces_list_lock_ over the entire duration and
whilst not a commonly used lock this function should still only be called infrequently to
avoid monopolizing the lock.
Sourcepub fn soft_fault(&self, va: usize, flags: u32) -> Result<(), Status>
pub fn soft_fault(&self, va: usize, flags: u32) -> Result<(), Status>
Generates a soft fault against this address space.
This is similar to page_fault except:
- This address space may not currently be active and this does not have to be called from the hardware exception handler.
- May be invoked spuriously in situations where the hardware mappings would have prevented a
real
page_faultfrom occurring.
May block on page requests and must be called without locks held.
Sourcepub fn soft_fault_in_range(
&self,
va: usize,
flags: u32,
len: usize,
) -> Result<(), Status>
pub fn soft_fault_in_range( &self, va: usize, flags: u32, len: usize, ) -> Result<(), Status>
Similar to soft_fault, but additionally takes a length indicating that the range of
[va, va+len) is expected to be accessed with flags after resolving this fault. The
address space can take this range as a hint to attempt to preemptively avoid future faults.
There are no alignment restrictions on va or len, although it is assumed that len is
greater than zero.
Sourcepub fn accessed_fault(&self, va: usize) -> Result<(), Status>
pub fn accessed_fault(&self, va: usize) -> Result<(), Status>
Generates an accessed flag fault against this address space.
This is a specialized version of soft_fault that will only resolve a potential missing
access flag and nothing else.
Sourcepub fn page_fault(&self, va: usize, flags: u32) -> Result<(), Status>
pub fn page_fault(&self, va: usize, flags: u32) -> Result<(), Status>
Page fault routine.
Should only be called by the hypervisor or by Thread::Current::Fault.
Sourcepub unsafe fn alloc_physical(
&self,
name: &CStr,
size: usize,
ptr: *mut *mut c_void,
align_pow2: u8,
paddr: PAddr,
vmm_flags: u32,
arch_mmu_flags: ArchMmuFlags,
) -> Result<(), Status>
pub unsafe fn alloc_physical( &self, name: &CStr, size: usize, ptr: *mut *mut c_void, align_pow2: u8, paddr: PAddr, vmm_flags: u32, arch_mmu_flags: ArchMmuFlags, ) -> Result<(), Status>
Legacy function to assist in the transition to VMARs.
Assumes a flat VMAR structure in which all VMOs are mapped as children of the root. Will assert if used on user address spaces.
§Safety
The caller must ensure ptr points to a valid memory location that can hold the allocated
address or specific starting address.
Sourcepub unsafe fn alloc_contiguous(
&self,
name: &CStr,
size: usize,
ptr: *mut *mut c_void,
align_pow2: u8,
vmm_flags: u32,
arch_mmu_flags: ArchMmuFlags,
) -> Result<(), Status>
pub unsafe fn alloc_contiguous( &self, name: &CStr, size: usize, ptr: *mut *mut c_void, align_pow2: u8, vmm_flags: u32, arch_mmu_flags: ArchMmuFlags, ) -> Result<(), Status>
Legacy function to assist in the transition to VMARs.
Assumes a flat VMAR structure in which all VMOs are mapped as children of the root. Will assert if used on user address spaces.
§Safety
The caller must ensure ptr points to a valid memory location that can hold the allocated
address or specific starting address.
Sourcepub unsafe fn free_region(&self, va: usize) -> Result<(), Status>
pub unsafe fn free_region(&self, va: usize) -> Result<(), Status>
Legacy function to assist in the transition to VMARs.
Assumes a flat VMAR structure in which all VMOs are mapped as children of the root. Will assert if used on user address spaces.
§Safety
The caller must ensure that the virtual address range being freed is no longer in use.
Sourcepub fn vdso_base_address(&self) -> usize
pub fn vdso_base_address(&self) -> usize
Returns the vDSO base address for this address space.
Sourcepub fn vdso_code_address(&self) -> usize
pub fn vdso_code_address(&self) -> usize
Returns the vDSO code address for this address space.
Sourcepub fn is_high_memory_priority(&self) -> bool
pub fn is_high_memory_priority(&self) -> bool
Returns whether this address space is currently set to be a high memory priority.
Trait Implementations§
Source§impl HasRefCount for VmAspace
impl HasRefCount for VmAspace
Source§fn ref_count(&self) -> &RefCounted
fn ref_count(&self) -> &RefCounted
RefCounted field.Source§impl Recyclable for VmAspace
impl Recyclable for VmAspace
Auto Trait Implementations§
impl Freeze for VmAspace
impl RefUnwindSafe for VmAspace
impl Send for VmAspace
impl Sync for VmAspace
impl !Unpin for VmAspace
impl UnsafeUnpin for VmAspace
impl UnwindSafe for VmAspace
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Init<T> for T
impl<T> Init<T> for T
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot. Read more