#[repr(align(64))]pub struct CpuState {
tss: Tss,
gdt: UncheckedCell<GlobalDescriptorTable>,
gs_info: GsInfo,
}Expand description
Per-CPU state such as TSS and GDT
Fields§
§tss: Tss§gdt: UncheckedCell<GlobalDescriptorTable>§gs_info: GsInfoImplementations§
Source§impl CpuState
impl CpuState
Sourcepub unsafe fn init_tss(&'static self)
pub unsafe fn init_tss(&'static self)
Initialize the TSS
§Safety
The caller must guarantee that this method is called exactly once before any calls to
CpuState::tss are made
Sourcepub unsafe fn init_gdt(&'static self) -> GdtSetupInfo
pub unsafe fn init_gdt(&'static self) -> GdtSetupInfo
Initialize the GDT
§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
Sourcepub unsafe fn init_gs_info(&'static self)
pub unsafe fn init_gs_info(&'static self)
Sourcepub unsafe fn set_kernel_stack_top(&self, kernel_stack_top: VirtAddr)
pub unsafe fn set_kernel_stack_top(&self, kernel_stack_top: VirtAddr)
Set the kernel stack top of the CPU which owns this CpuState
§Safety
The caller must guarantee the following:
- That
CpuState::init_tsshas already been called - This method is only called on the CPU which owns this TSS
- That no refs/ptrs from
CpuState::tssare held when this is called kernel_stack_topis a valid pointer to a valid, mapped kernel stack
Sourcepub unsafe fn gdt(&self) -> &GlobalDescriptorTable
pub unsafe fn gdt(&self) -> &GlobalDescriptorTable
Getter for CpuState::gdt
§Safety
The caller must guarantee the following:
- That this value’s
initmethod 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