Skip to main content

GlobalCpuState

Struct GlobalCpuState 

Source
#[repr(align(64))]
pub struct GlobalCpuState { idt: UncheckedCell<InterruptDescriptorTable>, user_code_selector: AtomicU16, user_data_selector: AtomicU16, }
Expand description

Global CPU state such as IDT and user code/data selectors

Fields§

§idt: UncheckedCell<InterruptDescriptorTable>§user_code_selector: AtomicU16§user_data_selector: AtomicU16

Implementations§

Source§

impl GlobalCpuState

Source

pub const fn new() -> Self

Constructor; returns a GlobalCpuState with an uninitialized IDT and zeroed selectors

Source

pub unsafe fn init_idt(&'static self)

Initialize the IDT

§Safety

The caller must guarantee the following:

  • That this method has never been called before and will never be called again
  • That at the time of calling this method, no references or pointers to this data exist
  • While this method is being called, no other CPU is working with the given data
Source

pub fn set_user_selectors(&self, code: u16, data: u16)

Set the user data and code selectors

Source

pub unsafe fn idt(&self) -> &InterruptDescriptorTable

Getter for GlobalCpuState::Idt

§Safety

The caller must guarantee the following:

  • That this value’s init method has already been called before
  • That at this method’s entire execution time, no mutable references or pointers to this data exist or will exist
Source

pub fn user_code_selector(&self) -> u16

Getter for GlobalCpuState::user_code_selector

Source

pub fn user_data_selector(&self) -> u16

Getter for GlobalCpuState::user_data_selector

Auto Trait Implementations§

§

impl !Freeze for GlobalCpuState

§

impl !RefUnwindSafe for GlobalCpuState

§

impl Send for GlobalCpuState

§

impl Sync for GlobalCpuState

§

impl Unpin for GlobalCpuState

§

impl UnsafeUnpin for GlobalCpuState

§

impl UnwindSafe for GlobalCpuState

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

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

fn try_from(value: U) -> Result<T, !>

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.