rstubs::arch::regs

Struct Cr0

source
#[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

source

const PROTECTED_MODE_ENABLE_BITS: usize = 1usize

source

const PROTECTED_MODE_ENABLE_OFFSET: usize = 0usize

source

const MONITOR_COPROCESSOR_BITS: usize = 1usize

source

const MONITOR_COPROCESSOR_OFFSET: usize = 1usize

source

const EMULATE_COPROCESSOR_BITS: usize = 1usize

source

const EMULATE_COPROCESSOR_OFFSET: usize = 2usize

source

const TASK_SWITCHED_BITS: usize = 1usize

source

const TASK_SWITCHED_OFFSET: usize = 3usize

source

const NUMERIC_ERROR_BITS: usize = 1usize

source

const NUMERIC_ERROR_OFFSET: usize = 5usize

source

const WRITE_PROTECT_BITS: usize = 1usize

source

const WRITE_PROTECT_OFFSET: usize = 16usize

source

const ALIGNMENT_MASK_BITS: usize = 1usize

source

const ALIGNMENT_MASK_OFFSET: usize = 18usize

source

const NOT_WRITE_THROUGH_BITS: usize = 1usize

source

const NOT_WRITE_THROUGH_OFFSET: usize = 29usize

source

const CACHE_DISABLE_BITS: usize = 1usize

source

const CACHE_DISABLE_OFFSET: usize = 30usize

source

const PAGING_BITS: usize = 1usize

source

const PAGING_OFFSET: usize = 31usize

source

pub const fn new() -> Self

Creates a new default initialized bitfield.

source

pub const fn from_bits(bits: u32) -> Self

Convert from bits.

source

pub const fn into_bits(self) -> u32

Convert into bits.

source

pub const fn protected_mode_enable(&self) -> bool

Enables protected mode.

Bits: 0..1

source

pub const fn with_protected_mode_enable_checked( self, value: bool, ) -> Result<Self, ()>

Enables protected mode.

Bits: 0..1

source

pub const fn with_protected_mode_enable(self, value: bool) -> Self

Enables protected mode.

Bits: 0..1

source

pub fn set_protected_mode_enable(&mut self, value: bool)

Enables protected mode.

Bits: 0..1

source

pub fn set_protected_mode_enable_checked( &mut self, value: bool, ) -> Result<(), ()>

Enables protected mode.

Bits: 0..1

source

pub const fn monitor_coprocessor(&self) -> bool

Enables monitoring of the coprocessor, typical for x87 instructions.

Bits: 1..2

source

pub const fn with_monitor_coprocessor_checked( self, value: bool, ) -> Result<Self, ()>

Enables monitoring of the coprocessor, typical for x87 instructions.

Bits: 1..2

source

pub const fn with_monitor_coprocessor(self, value: bool) -> Self

Enables monitoring of the coprocessor, typical for x87 instructions.

Bits: 1..2

source

pub fn set_monitor_coprocessor(&mut self, value: bool)

Enables monitoring of the coprocessor, typical for x87 instructions.

Bits: 1..2

source

pub fn set_monitor_coprocessor_checked(&mut self, value: bool) -> Result<(), ()>

Enables monitoring of the coprocessor, typical for x87 instructions.

Bits: 1..2

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

pub const fn numeric_error(&self) -> bool

Enables the native error reporting mechanism for x87 FPU errors.

Bits: 5..6

source

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

source

pub const fn with_numeric_error(self, value: bool) -> Self

Enables the native error reporting mechanism for x87 FPU errors.

Bits: 5..6

source

pub fn set_numeric_error(&mut self, value: bool)

Enables the native error reporting mechanism for x87 FPU errors.

Bits: 5..6

source

pub fn set_numeric_error_checked(&mut self, value: bool) -> Result<(), ()>

Enables the native error reporting mechanism for x87 FPU errors.

Bits: 5..6

source

pub const fn write_protect(&self) -> bool

Controls whether supervisor-level writes to read-only pages are inhibited.

Bits: 16..17

source

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

source

pub const fn with_write_protect(self, value: bool) -> Self

Controls whether supervisor-level writes to read-only pages are inhibited.

Bits: 16..17

source

pub fn set_write_protect(&mut self, value: bool)

Controls whether supervisor-level writes to read-only pages are inhibited.

Bits: 16..17

source

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

source

pub const fn alignment_mask(&self) -> bool

Enables automatic alignment checking.

Bits: 18..19

source

pub const fn with_alignment_mask_checked(self, value: bool) -> Result<Self, ()>

Enables automatic alignment checking.

Bits: 18..19

source

pub const fn with_alignment_mask(self, value: bool) -> Self

Enables automatic alignment checking.

Bits: 18..19

source

pub fn set_alignment_mask(&mut self, value: bool)

Enables automatic alignment checking.

Bits: 18..19

source

pub fn set_alignment_mask_checked(&mut self, value: bool) -> Result<(), ()>

Enables automatic alignment checking.

Bits: 18..19

source

pub const fn not_write_through(&self) -> bool

Ignored. Used to control write-back/write-through cache strategy on older CPUs.

Bits: 29..30

source

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

source

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

source

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

source

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

source

pub const fn cache_disable(&self) -> bool

Disables internal caches (only for some cases).

Bits: 30..31

source

pub const fn with_cache_disable_checked(self, value: bool) -> Result<Self, ()>

Disables internal caches (only for some cases).

Bits: 30..31

source

pub const fn with_cache_disable(self, value: bool) -> Self

Disables internal caches (only for some cases).

Bits: 30..31

source

pub fn set_cache_disable(&mut self, value: bool)

Disables internal caches (only for some cases).

Bits: 30..31

source

pub fn set_cache_disable_checked(&mut self, value: bool) -> Result<(), ()>

Disables internal caches (only for some cases).

Bits: 30..31

source

pub const fn paging(&self) -> bool

Enables page translation.

Bits: 31..32

source

pub const fn with_paging_checked(self, value: bool) -> Result<Self, ()>

Enables page translation.

Bits: 31..32

source

pub const fn with_paging(self, value: bool) -> Self

Enables page translation.

Bits: 31..32

source

pub fn set_paging(&mut self, value: bool)

Enables page translation.

Bits: 31..32

source

pub fn set_paging_checked(&mut self, value: bool) -> Result<(), ()>

Enables page translation.

Bits: 31..32

source§

impl Cr0

source

pub fn read() -> Self

source

pub fn update(f: impl FnOnce(Self) -> Self)

source

unsafe fn write(self)

Trait Implementations§

source§

impl Clone for Cr0

source§

fn clone(&self) -> Cr0

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Cr0

source§

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

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

impl Default for Cr0

source§

fn default() -> Self

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

impl From<Cr0> for u32

source§

fn from(v: Cr0) -> u32

Converts to this type from the input type.
source§

impl From<u32> for Cr0

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

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> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.