Skip to main content

HwCaps

Struct HwCaps 

Source
pub struct HwCaps {
Show 35 fields pub allowed: bool, pub feature_control_locked: bool, pub control_block_revision: u32, pub control_block_size: u16, pub control_block_memory_type: u8, pub has_true_controls: bool, pub ept: bool, pub ept_four_levels: bool, pub ept_2mb: bool, pub ept_1gb: bool, pub ept_wb: bool, pub ept_ad: bool, pub invept: bool, pub vpid: bool, pub invvpid_single_context: bool, pub invvpid_all_context: bool, pub invvpid_individual_address: bool, pub unrestricted_guest: bool, pub apic_register_virt: bool, pub virtual_interrupt_delivery: bool, pub posted_interrupts: bool, pub pause_loop_exiting: bool, pub virtualize_x2apic: bool, pub preemption_timer: bool, pub virtual_nmis: bool, pub rdseed: bool, pub pin_allowed: AllowedControls, pub primary_proc_allowed: AllowedControls, pub secondary_proc_allowed: AllowedControls, pub exit_allowed: AllowedControls, pub entry_allowed: AllowedControls, pub cr0_fixed0: u64, pub cr0_fixed1: u64, pub cr4_fixed0: u64, pub cr4_fixed1: u64,
}
Expand description

Set of decoded capabilities, used by the s9vm engine.

Fields§

§allowed: bool

The firmware allows enabling (bit 2 of IA32_FEATURE_CONTROL).

§feature_control_locked: bool

MSR IA32_FEATURE_CONTROL locked (if it is not, it can be written once to allow enabling).

§control_block_revision: u32

Control block revision identifier (bits 30:0 of MSR_BASIC).

§control_block_size: u16

Size of the control block region in bytes (bits 44:32).

§control_block_memory_type: u8

Recommended memory type for the region (bits 53:50; 6 = WB).

§has_true_controls: bool

The “TRUE_*” bits are available.

§ept: bool

EPT available (allowed on the secondary controls side).

§ept_four_levels: bool

EPT with 4 walk levels.

§ept_2mb: bool

EPT 2 MiB.

§ept_1gb: bool

EPT 1 GiB.

§ept_wb: bool

EPT in write-back.

§ept_ad: bool

EPT with A/D bits.

§invept: bool

invept available.

§vpid: bool

VPID available.

§invvpid_single_context: bool

invvpid variants available.

§invvpid_all_context: bool§invvpid_individual_address: bool§unrestricted_guest: bool

Unrestricted guest (16 bits without VM86).

§apic_register_virt: bool

Virtual APIC (register + delivery).

§virtual_interrupt_delivery: bool§posted_interrupts: bool

Posted interrupts.

§pause_loop_exiting: bool

Exit on pause loop (PLE).

§virtualize_x2apic: bool

Virtualized x2APIC.

§preemption_timer: bool

Preemption timer.

§virtual_nmis: bool

Virtual NMIs.

§rdseed: bool

rdseed allowed in the guest.

§pin_allowed: AllowedControls

“Allowed” values (low / high 32 bits) of the control MSRs, after selecting the TRUE_* MSRs when they exist.

§primary_proc_allowed: AllowedControls§secondary_proc_allowed: AllowedControls§exit_allowed: AllowedControls§entry_allowed: AllowedControls§cr0_fixed0: u64

Fixed CR0/CR4 masks.

§cr0_fixed1: u64§cr4_fixed0: u64§cr4_fixed1: u64

Implementations§

Source§

impl HwCaps

Source

pub fn from_snapshot(snapshot: &MsrSnapshot, cpuid_vmx: bool) -> Self

Decodes an MSR snapshot. cpuid_vmx is the result of CPUID.1:ECX[5]; it is passed separately to keep this module pure.

Source

pub const fn can_run(&self) -> bool

True if the platform can host the s9vm engine with EPT and VPID.

Source

pub fn summary(&self) -> String

Readable summary (one line) for boot logs.

Source§

impl HwCaps

Source

pub fn validate(&self) -> Result<(), CapsError>

Checks the enabling conditions and returns an explicit error.

Trait Implementations§

Source§

impl Clone for HwCaps

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for HwCaps

Source§

impl Debug for HwCaps

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HwCaps

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for HwCaps

Source§

impl PartialEq for HwCaps

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HwCaps

Auto Trait Implementations§

§

impl Forget for HwCaps

§

impl Freeze for HwCaps

§

impl Move for HwCaps

§

impl RefUnwindSafe for HwCaps

§

impl Send for HwCaps

§

impl Sync for HwCaps

§

impl Unpin for HwCaps

§

impl UnsafeUnpin for HwCaps

§

impl UnwindSafe for HwCaps

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.