pub struct AddrSpace<H: PagingHandler> { /* private fields */ }Expand description
The virtual memory address space.
Implementations§
Source§impl<H: PagingHandler> AddrSpace<H>
impl<H: PagingHandler> AddrSpace<H>
Sourcepub const fn base(&self) -> GuestPhysAddr
pub const fn base(&self) -> GuestPhysAddr
Returns the address space base.
Sourcepub const fn end(&self) -> GuestPhysAddr
pub const fn end(&self) -> GuestPhysAddr
Returns the address space end.
Sourcepub const fn page_table(&self) -> &PageTable64<A64HVPagingMetaData, A64PTEHV, H>
pub const fn page_table(&self) -> &PageTable64<A64HVPagingMetaData, A64PTEHV, H>
Returns the reference to the inner page table.
Sourcepub const fn page_table_root(&self) -> PhysAddr
pub const fn page_table_root(&self) -> PhysAddr
Returns the root physical address of the inner page table.
Sourcepub fn contains_range(&self, start: GuestPhysAddr, size: usize) -> bool
pub fn contains_range(&self, start: GuestPhysAddr, size: usize) -> bool
Checks if the address space contains the given address range.
Sourcepub fn new_empty(base: GuestPhysAddr, size: usize) -> AxResult<Self>
pub fn new_empty(base: GuestPhysAddr, size: usize) -> AxResult<Self>
Creates a new empty address space.
Sourcepub fn map_linear(
&mut self,
start_vaddr: GuestPhysAddr,
start_paddr: PhysAddr,
size: usize,
flags: MappingFlags,
) -> AxResult
pub fn map_linear( &mut self, start_vaddr: GuestPhysAddr, start_paddr: PhysAddr, size: usize, flags: MappingFlags, ) -> AxResult
Add a new linear mapping.
See Backend for more details about the mapping backends.
The flags parameter indicates the mapping permissions and attributes.
Sourcepub fn map_alloc(
&mut self,
start: GuestPhysAddr,
size: usize,
flags: MappingFlags,
populate: bool,
) -> AxResult
pub fn map_alloc( &mut self, start: GuestPhysAddr, size: usize, flags: MappingFlags, populate: bool, ) -> AxResult
Add a new allocation mapping.
See Backend for more details about the mapping backends.
The flags parameter indicates the mapping permissions and attributes.
Sourcepub fn unmap(&mut self, start: GuestPhysAddr, size: usize) -> AxResult
pub fn unmap(&mut self, start: GuestPhysAddr, size: usize) -> AxResult
Removes mappings within the specified virtual address range.
Sourcepub fn handle_page_fault(
&mut self,
vaddr: GuestPhysAddr,
access_flags: MappingFlags,
) -> bool
pub fn handle_page_fault( &mut self, vaddr: GuestPhysAddr, access_flags: MappingFlags, ) -> bool
Handles a page fault at the given address.
access_flags indicates the access type that caused the page fault.
Returns true if the page fault is handled successfully (not a real
fault).
Sourcepub fn translate(&self, vaddr: GuestPhysAddr) -> Option<PhysAddr>
pub fn translate(&self, vaddr: GuestPhysAddr) -> Option<PhysAddr>
Translates the given VirtAddr into PhysAddr.
Returns None if the virtual address is out of range or not mapped.
Sourcepub fn translated_byte_buffer(
&self,
vaddr: GuestPhysAddr,
len: usize,
) -> Option<Vec<&'static mut [u8]>>
pub fn translated_byte_buffer( &self, vaddr: GuestPhysAddr, len: usize, ) -> Option<Vec<&'static mut [u8]>>
Translate&Copy the given VirtAddr with LENGTH len to a mutable u8 Vec through page table.
Returns None if the virtual address is out of range or not mapped.
Sourcepub fn translate_and_get_limit(
&self,
vaddr: GuestPhysAddr,
) -> Option<(PhysAddr, usize)>
pub fn translate_and_get_limit( &self, vaddr: GuestPhysAddr, ) -> Option<(PhysAddr, usize)>
Translates the given VirtAddr into PhysAddr,
and returns the size of the MemoryArea corresponding to the target vaddr.
Returns None if the virtual address is out of range or not mapped.