#[repr(transparent)]pub struct Cr0(u32);
Expand description
Contains system control flags that control operating mode and states of the processor.
Tuple Fields§
§0: u32
Implementations§
source§impl Cr0
impl Cr0
const PROTECTED_MODE_ENABLE_BITS: usize = 1usize
const PROTECTED_MODE_ENABLE_OFFSET: usize = 0usize
const MONITOR_COPROCESSOR_BITS: usize = 1usize
const MONITOR_COPROCESSOR_OFFSET: usize = 1usize
const EMULATE_COPROCESSOR_BITS: usize = 1usize
const EMULATE_COPROCESSOR_OFFSET: usize = 2usize
const TASK_SWITCHED_BITS: usize = 1usize
const TASK_SWITCHED_OFFSET: usize = 3usize
const NUMERIC_ERROR_BITS: usize = 1usize
const NUMERIC_ERROR_OFFSET: usize = 5usize
const WRITE_PROTECT_BITS: usize = 1usize
const WRITE_PROTECT_OFFSET: usize = 16usize
const ALIGNMENT_MASK_BITS: usize = 1usize
const ALIGNMENT_MASK_OFFSET: usize = 18usize
const NOT_WRITE_THROUGH_BITS: usize = 1usize
const NOT_WRITE_THROUGH_OFFSET: usize = 29usize
const CACHE_DISABLE_BITS: usize = 1usize
const CACHE_DISABLE_OFFSET: usize = 30usize
const PAGING_BITS: usize = 1usize
const PAGING_OFFSET: usize = 31usize
sourcepub const fn protected_mode_enable(&self) -> bool
pub const fn protected_mode_enable(&self) -> bool
Enables protected mode.
Bits: 0..1
sourcepub const fn with_protected_mode_enable_checked(
self,
value: bool,
) -> Result<Self, ()>
pub const fn with_protected_mode_enable_checked( self, value: bool, ) -> Result<Self, ()>
Enables protected mode.
Bits: 0..1
sourcepub const fn with_protected_mode_enable(self, value: bool) -> Self
pub const fn with_protected_mode_enable(self, value: bool) -> Self
Enables protected mode.
Bits: 0..1
sourcepub fn set_protected_mode_enable(&mut self, value: bool)
pub fn set_protected_mode_enable(&mut self, value: bool)
Enables protected mode.
Bits: 0..1
sourcepub fn set_protected_mode_enable_checked(
&mut self,
value: bool,
) -> Result<(), ()>
pub fn set_protected_mode_enable_checked( &mut self, value: bool, ) -> Result<(), ()>
Enables protected mode.
Bits: 0..1
sourcepub const fn monitor_coprocessor(&self) -> bool
pub const fn monitor_coprocessor(&self) -> bool
Enables monitoring of the coprocessor, typical for x87 instructions.
Bits: 1..2
sourcepub const fn with_monitor_coprocessor_checked(
self,
value: bool,
) -> Result<Self, ()>
pub const fn with_monitor_coprocessor_checked( self, value: bool, ) -> Result<Self, ()>
Enables monitoring of the coprocessor, typical for x87 instructions.
Bits: 1..2
sourcepub const fn with_monitor_coprocessor(self, value: bool) -> Self
pub const fn with_monitor_coprocessor(self, value: bool) -> Self
Enables monitoring of the coprocessor, typical for x87 instructions.
Bits: 1..2
sourcepub fn set_monitor_coprocessor(&mut self, value: bool)
pub fn set_monitor_coprocessor(&mut self, value: bool)
Enables monitoring of the coprocessor, typical for x87 instructions.
Bits: 1..2
sourcepub fn set_monitor_coprocessor_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_monitor_coprocessor_checked(&mut self, value: bool) -> Result<(), ()>
Enables monitoring of the coprocessor, typical for x87 instructions.
Bits: 1..2
sourcepub const fn emulate_coprocessor(&self) -> bool
pub const fn emulate_coprocessor(&self) -> bool
Indicates that the processor does not have an internal or external x87 FPU when set.
Bits: 2..3
sourcepub const fn with_emulate_coprocessor_checked(
self,
value: bool,
) -> Result<Self, ()>
pub const fn with_emulate_coprocessor_checked( self, value: bool, ) -> Result<Self, ()>
Indicates that the processor does not have an internal or external x87 FPU when set.
Bits: 2..3
sourcepub const fn with_emulate_coprocessor(self, value: bool) -> Self
pub const fn with_emulate_coprocessor(self, value: bool) -> Self
Indicates that the processor does not have an internal or external x87 FPU when set.
Bits: 2..3
sourcepub fn set_emulate_coprocessor(&mut self, value: bool)
pub fn set_emulate_coprocessor(&mut self, value: bool)
Indicates that the processor does not have an internal or external x87 FPU when set.
Bits: 2..3
sourcepub fn set_emulate_coprocessor_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_emulate_coprocessor_checked(&mut self, value: bool) -> Result<(), ()>
Indicates that the processor does not have an internal or external x87 FPU when set.
Bits: 2..3
sourcepub const fn task_switched(&self) -> bool
pub const fn task_switched(&self) -> bool
Automatically set to 1 on hardware task switch.
This flags allows lazily saving x87/MMX/SSE instructions on hardware context switches.
Bits: 3..4
sourcepub const fn with_task_switched_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_task_switched_checked(self, value: bool) -> Result<Self, ()>
Automatically set to 1 on hardware task switch.
This flags allows lazily saving x87/MMX/SSE instructions on hardware context switches.
Bits: 3..4
sourcepub const fn with_task_switched(self, value: bool) -> Self
pub const fn with_task_switched(self, value: bool) -> Self
Automatically set to 1 on hardware task switch.
This flags allows lazily saving x87/MMX/SSE instructions on hardware context switches.
Bits: 3..4
sourcepub fn set_task_switched(&mut self, value: bool)
pub fn set_task_switched(&mut self, value: bool)
Automatically set to 1 on hardware task switch.
This flags allows lazily saving x87/MMX/SSE instructions on hardware context switches.
Bits: 3..4
sourcepub fn set_task_switched_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_task_switched_checked(&mut self, value: bool) -> Result<(), ()>
Automatically set to 1 on hardware task switch.
This flags allows lazily saving x87/MMX/SSE instructions on hardware context switches.
Bits: 3..4
sourcepub const fn numeric_error(&self) -> bool
pub const fn numeric_error(&self) -> bool
Enables the native error reporting mechanism for x87 FPU errors.
Bits: 5..6
sourcepub const fn with_numeric_error_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_numeric_error_checked(self, value: bool) -> Result<Self, ()>
Enables the native error reporting mechanism for x87 FPU errors.
Bits: 5..6
sourcepub const fn with_numeric_error(self, value: bool) -> Self
pub const fn with_numeric_error(self, value: bool) -> Self
Enables the native error reporting mechanism for x87 FPU errors.
Bits: 5..6
sourcepub fn set_numeric_error(&mut self, value: bool)
pub fn set_numeric_error(&mut self, value: bool)
Enables the native error reporting mechanism for x87 FPU errors.
Bits: 5..6
sourcepub fn set_numeric_error_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_numeric_error_checked(&mut self, value: bool) -> Result<(), ()>
Enables the native error reporting mechanism for x87 FPU errors.
Bits: 5..6
sourcepub const fn write_protect(&self) -> bool
pub const fn write_protect(&self) -> bool
Controls whether supervisor-level writes to read-only pages are inhibited.
Bits: 16..17
sourcepub const fn with_write_protect_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_write_protect_checked(self, value: bool) -> Result<Self, ()>
Controls whether supervisor-level writes to read-only pages are inhibited.
Bits: 16..17
sourcepub const fn with_write_protect(self, value: bool) -> Self
pub const fn with_write_protect(self, value: bool) -> Self
Controls whether supervisor-level writes to read-only pages are inhibited.
Bits: 16..17
sourcepub fn set_write_protect(&mut self, value: bool)
pub fn set_write_protect(&mut self, value: bool)
Controls whether supervisor-level writes to read-only pages are inhibited.
Bits: 16..17
sourcepub fn set_write_protect_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_write_protect_checked(&mut self, value: bool) -> Result<(), ()>
Controls whether supervisor-level writes to read-only pages are inhibited.
Bits: 16..17
sourcepub const fn alignment_mask(&self) -> bool
pub const fn alignment_mask(&self) -> bool
Enables automatic alignment checking.
Bits: 18..19
sourcepub const fn with_alignment_mask_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_alignment_mask_checked(self, value: bool) -> Result<Self, ()>
Enables automatic alignment checking.
Bits: 18..19
sourcepub const fn with_alignment_mask(self, value: bool) -> Self
pub const fn with_alignment_mask(self, value: bool) -> Self
Enables automatic alignment checking.
Bits: 18..19
sourcepub fn set_alignment_mask(&mut self, value: bool)
pub fn set_alignment_mask(&mut self, value: bool)
Enables automatic alignment checking.
Bits: 18..19
sourcepub fn set_alignment_mask_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_alignment_mask_checked(&mut self, value: bool) -> Result<(), ()>
Enables automatic alignment checking.
Bits: 18..19
sourcepub const fn not_write_through(&self) -> bool
pub const fn not_write_through(&self) -> bool
Ignored. Used to control write-back/write-through cache strategy on older CPUs.
Bits: 29..30
sourcepub const fn with_not_write_through_checked(
self,
value: bool,
) -> Result<Self, ()>
pub const fn with_not_write_through_checked( self, value: bool, ) -> Result<Self, ()>
Ignored. Used to control write-back/write-through cache strategy on older CPUs.
Bits: 29..30
sourcepub const fn with_not_write_through(self, value: bool) -> Self
pub const fn with_not_write_through(self, value: bool) -> Self
Ignored. Used to control write-back/write-through cache strategy on older CPUs.
Bits: 29..30
sourcepub fn set_not_write_through(&mut self, value: bool)
pub fn set_not_write_through(&mut self, value: bool)
Ignored. Used to control write-back/write-through cache strategy on older CPUs.
Bits: 29..30
sourcepub fn set_not_write_through_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_not_write_through_checked(&mut self, value: bool) -> Result<(), ()>
Ignored. Used to control write-back/write-through cache strategy on older CPUs.
Bits: 29..30
sourcepub const fn cache_disable(&self) -> bool
pub const fn cache_disable(&self) -> bool
Disables internal caches (only for some cases).
Bits: 30..31
sourcepub const fn with_cache_disable_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_cache_disable_checked(self, value: bool) -> Result<Self, ()>
Disables internal caches (only for some cases).
Bits: 30..31
sourcepub const fn with_cache_disable(self, value: bool) -> Self
pub const fn with_cache_disable(self, value: bool) -> Self
Disables internal caches (only for some cases).
Bits: 30..31
sourcepub fn set_cache_disable(&mut self, value: bool)
pub fn set_cache_disable(&mut self, value: bool)
Disables internal caches (only for some cases).
Bits: 30..31
sourcepub fn set_cache_disable_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_cache_disable_checked(&mut self, value: bool) -> Result<(), ()>
Disables internal caches (only for some cases).
Bits: 30..31
sourcepub const fn with_paging_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_paging_checked(self, value: bool) -> Result<Self, ()>
Enables page translation.
Bits: 31..32
sourcepub const fn with_paging(self, value: bool) -> Self
pub const fn with_paging(self, value: bool) -> Self
Enables page translation.
Bits: 31..32
sourcepub fn set_paging(&mut self, value: bool)
pub fn set_paging(&mut self, value: bool)
Enables page translation.
Bits: 31..32
sourcepub fn set_paging_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_paging_checked(&mut self, value: bool) -> Result<(), ()>
Enables page translation.
Bits: 31..32
Trait Implementations§
impl Copy for Cr0
Auto Trait Implementations§
impl Freeze for Cr0
impl RefUnwindSafe for Cr0
impl Send for Cr0
impl Sync for Cr0
impl Unpin for Cr0
impl UnwindSafe for Cr0
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)