hal::memory

Trait 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.

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.

Implementors§