pub struct AddressSpace<Meta: VmMeta, M: PageManager<Meta>> {
pub areas: Vec<Range<VPN<Meta>>>,
/* private fields */
}Expand description
地址空间。
Fields§
§areas: Vec<Range<VPN<Meta>>>虚拟地址块
Implementations§
Source§impl<Meta: VmMeta, M: PageManager<Meta>> AddressSpace<Meta, M>
impl<Meta: VmMeta, M: PageManager<Meta>> AddressSpace<Meta, M>
Sourcepub fn map_extern(
&mut self,
range: Range<VPN<Meta>>,
pbase: PPN<Meta>,
flags: VmFlags<Meta>,
)
pub fn map_extern( &mut self, range: Range<VPN<Meta>>, pbase: PPN<Meta>, flags: VmFlags<Meta>, )
向地址空间增加映射关系。
Sourcepub fn map(
&mut self,
range: Range<VPN<Meta>>,
data: &[u8],
offset: usize,
flags: VmFlags<Meta>,
)
pub fn map( &mut self, range: Range<VPN<Meta>>, data: &[u8], offset: usize, flags: VmFlags<Meta>, )
分配新的物理页,拷贝数据并建立映射。
Sourcepub fn translate<T>(
&self,
addr: VAddr<Meta>,
flags: VmFlags<Meta>,
) -> Option<NonNull<T>>
pub fn translate<T>( &self, addr: VAddr<Meta>, flags: VmFlags<Meta>, ) -> Option<NonNull<T>>
检查 flags 的属性要求,然后将地址空间中的一个虚地址翻译成当前地址空间中的指针。
Sourcepub fn cloneself(&self, new_addrspace: &mut AddressSpace<Meta, M>)
pub fn cloneself(&self, new_addrspace: &mut AddressSpace<Meta, M>)
遍历地址空间,将其中的地址映射添加进自己的地址空间中,重新分配物理页并拷贝所有数据及代码
Trait Implementations§
Auto Trait Implementations§
impl<Meta, M> Freeze for AddressSpace<Meta, M>where
M: Freeze,
impl<Meta, M> RefUnwindSafe for AddressSpace<Meta, M>where
M: RefUnwindSafe,
Meta: RefUnwindSafe,
impl<Meta, M> Send for AddressSpace<Meta, M>
impl<Meta, M> Sync for AddressSpace<Meta, M>
impl<Meta, M> Unpin for AddressSpace<Meta, M>
impl<Meta, M> UnwindSafe for AddressSpace<Meta, M>where
M: UnwindSafe,
Meta: UnwindSafe,
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