pub struct AddrSpace { /* private fields */ }
Expand description
The virtual memory address space.
Implementations§
Source§impl AddrSpace
impl AddrSpace
Sourcepub const fn page_table(&self) -> &PageTable
pub const fn page_table(&self) -> &PageTable
Returns the reference to the inner page table.
Sourcepub const fn page_table_root(&self) -> PhysAddr
pub const fn page_table_root(&self) -> PhysAddr
Returns the root physical address of the inner page table.
Sourcepub fn contains_range(&self, start: VirtAddr, size: usize) -> bool
pub fn contains_range(&self, start: VirtAddr, size: usize) -> bool
Checks if the address space contains the given address range.
Sourcepub fn map_linear(
&mut self,
start_vaddr: VirtAddr,
start_paddr: PhysAddr,
size: usize,
flags: MappingFlags,
) -> AxResult
pub fn map_linear( &mut self, start_vaddr: VirtAddr, start_paddr: PhysAddr, size: usize, flags: MappingFlags, ) -> AxResult
Add a new linear mapping.
The mapping is linear, i.e., start_vaddr
is mapped to start_paddr
,
and start_vaddr + size
is mapped to start_paddr + size
.
The flags
parameter indicates the mapping permissions and attributes.
Returns an error if the address range is out of the address space or not aligned.
Sourcepub fn unmap(&mut self, start: VirtAddr, size: usize) -> AxResult
pub fn unmap(&mut self, start: VirtAddr, size: usize) -> AxResult
Removes mappings within the specified virtual address range.
Returns an error if the address range is out of the address space or not aligned.
Sourcepub fn read(&self, start: VirtAddr, buf: &mut [u8]) -> AxResult
pub fn read(&self, start: VirtAddr, buf: &mut [u8]) -> AxResult
To read data from the address space.
§Arguments
start
- The start virtual address to read.buf
- The buffer to store the data.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AddrSpace
impl RefUnwindSafe for AddrSpace
impl Send for AddrSpace
impl Sync for AddrSpace
impl Unpin for AddrSpace
impl UnwindSafe for AddrSpace
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