Skip to main content

Vmm

Struct Vmm 

Source
pub struct Vmm {
    pub plm4_ptr: *mut PageTable,
    pub hhdm_offset: u64,
}
Expand description

Kernel page-table state used by all VMM operations.

Fields§

§plm4_ptr: *mut PageTable

Virtual address of the active PML4 (the table installed in CR3).

§hhdm_offset: u64

Higher-Half Direct Map offset: add to any physical address to get its virtual address.

Implementations§

Source§

impl Vmm

Source

pub fn init(pmm: &Pmm, hhdm_offset: u64) -> Self

Initialize the VMM and install a kernel-owned PML4 into CR3.

§Panics

Panics if the PMM cannot allocate the PML4 frame (out of memory).

Source

pub unsafe fn map_page( &self, pmm: &Pmm, virt: VirtAddr, phys: PhysAddr, flags: PageTableFlags, )

Map one 4 KiB virtual page to a physical frame. PRESENT is forced on regardless of flags.

§Safety

The caller must ensure virt is a valid kernel virtual address and phys is a valid, PMM-allocated frame.

§Panics

Panics if the PMM runs out of frames when allocating an intermediate page table.

Source

pub unsafe fn unmap_page(&self, virt: VirtAddr)

Unmap one 4 KiB virtual page and flush its TLB entry.

§Safety

The caller must ensure virt was previously mapped and that no live code or data references the page after this call returns.

§Panics

Panics if any level of the walk is not present (page was never mapped).

Trait Implementations§

Source§

impl Send for Vmm

Source§

impl Sync for Vmm

Auto Trait Implementations§

§

impl Freeze for Vmm

§

impl RefUnwindSafe for Vmm

§

impl Unpin for Vmm

§

impl UnsafeUnpin for Vmm

§

impl UnwindSafe for Vmm

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.