pub trait PageTable<TableSize>: Sized + Debugwhere
TableSize: FrameSize,{
// Required methods
fn new_with_kernel_mapped<A>(
kernel_page_table: &Self,
allocator: &A,
) -> Self
where A: FrameAllocator<TableSize>;
unsafe fn switch_to(&self);
fn translate(&self, address: VAddr) -> Option<PAddr>;
fn map<S, A>(
&mut self,
page: Page<S>,
frame: Frame<S>,
flags: Flags,
allocator: &A,
) -> Result<(), PagingError>
where S: FrameSize,
A: FrameAllocator<TableSize>;
fn map_area<A>(
&mut self,
virtual_start: VAddr,
physical_start: PAddr,
size: usize,
flags: Flags,
allocator: &A,
) -> Result<(), PagingError>
where A: FrameAllocator<TableSize>;
fn unmap<S>(&mut self, page: Page<S>) -> Option<Frame<S>>
where S: FrameSize;
// Provided method
fn map_range<S, A>(
&mut self,
pages: Range<Page<S>>,
frames: Range<Frame<S>>,
flags: Flags,
allocator: &A,
) -> Result<(), PagingError>
where S: FrameSize,
A: FrameAllocator<TableSize> { ... }
}
Expand description
A PageTable
allows the manipulation of a set of page-tables.
Required Methods§
Sourcefn new_with_kernel_mapped<A>(kernel_page_table: &Self, allocator: &A) -> Selfwhere
A: FrameAllocator<TableSize>,
fn new_with_kernel_mapped<A>(kernel_page_table: &Self, allocator: &A) -> Selfwhere
A: FrameAllocator<TableSize>,
Constructs a new set of page tables, but with the kernel mapped into it. This is generally useful for constructing page tables for userspace.
Sourcefn translate(&self, address: VAddr) -> Option<PAddr>
fn translate(&self, address: VAddr) -> Option<PAddr>
Get the physical address that a given virtual address is mapped to, if it’s mapped. Returns None
if the
address is not mapped into physical memory.
Sourcefn map<S, A>(
&mut self,
page: Page<S>,
frame: Frame<S>,
flags: Flags,
allocator: &A,
) -> Result<(), PagingError>where
S: FrameSize,
A: FrameAllocator<TableSize>,
fn map<S, A>(
&mut self,
page: Page<S>,
frame: Frame<S>,
flags: Flags,
allocator: &A,
) -> Result<(), PagingError>where
S: FrameSize,
A: FrameAllocator<TableSize>,
Map a Page
to a Frame
with the given flags.
Sourcefn map_area<A>(
&mut self,
virtual_start: VAddr,
physical_start: PAddr,
size: usize,
flags: Flags,
allocator: &A,
) -> Result<(), PagingError>where
A: FrameAllocator<TableSize>,
fn map_area<A>(
&mut self,
virtual_start: VAddr,
physical_start: PAddr,
size: usize,
flags: Flags,
allocator: &A,
) -> Result<(), PagingError>where
A: FrameAllocator<TableSize>,
Map an area of size
bytes starting at the given address pair with the given flags. Implementations are
free to map this area however they desire, and may do so with a range of page sizes.
fn unmap<S>(&mut self, page: Page<S>) -> Option<Frame<S>>where
S: FrameSize,
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.