pub trait Mapper {
type P: PhysicalAddress;
type V: VirtualAddress;
type MapperFlush: MapperFlushable;
type Entry: PTE;
fn map_to(
&mut self,
page: PageWith<Self::V>,
frame: FrameWith<Self::P>,
flags: PageTableFlags,
allocator: &mut impl FrameAllocatorFor<<Self as Mapper>::P>
) -> Result<Self::MapperFlush, MapToError>;
fn unmap(
&mut self,
page: PageWith<Self::V>
) -> Result<(FrameWith<Self::P>, Self::MapperFlush), UnmapError<<Self as Mapper>::P>>;
fn ref_entry(
&mut self,
page: PageWith<Self::V>
) -> Result<&mut Self::Entry, FlagUpdateError>;
fn update_flags(
&mut self,
page: PageWith<Self::V>,
flags: PageTableFlags
) -> Result<Self::MapperFlush, FlagUpdateError> { ... }
fn translate_page(
&mut self,
page: PageWith<Self::V>
) -> Option<FrameWith<Self::P>> { ... }
fn identity_map(
&mut self,
frame: FrameWith<Self::P>,
flags: PageTableFlags,
allocator: &mut impl FrameAllocatorFor<<Self as Mapper>::P>
) -> Result<Self::MapperFlush, MapToError> { ... }
}
Associated Types
type P: PhysicalAddress
type V: VirtualAddress
Required methods
fn map_to(
&mut self,
page: PageWith<Self::V>,
frame: FrameWith<Self::P>,
flags: PageTableFlags,
allocator: &mut impl FrameAllocatorFor<<Self as Mapper>::P>
) -> Result<Self::MapperFlush, MapToError>
fn map_to(
&mut self,
page: PageWith<Self::V>,
frame: FrameWith<Self::P>,
flags: PageTableFlags,
allocator: &mut impl FrameAllocatorFor<<Self as Mapper>::P>
) -> Result<Self::MapperFlush, MapToError>
Creates a new mapping in the page table.
This function might need additional physical frames to create new page tables. These
frames are allocated from the allocator
argument. At most three frames are required.
Removes a mapping from the page table and returns the frame that used to be mapped.
Note that no page tables or pages are deallocated.
Provided methods
fn update_flags(
&mut self,
page: PageWith<Self::V>,
flags: PageTableFlags
) -> Result<Self::MapperFlush, FlagUpdateError>
fn update_flags(
&mut self,
page: PageWith<Self::V>,
flags: PageTableFlags
) -> Result<Self::MapperFlush, FlagUpdateError>
Updates the flags of an existing mapping.
Return the frame that the specified page is mapped to.
fn identity_map(
&mut self,
frame: FrameWith<Self::P>,
flags: PageTableFlags,
allocator: &mut impl FrameAllocatorFor<<Self as Mapper>::P>
) -> Result<Self::MapperFlush, MapToError>
fn identity_map(
&mut self,
frame: FrameWith<Self::P>,
flags: PageTableFlags,
allocator: &mut impl FrameAllocatorFor<<Self as Mapper>::P>
) -> Result<Self::MapperFlush, MapToError>
Maps the given frame to the virtual page with the same address.