pub struct SecondLevelMemory {
pub tables: HhdmTables,
pub root: SecondLevel,
}Expand description
Pre-allocated resources for second-level translation.
Fields§
§tables: HhdmTables§root: SecondLevelImplementations§
Source§impl SecondLevelMemory
impl SecondLevelMemory
Sourcepub fn new() -> Result<Self, VcpuError>
pub fn new() -> Result<Self, VcpuError>
Creates an empty translation in the format of the active backend: Intel EPT, or AMD nested page tables.
Sourcepub fn new_npt() -> Result<Self, VcpuError>
pub fn new_npt() -> Result<Self, VcpuError>
Creates an empty AMD nested page table (NPT) translation.
Sourcepub fn translate(&self, gpa: u64) -> Option<u64>
pub fn translate(&self, gpa: u64) -> Option<u64>
Translates a guest physical address, if it is mapped.
Sourcepub fn map_4k(
&mut self,
gpa: u64,
hpa: u64,
perms: Perms,
) -> Result<(), VcpuError>
pub fn map_4k( &mut self, gpa: u64, hpa: u64, perms: Perms, ) -> Result<(), VcpuError>
Maps a 4 KiB page.
Sourcepub fn map_2m(
&mut self,
gpa: u64,
hpa: u64,
perms: Perms,
) -> Result<(), VcpuError>
pub fn map_2m( &mut self, gpa: u64, hpa: u64, perms: Perms, ) -> Result<(), VcpuError>
Maps a 2 MiB region.
Sourcepub fn nested_cr3(&self) -> u64
pub fn nested_cr3(&self) -> u64
Value of nCR3 for an AMD VMCB (the root’s physical address).
Auto Trait Implementations§
impl Forget for SecondLevelMemory
impl Freeze for SecondLevelMemory
impl Move for SecondLevelMemory
impl RefUnwindSafe for SecondLevelMemory
impl Send for SecondLevelMemory
impl Sync for SecondLevelMemory
impl Unpin for SecondLevelMemory
impl UnsafeUnpin for SecondLevelMemory
impl UnwindSafe for SecondLevelMemory
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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