Trait hal::memory::PageTable

source ·
pub trait PageTable<TableSize>: Sized + Debug
where 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§

source

fn new_with_kernel_mapped<A>(kernel_page_table: &Self, allocator: &A) -> Self
where 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.

source

unsafe fn switch_to(&self)

Install these page tables as the current set.

source

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.

source

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.

source

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.

source

fn unmap<S>(&mut self, page: Page<S>) -> Option<Frame<S>>
where S: FrameSize,

Provided Methods§

source

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>,

Map each Page in a range to a corresponding Frame with the given flags.

Object Safety§

This trait is not object safe.

Implementors§