Struct os::mm::page_table::PageTable
source · pub struct PageTable {
root_ppn: PhysPageNum,
frames: Vec<FrameTracker>,
}
Expand description
page table structure
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 PageTableEntry by VirtPageNum, create a frame for a 4KB page table if not exist
sourcefn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>
fn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>
Find PageTableEntry by VirtPageNum
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 Freeze for PageTable
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