pub enum Backend<H: PagingHandler> {
Linear {
pa_va_offset: usize,
},
Alloc {
populate: bool,
_phantom: PhantomData<H>,
},
}Expand description
A unified enum type for different memory mapping backends.
Currently, two backends are implemented:
- Linear: used for linear mappings. The target physical frames are contiguous and their addresses should be known when creating the mapping.
- Allocation: used in general, or for lazy mappings. The target physical frames are obtained from the global allocator.
Variants§
Linear
Linear mapping backend.
The offset between the virtual address and the physical address is
constant, which is specified by pa_va_offset. For example, the virtual
address vaddr is mapped to the physical address vaddr - pa_va_offset.
Alloc
Allocation mapping backend.
If populate is true, all physical frames are allocated when the
mapping is created, and no page faults are triggered during the memory
access. Otherwise, the physical frames are allocated on demand (by
handling page faults).
Fields
§
_phantom: PhantomData<H>A phantom data for the paging handler.
Implementations§
Source§impl<H: PagingHandler> Backend<H>
impl<H: PagingHandler> Backend<H>
Source§impl<H: PagingHandler> Backend<H>
impl<H: PagingHandler> Backend<H>
Sourcepub const fn new_linear(pa_va_offset: usize) -> Self
pub const fn new_linear(pa_va_offset: usize) -> Self
Creates a new linear mapping backend.
Trait Implementations§
Source§impl<H: PagingHandler> Clone for Backend<H>
impl<H: PagingHandler> Clone for Backend<H>
Source§impl<H: PagingHandler> MappingBackend for Backend<H>
impl<H: PagingHandler> MappingBackend for Backend<H>
Source§type Addr = GuestPhysAddr
type Addr = GuestPhysAddr
The address type used in the memory area.
Source§type Flags = MappingFlags
type Flags = MappingFlags
The flags type used in the memory area.
Source§type PageTable = PageTable64<A64HVPagingMetaData, A64PTEHV, H>
type PageTable = PageTable64<A64HVPagingMetaData, A64PTEHV, H>
The page table type used in the memory area.
Source§fn map(
&self,
start: GuestPhysAddr,
size: usize,
flags: MappingFlags,
pt: &mut PageTable64<A64HVPagingMetaData, A64PTEHV, H>,
) -> bool
fn map( &self, start: GuestPhysAddr, size: usize, flags: MappingFlags, pt: &mut PageTable64<A64HVPagingMetaData, A64PTEHV, H>, ) -> bool
What to do when mapping a region within the area with the given flags.
Source§fn unmap(
&self,
start: GuestPhysAddr,
size: usize,
pt: &mut PageTable64<A64HVPagingMetaData, A64PTEHV, H>,
) -> bool
fn unmap( &self, start: GuestPhysAddr, size: usize, pt: &mut PageTable64<A64HVPagingMetaData, A64PTEHV, H>, ) -> bool
What to do when unmaping a memory region within the area.
Source§fn protect(
&self,
start: GuestPhysAddr,
size: usize,
new_flags: MappingFlags,
page_table: &mut PageTable64<A64HVPagingMetaData, A64PTEHV, H>,
) -> bool
fn protect( &self, start: GuestPhysAddr, size: usize, new_flags: MappingFlags, page_table: &mut PageTable64<A64HVPagingMetaData, A64PTEHV, H>, ) -> bool
What to do when changing access flags.
Auto Trait Implementations§
impl<H> Freeze for Backend<H>
impl<H> RefUnwindSafe for Backend<H>where
H: RefUnwindSafe,
impl<H> Send for Backend<H>where
H: Send,
impl<H> Sync for Backend<H>where
H: Sync,
impl<H> Unpin for Backend<H>where
H: Unpin,
impl<H> UnsafeUnpin for Backend<H>
impl<H> UnwindSafe for Backend<H>where
H: UnwindSafe,
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