pub struct Cr0(/* private fields */);
Expand description
Control Register 0
Implementations§
Source§impl Cr0
impl Cr0
Sourcepub const PROTECTED_MODE_ENABLE: Pack64<bool, Self>
pub const PROTECTED_MODE_ENABLE: Pack64<bool, Self>
Protected Mode Enable (PE
)
Enables protected mode.
Sourcepub const MONITOR_COPROCESSOR: Pack64<bool, Self>
pub const MONITOR_COPROCESSOR: Pack64<bool, Self>
Monitor Coprocessor (MP
).
Enables monitoring of the coprocessor, typically for x87 instructions.
Controls (together with the [TASK_SWITCHED
] flag) whether a WAIT
or FWAIT
instruction should cause an #NE
exception.
Sourcepub const EMULATE_COPROCESSOR: Pack64<bool, Self>
pub const EMULATE_COPROCESSOR: Pack64<bool, Self>
x87 FPU Emulation (EM
).
Force all x87 and MMX instructions to cause an #NE
exception.
Sourcepub const TASK_SWITCHED: Pack64<bool, Self>
pub const TASK_SWITCHED: Pack64<bool, Self>
Task Switched (TS
).
Set to 1 on hardware task switches. This allows lazily saving x87, MMX, and SSE state on hardware context switches.
Sourcepub const EXTENSION_TYPE: Pack64<bool, Self>
pub const EXTENSION_TYPE: Pack64<bool, Self>
Extension Type (ET
).
Indicates support of 387DX math coprocessor instructions.
Always set on all recent x86 processors, cannot be cleared.
Sourcepub const NUMERIC_ERROR: Pack64<bool, Self>
pub const NUMERIC_ERROR: Pack64<bool, Self>
Numeric Error (NE
).
Enables native error reporting for x87 FPU errors.
Sourcepub const WRITE_PROTECT: Pack64<bool, Self>
pub const WRITE_PROTECT: Pack64<bool, Self>
Write Protect (WP
).
Enables write protection for ring 0 pages.
Sourcepub const ALIGNMENT_MASK: Pack64<bool, Self>
pub const ALIGNMENT_MASK: Pack64<bool, Self>
Alignment Mask (AM
).
Enables user-mode alignment checking if the ALIGNMENT_CHECK
bit in
RFLAGS
is also set.
Sourcepub const NOT_WRITE_THROUGH: Pack64<bool, Self>
pub const NOT_WRITE_THROUGH: Pack64<bool, Self>
Not Write Through (NW
).
Sourcepub const CACHE_DISABLE: Pack64<bool, Self>
pub const CACHE_DISABLE: Pack64<bool, Self>
Cache Disable (NW
).
Sourcepub const PAGING_ENABLE: Pack64<bool, Self>
pub const PAGING_ENABLE: Pack64<bool, Self>
Paging Enabled (PG
).
Enables paging, if [PROTECTED_MODE_ENABLE
] is also set.
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.