pub struct PageTable {
root_ppn: PhysPageNum,
frames: Vec<FrameTracker>,
}
Expand description
page table structure
Fields
root_ppn: PhysPageNum
frames: Vec<FrameTracker>
Implementations
sourceimpl PageTable
impl PageTable
Assume that it won’t oom when creating/mapping.
sourcepub fn from_token(satp: usize) -> Self
pub fn from_token(satp: usize) -> Self
Temporarily used to get arguments from user space.
fn find_pte_create(&mut self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>
fn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>
sourcepub fn map(&mut self, vpn: VirtPageNum, ppn: PhysPageNum, flags: PTEFlags)
pub fn map(&mut self, vpn: VirtPageNum, ppn: PhysPageNum, flags: PTEFlags)
set the map between virtual page number and physical page number
sourcepub fn unmap(&mut self, vpn: VirtPageNum)
pub fn unmap(&mut self, vpn: VirtPageNum)
remove the map between virtual page number and physical page number
sourcepub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>
pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>
get the page table entry from the virtual page number
sourcepub fn translate_va(&self, va: VirtAddr) -> Option<PhysAddr>
pub fn translate_va(&self, va: VirtAddr) -> Option<PhysAddr>
get the physical address from the virtual address
Auto Trait Implementations
impl RefUnwindSafe for PageTable
impl Send for PageTable
impl Sync for PageTable
impl Unpin for PageTable
impl UnwindSafe for PageTable
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more