pub struct VirtualAddressSpace<P: PhysicalMemoryProvider> {
physical: P,
page_table_root: u64,
mode: TranslationMode,
pagefiles: Vec<Box<dyn PagefileSource>>,
prototype_source: Option<Box<dyn PrototypePteSource>>,
}Expand description
A virtual address space backed by physical memory and page tables.
Fields§
§physical: P§page_table_root: u64§mode: TranslationMode§pagefiles: Vec<Box<dyn PagefileSource>>§prototype_source: Option<Box<dyn PrototypePteSource>>Implementations§
Source§impl<P: PhysicalMemoryProvider> VirtualAddressSpace<P>
impl<P: PhysicalMemoryProvider> VirtualAddressSpace<P>
Sourcepub fn new(physical: P, page_table_root: u64, mode: TranslationMode) -> Self
pub fn new(physical: P, page_table_root: u64, mode: TranslationMode) -> Self
Create a new virtual address space.
Sourcepub fn with_pagefile(self, source: Box<dyn PagefileSource>) -> Self
pub fn with_pagefile(self, source: Box<dyn PagefileSource>) -> Self
Attach a pagefile source for resolving paged-out memory.
Sourcepub fn with_prototype_source(self, source: Box<dyn PrototypePteSource>) -> Self
pub fn with_prototype_source(self, source: Box<dyn PrototypePteSource>) -> Self
Attach a prototype PTE source for resolving shared section pages.
Sourcepub fn virt_to_phys(&self, vaddr: u64) -> Result<u64>
pub fn virt_to_phys(&self, vaddr: u64) -> Result<u64>
Translate a virtual address to a physical address.
Sourcepub fn read_virt(&self, vaddr: u64, buf: &mut [u8]) -> Result<()>
pub fn read_virt(&self, vaddr: u64, buf: &mut [u8]) -> Result<()>
Read buf.len() bytes from virtual address vaddr, handling page boundary crossings.
Uses walk_x86_64_4level_internal() to resolve each 4K chunk, transparently
handling physical, transition, demand-zero, and pagefile pages.
fn read_pagefile_page( &self, vaddr: u64, pagefile_num: u8, page_offset: u64, ) -> Result<[u8; 4096]>
Sourcepub fn mode(&self) -> TranslationMode
pub fn mode(&self) -> TranslationMode
Return the translation mode.
fn read_pte(&self, addr: u64) -> Result<u64>
fn walk_x86_64_4level(&self, vaddr: u64) -> Result<u64>
fn walk_x86_64_4level_internal(&self, vaddr: u64) -> Result<TranslationResult>
fn decode_non_present_pte(pte: u64, page_offset: u64) -> TranslationResult
Auto Trait Implementations§
impl<P> Freeze for VirtualAddressSpace<P>where
P: Freeze,
impl<P> !RefUnwindSafe for VirtualAddressSpace<P>
impl<P> Send for VirtualAddressSpace<P>
impl<P> Sync for VirtualAddressSpace<P>
impl<P> Unpin for VirtualAddressSpace<P>where
P: Unpin,
impl<P> UnsafeUnpin for VirtualAddressSpace<P>where
P: UnsafeUnpin,
impl<P> !UnwindSafe for VirtualAddressSpace<P>
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