pub struct PageTable {
root_ppn: PhysPageNum,
frames: Vec<FrameTracker>,
}
Expand description
Record root ppn and has the same lifetime as 1 and 2 level PageTableEntry
Fields§
§root_ppn: PhysPageNum
§frames: Vec<FrameTracker>
Implementations§
source§impl 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.
sourcefn find_pte_create(&mut self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>
fn find_pte_create(&mut self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>
Find phsical address by virtual address, create a frame if not exist
sourcefn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>
fn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>
Find phsical address by virtual address
sourcepub fn map(&mut self, vpn: VirtPageNum, ppn: PhysPageNum, flags: PTEFlags)
pub fn map(&mut self, vpn: VirtPageNum, ppn: PhysPageNum, flags: PTEFlags)
Create a mapping form vpn
to ppn
sourcepub fn unmap(&mut self, vpn: VirtPageNum)
pub fn unmap(&mut self, vpn: VirtPageNum)
Delete a mapping form vpn
sourcepub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>
pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>
Translate VirtPageNum
to PageTableEntry
sourcepub fn translate_va(&self, va: VirtAddr) -> Option<PhysAddr>
pub fn translate_va(&self, va: VirtAddr) -> Option<PhysAddr>
Translate VirtAddr
to PhysAddr
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more