pub struct MemorySet {
page_table: PageTable,
areas: Vec<MapArea>,
}
Expand description
memory set structure, controls virtual-memory space
Fields§
§page_table: PageTable
§areas: Vec<MapArea>
Implementations§
source§impl MemorySet
impl MemorySet
sourcepub fn insert_framed_area(
&mut self,
start_va: VirtAddr,
end_va: VirtAddr,
permission: MapPermission
)
pub fn insert_framed_area( &mut self, start_va: VirtAddr, end_va: VirtAddr, permission: MapPermission )
Assume that no conflicts.
sourcepub fn remove_area_with_start_vpn(&mut self, start_vpn: VirtPageNum)
pub fn remove_area_with_start_vpn(&mut self, start_vpn: VirtPageNum)
Remove MapArea
that starts with start_vpn
fn push(&mut self, map_area: MapArea, data: Option<&[u8]>)
sourcefn map_trampoline(&mut self)
fn map_trampoline(&mut self)
Mention that trampoline is not collected by areas.
sourcepub fn new_kernel() -> Self
pub fn new_kernel() -> Self
Without kernel stacks.
sourcepub fn from_elf(elf_data: &[u8]) -> (Self, usize, usize)
pub fn from_elf(elf_data: &[u8]) -> (Self, usize, usize)
Include sections in elf and trampoline and TrapContext and user stack, also returns user_sp and entry point.
sourcepub fn from_existed_user(user_space: &Self) -> Self
pub fn from_existed_user(user_space: &Self) -> Self
Clone a same MemorySet
sourcepub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>
pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>
Translate throuth pagetable
sourcepub fn recycle_data_pages(&mut self)
pub fn recycle_data_pages(&mut self)
Remove all MapArea
Auto Trait Implementations§
impl RefUnwindSafe for MemorySet
impl Send for MemorySet
impl Sync for MemorySet
impl Unpin for MemorySet
impl UnwindSafe for MemorySet
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