Struct rstubs::arch::regs::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

pub const fn new() -> Self

Creates a new default initialized bitfield.

source

const PROTECTED_MODE_ENABLE_BITS: usize = 1usize

source

const PROTECTED_MODE_ENABLE_OFFSET: usize = 0usize

source

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

Enables protected mode.

Bits: 0..1

source

pub const fn protected_mode_enable(&self) -> bool

Enables protected mode.

Bits: 0..1

source

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

Enables protected mode.

Bits: 0..1

source

const MONITOR_COPROCESSOR_BITS: usize = 1usize

source

const MONITOR_COPROCESSOR_OFFSET: usize = 1usize

source

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

Enables monitoring of the coprocessor, typical for x87 instructions.

Controls together with the TASK_SWITCHED flag whether a wait or fwait instruction should cause a device-not-available exception.

Bits: 1..2

source

pub const fn monitor_coprocessor(&self) -> bool

Enables monitoring of the coprocessor, typical for x87 instructions.

Controls together with the TASK_SWITCHED flag whether a wait or fwait instruction should cause a device-not-available exception.

Bits: 1..2

source

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

Enables monitoring of the coprocessor, typical for x87 instructions.

Controls together with the TASK_SWITCHED flag whether a wait or fwait instruction should cause a device-not-available exception.

Bits: 1..2

source

const EMULATE_COPROCESSOR_BITS: usize = 1usize

source

const EMULATE_COPROCESSOR_OFFSET: usize = 2usize

source

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

Force all x87 and MMX instructions to cause an exception.

Bits: 2..3

source

pub const fn emulate_coprocessor(&self) -> bool

Force all x87 and MMX instructions to cause an exception.

Bits: 2..3

source

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

Force all x87 and MMX instructions to cause an exception.

Bits: 2..3

source

const TASK_SWITCHED_BITS: usize = 1usize

source

const TASK_SWITCHED_OFFSET: usize = 3usize

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 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 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

const NUMERIC_ERROR_BITS: usize = 1usize

source

const NUMERIC_ERROR_OFFSET: usize = 5usize

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 const fn numeric_error(&self) -> bool

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

const WRITE_PROTECT_BITS: usize = 1usize

source

const WRITE_PROTECT_OFFSET: usize = 16usize

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 const fn write_protect(&self) -> bool

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

const ALIGNMENT_MASK_BITS: usize = 1usize

source

const ALIGNMENT_MASK_OFFSET: usize = 18usize

source

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

Enables automatic alignment checking.

Bits: 18..19

source

pub const fn alignment_mask(&self) -> bool

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

const NOT_WRITE_THROUGH_BITS: usize = 1usize

source

const NOT_WRITE_THROUGH_OFFSET: usize = 29usize

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 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 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

const CACHE_DISABLE_BITS: usize = 1usize

source

const CACHE_DISABLE_OFFSET: usize = 30usize

source

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

Disables internal caches (only for some cases).

Bits: 30..31

source

pub const fn cache_disable(&self) -> bool

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

const PAGING_BITS: usize = 1usize

source

const PAGING_OFFSET: usize = 31usize

source

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

Enables page translation.

Bits: 31..32

source

pub const fn paging(&self) -> bool

Enables page translation.

Bits: 31..32

source

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

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 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
§

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
§

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.

§

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.