pub struct ControlRegister3(/* private fields */);
Available on x86 or x86-64 only.
Expand description

CR3: System control register that contains the top-level page table address and two associated caching flags.

Getters and setters for this structure only access a value in memory, not the register itself. Use the get and set methods to work with the actual register.

Implementations§

source§

impl ControlRegister3

source

pub fn write_through(&self) -> bool

CR3.PWT: Enables write-through caching for the top-level page table.

Does not apply when ControlRegister4::process_context_ids or ControlRegister4::physical_address_extension is enabled.

source

pub fn cache_disabled(&self) -> bool

CR3.PCD: Disables caching for the top-level page table.

Does not apply when ControlRegister4::process_context_ids or ControlRegister4::physical_address_extension is enabled.

source

pub fn process_context_id(&self) -> u16

Available on x86-64 only.

CR4.PCIDE: The process-context identifier (PCID) associated with this series of page tables.

Requires 64-bit mode and ControlRegister4::process_context_ids.

source

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

CR3.PWT: Enables write-through caching for the top-level page table.

Does not apply when ControlRegister4::process_context_ids or ControlRegister4::physical_address_extension is enabled.

source

pub fn with_write_through(&mut self, value: bool) -> Self

CR3.PWT: Enables write-through caching for the top-level page table.

Does not apply when ControlRegister4::process_context_ids or ControlRegister4::physical_address_extension is enabled.

source

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

CR3.PCD: Disables caching for the top-level page table.

Does not apply when ControlRegister4::process_context_ids or ControlRegister4::physical_address_extension is enabled.

source

pub fn with_cache_disabled(&mut self, value: bool) -> Self

CR3.PCD: Disables caching for the top-level page table.

Does not apply when ControlRegister4::process_context_ids or ControlRegister4::physical_address_extension is enabled.

source

pub fn set_process_context_id(&mut self, value: u16)

Available on x86-64 only.

CR4.PCIDE: The process-context identifier (PCID) associated with this series of page tables.

Requires 64-bit mode and ControlRegister4::process_context_ids.

source

pub fn with_process_context_id(&self, value: u16) -> Self

Available on x86-64 only.

CR4.PCIDE: The process-context identifier (PCID) associated with this series of page tables.

Requires 64-bit mode and ControlRegister4::process_context_ids.

source§

impl ControlRegister3

source

pub fn get() -> Self

Retrieve the current value of this register

source

pub unsafe fn set(value: Self)

Update the register to the given value.

§Safety

Altering certain system flags can have dramatic effects on the execution of this and other programs, including memory safety.

source§

impl ControlRegister3

source

pub fn address(self) -> usize

Get the address of the top-level page table.

source

pub fn set_address(&mut self, value: usize)

Set the address of the top-level page table.

§Panics

Panics if the new address is not 4K-aligned.

Trait Implementations§

source§

impl Bitfield<usize> for ControlRegister3

§

fn new(value: T) -> Self

Construct a new bitfield type from its underlying representation
§

fn value(self) -> T

Unwrap the bitfield into its underlying representation
source§

impl Clone for ControlRegister3

source§

fn clone(&self) -> ControlRegister3

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for ControlRegister3

source§

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

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

impl Default for ControlRegister3

source§

fn default() -> ControlRegister3

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

impl From<ControlRegister3> for usize

source§

fn from(val: ControlRegister3) -> Self

Converts to this type from the input type.
source§

impl From<usize> for ControlRegister3

source§

fn from(val: usize) -> Self

Converts to this type from the input type.
source§

impl PartialEq for ControlRegister3

source§

fn eq(&self, other: &ControlRegister3) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ControlRegister3

source§

impl Eq for ControlRegister3

source§

impl StructuralPartialEq for ControlRegister3

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

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

Performs the conversion.