Skip to main content

AddressSpace

Struct AddressSpace 

Source
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>

Source

pub fn new() -> Self

创建新地址空间。

Source

pub fn root_ppn(&self) -> PPN<Meta>

地址空间根页表的物理页号。

Source

pub fn root(&self) -> PageTable<Meta>

地址空间根页表

Source

pub fn map_extern( &mut self, range: Range<VPN<Meta>>, pbase: PPN<Meta>, flags: VmFlags<Meta>, )

向地址空间增加映射关系。

Source

pub fn map( &mut self, range: Range<VPN<Meta>>, data: &[u8], offset: usize, flags: VmFlags<Meta>, )

分配新的物理页,拷贝数据并建立映射。

Source

pub fn unmap(&mut self, range: Range<VPN<Meta>>)

取消指定 VPN 范围的映射

Source

pub fn translate<T>( &self, addr: VAddr<Meta>, flags: VmFlags<Meta>, ) -> Option<NonNull<T>>

检查 flags 的属性要求,然后将地址空间中的一个虚地址翻译成当前地址空间中的指针。

Source

pub fn cloneself(&self, new_addrspace: &mut AddressSpace<Meta, M>)

遍历地址空间,将其中的地址映射添加进自己的地址空间中,重新分配物理页并拷贝所有数据及代码

Trait Implementations§

Source§

impl<Meta: VmMeta, P: PageManager<Meta>> Debug for AddressSpace<Meta, P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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>
where M: Send, Meta: Send,

§

impl<Meta, M> Sync for AddressSpace<Meta, M>
where M: Sync, Meta: Sync,

§

impl<Meta, M> Unpin for AddressSpace<Meta, M>
where M: Unpin, Meta: Unpin,

§

impl<Meta, M> UnwindSafe for AddressSpace<Meta, M>
where M: UnwindSafe, Meta: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.