Struct hal_x86_64::control_regs::Cr4
source · pub struct Cr4(/* private fields */);
Expand description
Control Register 4
Implementations§
source§impl Cr4
impl Cr4
sourcepub const VIRTUAL_8086_MODE_EXTENSIONS: Pack64<bool, Self> = _
pub const VIRTUAL_8086_MODE_EXTENSIONS: Pack64<bool, Self> = _
Virtual 8086 Mode Extensions (VME
).
sourcepub const PROTECTED_MODE_VIRTUAL_INTERRUPTS: Pack64<bool, Self> = _
pub const PROTECTED_MODE_VIRTUAL_INTERRUPTS: Pack64<bool, Self> = _
Protected-Mode Virtual Interrupts (PVI
).
sourcepub const TIME_STAMP_DISABLE: Pack64<bool, Self> = _
pub const TIME_STAMP_DISABLE: Pack64<bool, Self> = _
Time Stamp Disable (TSD
).
sourcepub const DEBUGGING_EXTENSIONS: Pack64<bool, Self> = _
pub const DEBUGGING_EXTENSIONS: Pack64<bool, Self> = _
Debugging Extensions (DE
).
sourcepub const PAGE_SIZE_EXTENSION: Pack64<bool, Self> = _
pub const PAGE_SIZE_EXTENSION: Pack64<bool, Self> = _
Page Size Extension (PSE
).
This enables the use of 4MB physical pages; always ignored in long mode.
sourcepub const PHYSICAL_ADDRESS_EXTENSION: Pack64<bool, Self> = _
pub const PHYSICAL_ADDRESS_EXTENSION: Pack64<bool, Self> = _
Physical Address Extension (PAE
).
Enables the use of 2MB physical pages. Required in long mode.
sourcepub const MACHINE_CHECK_EXCEPTION: Pack64<bool, Self> = _
pub const MACHINE_CHECK_EXCEPTION: Pack64<bool, Self> = _
Machine Check Exception Enable (MCE
).
sourcepub const PAGE_GLOBAL_ENABLE: Pack64<bool, Self> = _
pub const PAGE_GLOBAL_ENABLE: Pack64<bool, Self> = _
Page Global Enable (PGE
).
Allows marking pages as global.
sourcepub const PERFORMANCE_MONITOR_COUNTER: Pack64<bool, Self> = _
pub const PERFORMANCE_MONITOR_COUNTER: Pack64<bool, Self> = _
Performance-Monitoring Counter Enable (PCE
).
Allows the
sourcepub const OSFXSR: Pack64<bool, Self> = _
pub const OSFXSR: Pack64<bool, Self> = _
Operating System FXSAVE
/FXRSTOR
Support
If enabled, the FXSAVE
and FXRSTOR
instructions are
available in both 64-bit and compatibility mode.
sourcepub const OSXMMEXCPT: Pack64<bool, Self> = _
pub const OSXMMEXCPT: Pack64<bool, Self> = _
Operating System Support for Unmasked Floating-Point Exceptions
sourcepub const USER_MODE_INSTRUCTION_PREVENTION: Pack64<bool, Self> = _
pub const USER_MODE_INSTRUCTION_PREVENTION: Pack64<bool, Self> = _
User-Mode Instruction Prevention (UMIP
).
If set, SGDT
, SIDT
, SLDT
, SMSW
, and STR
, instructions
will result in a general protection fault (#GP
) when in ring >
0.
sourcepub const VIRTUAL_MACHINE_EXTENSIONS: Pack64<bool, Self> = _
pub const VIRTUAL_MACHINE_EXTENSIONS: Pack64<bool, Self> = _
Virtual Machine Extensions (VMX) Enable
Note: this extension is INTEL ONLY.
sourcepub const SAFER_MODE_EXTENSIONS: Pack64<bool, Self> = _
pub const SAFER_MODE_EXTENSIONS: Pack64<bool, Self> = _
Safer Mode Extensions (SMX) Enable
Note: this extension is INTEL ONLY.
sourcepub const FSGSBASE: Pack64<bool, Self> = _
pub const FSGSBASE: Pack64<bool, Self> = _
FSBASE/GSBASE Enable.
Enables the instructions RDFSBASE
,RDGSBASE
, WRFSBASE
, and WRGSBASE
.
sourcepub const PCID_ENABLE: Pack64<bool, Self> = _
pub const PCID_ENABLE: Pack64<bool, Self> = _
PCID Enable (PCIDE
).
sourcepub const OSXSAVE: Pack64<bool, Self> = _
pub const OSXSAVE: Pack64<bool, Self> = _
OS Support for XSAVE
and Processor Extended States Enable
sourcepub const SUPERVISOR_EXECUTION_PROTECTION: Pack64<bool, Self> = _
pub const SUPERVISOR_EXECUTION_PROTECTION: Pack64<bool, Self> = _
Supervisor Mode Execution Protection Enable (SMEP
).
sourcepub const SUPERVISOR_ACCESS_PREVENTION: Pack64<bool, Self> = _
pub const SUPERVISOR_ACCESS_PREVENTION: Pack64<bool, Self> = _
Supervisor Mode Access Prevention Enable (`SMAP)
sourcepub const PROTECTION_KEY_USER: Pack64<bool, Self> = _
pub const PROTECTION_KEY_USER: Pack64<bool, Self> = _
Protection Key (Used) Enable (PKE
).
Enables protection keys for user-mode pages.
sourcepub const CONTROL_FLOW_ENFORCEMENT: Pack64<bool, Self> = _
pub const CONTROL_FLOW_ENFORCEMENT: Pack64<bool, Self> = _
Control-flow Enforcement Technology Enable (CET
).
sourcepub const PROTECTION_KEY_SUPERVISOR: Pack64<bool, Self> = _
pub const PROTECTION_KEY_SUPERVISOR: Pack64<bool, Self> = _
Protection Key (Supervisor) Enable (PKS
).
Enables protection keys for user-mode pages.
sourcepub const fn from_bits(bits: u64) -> Self
pub const fn from_bits(bits: u64) -> Self
Constructs a new instance of Self
from the provided raw bits.
sourcepub fn with<T>(self, field: Pack64<T, Self>, value: T) -> Selfwhere
T: FromBits<u64>,
pub fn with<T>(self, field: Pack64<T, Self>, value: T) -> Selfwhere
T: FromBits<u64>,
Packs the bit representation of value
into self
at the bit
range designated by field
, returning a new bitfield.
sourcepub fn set<T>(&mut self, field: Pack64<T, Self>, value: T) -> &mut Selfwhere
T: FromBits<u64>,
pub fn set<T>(&mut self, field: Pack64<T, Self>, value: T) -> &mut Selfwhere
T: FromBits<u64>,
Packs the bit representation of value
into self
at the range
designated by field
, mutating self
in place.
sourcepub fn get<T>(self, field: Pack64<T, Self>) -> Twhere
T: FromBits<u64>,
pub fn get<T>(self, field: Pack64<T, Self>) -> Twhere
T: FromBits<u64>,
Unpacks the bit range represented by field
from self
, and
converts it into a T
-typed value.
Panics
This method panics if self
does not contain a valid bit
pattern for a T
-typed value, as determined by T
’s
FromBits::try_from_bits
implementation.
sourcepub fn try_get<T>(self, field: Pack64<T, Self>) -> Result<T, T::Error>where
T: FromBits<u64>,
pub fn try_get<T>(self, field: Pack64<T, Self>) -> Result<T, T::Error>where
T: FromBits<u64>,
Unpacks the bit range represented by field
from self
and attempts to convert it into a T
-typed value.
Returns
Ok(T)
if aT
-typed value could be constructed from the bits insrc
Err(T::Error)
ifsrc
does not contain a valid bit pattern for aT
-typed value, as determined byT
’s [FromBits::try_from_bits
implementation.
sourcepub fn assert_valid()
pub fn assert_valid()
Asserts that all the packing specs for this type are valid.
This is intended to be used in unit tests.
sourcepub fn display_ascii(&self) -> impl Display
pub fn display_ascii(&self) -> impl Display
Returns a value that formats this bitfield in a multi-line format, using only ASCII characters.
This is equivalent to formatting this bitfield using a {}
display specifier, but will never use Unicode box-drawing
characters, even when an upstream formatter uses the {:#}
fmt::Display
specifier. This is intended for use on platforms
where Unicode box drawing characters are never available.
sourcepub fn display_unicode(&self) -> impl Display
pub fn display_unicode(&self) -> impl Display
Returns a value that formats this bitfield in a multi-line format, always using Unicode box-drawing characters.
This is equivalent to formatting this bitfield using a {:#}
format specifier, but will always use Unicode box-drawing
characters, even when an upstream formatter uses the {}
fmt::Display
specifier.