Trait kcore::vm::PageTable [−][src]
pub trait PageTable: Sized { const USERTOP: usize; const PAGE_LAYOUT: Layout; const PAGE_SIZE: usize; fn new() -> Result<Self>; fn switch(&self); fn map(&mut self, va: usize, vpa: usize) -> Result<()>; fn unmap(&mut self, va: usize) -> bool; fn protect(&mut self, va: usize, read_only: bool); }
Expand description
Page table.
Associated Constants
Required methods
fn new() -> Result<Self>
[src]
fn new() -> Result<Self>
[src]Create a new page table.
fn switch(&self)
[src]
fn switch(&self)
[src]Switch to this page table.
SAFETY: All pages mapped before switching should be accessiable after that.
That means the implementation can batch the map and unmap requests.
fn map(&mut self, va: usize, vpa: usize) -> Result<()>
[src]
fn map(&mut self, va: usize, vpa: usize) -> Result<()>
[src]Map virtual address [va, va+PAGE_SIZE)
to physical page at vpa
with write permission.
It’s guaranteed that va
is page-aligned. Overwrite the old mapping if exists.
The implementation is required to be atomic, i.e., undo the mapping if failed.