pub struct HhdmPhysMapper;Expand description
PhysMapper implementation for kernels with a higher-half direct map (HHDM).
This type allows you to convert a physical address to a usable pointer in the
kernel’s virtual address space by adding HHDM_BASE to the physical address.
§Safety
- The HHDM mapping must be present and cover the referenced physical range.
- The returned pointer must only be used for valid, mapped, and writable memory.
§Example
use kernel_vmem::{addresses::PhysicalAddress, page_table::pt::PageTable, PhysMapper};
use kernel_alloc::phys_mapper::HhdmPhysMapper;
let phys = PhysicalAddress::new(0x1234_0000);
let mapper = HhdmPhysMapper;
unsafe {
let table: &mut PageTable = mapper.phys_to_mut(phys);
}Trait Implementations§
Source§impl PhysMapper for HhdmPhysMapper
impl PhysMapper for HhdmPhysMapper
Source§unsafe fn phys_to_mut<T>(&self, pa: PhysicalAddress) -> &mut T
unsafe fn phys_to_mut<T>(&self, pa: PhysicalAddress) -> &mut T
Map a 4 KiB physical frame and get a mutable reference to type
T. Read moreAuto Trait Implementations§
impl Freeze for HhdmPhysMapper
impl RefUnwindSafe for HhdmPhysMapper
impl Send for HhdmPhysMapper
impl Sync for HhdmPhysMapper
impl Unpin for HhdmPhysMapper
impl UnwindSafe for HhdmPhysMapper
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
Source§impl<T> PhysMapperExt for Twhere
T: PhysMapper,
impl<T> PhysMapperExt for Twhere
T: PhysMapper,
Source§fn pml4_mut(&self, page: PhysicalPage<Size4K>) -> &mut PageMapLevel4
fn pml4_mut(&self, page: PhysicalPage<Size4K>) -> &mut PageMapLevel4
Borrow the
PageMapLevel4 (PML4) located in the given 4 KiB
physical frame. Read moreSource§fn set_pml4(&self, page: PhysicalPage<Size4K>, pml4: PageMapLevel4)
fn set_pml4(&self, page: PhysicalPage<Size4K>, pml4: PageMapLevel4)
Sets the provided
PageMapLevel4 at the specified page.Source§fn zero_pml4(&self, page: PhysicalPage<Size4K>)
fn zero_pml4(&self, page: PhysicalPage<Size4K>)
Sets the provided
PageMapLevel4 at the specified page.Source§fn pdpt_mut(&self, page: PhysicalPage<Size4K>) -> &mut PageDirectoryPointerTable
fn pdpt_mut(&self, page: PhysicalPage<Size4K>) -> &mut PageDirectoryPointerTable
Borrow a
PageDirectoryPointerTable (PDPT) located in the given 4 KiB
physical frame. Read moreSource§fn set_pdpt(&self, page: PhysicalPage<Size4K>, pml4: PageDirectoryPointerTable)
fn set_pdpt(&self, page: PhysicalPage<Size4K>, pml4: PageDirectoryPointerTable)
Sets the provided
PageDirectoryPointerTable at the specified page.Source§fn zero_pdpt(&self, page: PhysicalPage<Size4K>)
fn zero_pdpt(&self, page: PhysicalPage<Size4K>)
Sets the provided
PageDirectoryPointerTable at the specified page.Source§fn pd_mut(&self, page: PhysicalPage<Size4K>) -> &mut PageDirectory
fn pd_mut(&self, page: PhysicalPage<Size4K>) -> &mut PageDirectory
Borrow a
PageDirectory (PD) located in the given 4 KiB
physical frame. Read moreSource§fn set_pd(&self, page: PhysicalPage<Size4K>, pml4: PageDirectory)
fn set_pd(&self, page: PhysicalPage<Size4K>, pml4: PageDirectory)
Sets the provided
PageDirectory at the specified page.Source§fn zero_pd(&self, page: PhysicalPage<Size4K>)
fn zero_pd(&self, page: PhysicalPage<Size4K>)
Sets the provided
PageDirectory at the specified page.