Skip to main content

SecondLevelMemory

Struct SecondLevelMemory 

Source
pub struct SecondLevelMemory {
    pub tables: HhdmTables,
    pub root: SecondLevel,
}
Expand description

Pre-allocated resources for second-level translation.

Fields§

§tables: HhdmTables§root: SecondLevel

Implementations§

Source§

impl SecondLevelMemory

Source

pub fn new() -> Result<Self, VcpuError>

Creates an empty translation in the format of the active backend: Intel EPT, or AMD nested page tables.

Source

pub fn new_npt() -> Result<Self, VcpuError>

Creates an empty AMD nested page table (NPT) translation.

Source

pub fn destroy(self)

Frees all translation tables.

Source

pub fn translate(&self, gpa: u64) -> Option<u64>

Translates a guest physical address, if it is mapped.

Source

pub fn unmap_4k(&mut self, gpa: u64) -> bool

Removes a 4 KiB mapping.

Source

pub fn map_4k( &mut self, gpa: u64, hpa: u64, perms: Perms, ) -> Result<(), VcpuError>

Maps a 4 KiB page.

Source

pub fn map_2m( &mut self, gpa: u64, hpa: u64, perms: Perms, ) -> Result<(), VcpuError>

Maps a 2 MiB region.

Source

pub fn nested_cr3(&self) -> u64

Value of nCR3 for an AMD VMCB (the root’s physical address).

Source

pub fn pointer(&self, caps: &HwCaps) -> u64

Value of the translation pointer, ready for the control block.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.