Struct axmem::AddrSpaceInner

source ·
pub struct AddrSpaceInner { /* private fields */ }
Expand description

mutable inner objects of address space

Implementations§

source§

impl AddrSpaceInner

source

pub fn add_region( &mut self, vaddr: VirtAddr, paddr: PhysAddr, phy_page: Arc<GlobalPage>, flags: MappingFlags, huge_page: bool ) -> AxResult<()>

create a segment region

source

pub fn add_region_shadow( &mut self, vaddr: VirtAddr, paddr: PhysAddr, size: usize, flags: MappingFlags, huge_page: bool ) -> AxResult<()>

create a segment region without memory allocation

source

pub fn remove_region(&mut self, vaddr: VirtAddr) -> AxResult<()>

remove a segment

source

pub fn page_table_addr(&self) -> PhysAddr

get root address of pagetable

source

pub fn sbrk(&mut self, size: isize) -> Option<usize>

modify heap size

source

pub fn mmap_page( &mut self, _addr: Option<VirtAddr>, len: usize, flags: MappingFlags ) -> AxResult<VirtAddr>

a simple mmap-like page allocator, except that memory is alloced in pages @param addr: desired memory position @param len: desired pages @returns: starting addr of the maped pages

source

pub fn munmap_page(&mut self, addr: VirtAddr, len: usize) -> AxResult<()>

unmap a page obtained from mmap

source

pub fn translate_buffer( &self, vaddr: VirtAddr, size: usize, _write: bool ) -> AxResult<Vec<&'static mut [u8]>>

translate a slice to slices in kernel

source

pub fn query(&self, vaddr: VirtAddr) -> Option<PhysAddr>

find a mapping of the virtual address

Trait Implementations§

source§

impl Default for AddrSpaceInner

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.