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) -> Self
pub fn with<T>(self, field: Pack64<T, Self>, value: T) -> Self
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 Self
pub fn set<T>(&mut self, field: Pack64<T, Self>, value: T) -> &mut Self
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>) -> T
pub fn get<T>(self, field: Pack64<T, Self>) -> T
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>
pub fn try_get<T>(self, field: Pack64<T, Self>) -> Result<T, T::Error>
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.