[][src]Struct sunrise_kernel::i386::TssStruct

#[repr(C, align(128))]pub struct TssStruct {
    pub link: u16,
    _reserved1: u16,
    pub esp0: u32,
    pub ss0: u16,
    _reserved2: u16,
    pub esp1: u32,
    pub ss1: u16,
    _reserved3: u16,
    pub esp2: u32,
    pub ss2: u16,
    _reserved4: u16,
    pub cr3: u32,
    pub eip: u32,
    pub eflags: u32,
    pub eax: u32,
    pub ecx: u32,
    pub edx: u32,
    pub ebx: u32,
    pub esp: u32,
    pub ebp: u32,
    pub esi: u32,
    pub edi: u32,
    pub es: u16,
    _reserved5: u16,
    pub cs: u16,
    _reserved6: u16,
    pub ss: u16,
    _reserved7: u16,
    pub ds: u16,
    _reserved8: u16,
    pub fs: u16,
    _reserved9: u16,
    pub gs: u16,
    _reserveda: u16,
    pub ldt_selector: u16,
    _reservedb: u16,
    _reservedc: u16,
    pub iopboffset: u16,
}

The Task State Segment (TSS) is a special data structure for x86 processors which holds information about a task. The TSS is primarily suited for hardware multitasking, where each individual process has its own TSS. (see OSDEV)

Fields

link: u16_reserved1: u16esp0: u32ss0: u16_reserved2: u16esp1: u32ss1: u16_reserved3: u16esp2: u32ss2: u16_reserved4: u16cr3: u32eip: u32eflags: u32eax: u32ecx: u32edx: u32ebx: u32esp: u32ebp: u32esi: u32edi: u32es: u16_reserved5: u16cs: u16_reserved6: u16ss: u16_reserved7: u16ds: u16_reserved8: u16fs: u16_reserved9: u16gs: u16_reserveda: u16ldt_selector: u16_reservedb: u16_reservedc: u16iopboffset: u16

Implementations

impl TssStruct[src]

pub const fn empty() -> TssStruct[src]

Creates an empty TssStruct.

All fields are set to 0, suitable for static declarations, so that it can live in the .bss.

The TssStruct must then be initialized with init.

Note that until it is initialized properly, the .iopboffset field will be invalid.

pub fn init(&mut self)[src]

Fills the TSS.

The TSS is filled with kernel segments selectors, and the current cr3. Registers are set to 0.

pub fn set_esp0_stack(&mut self, esp: u32)[src]

Set the stack pointer used to handle interrupts occuring while running in Ring3.

If an interrupt occurs while running in Ring3, it would be a security problem to use the user-controlled stack to handle the interrupt. To avoid this, we can tell the CPU to instead run the interrupt handler in a separate stack.

pub fn set_ip(&mut self, eip: u32)[src]

Set the IP of the current task struct. When we hardware task switch to this TSS, we will resume running at the given instruction.

Trait Implementations

impl Clone for TssStruct[src]

impl Copy for TssStruct[src]

impl Debug for TssStruct[src]

Auto Trait Implementations

impl RefUnwindSafe for TssStruct

impl Send for TssStruct

impl Sync for TssStruct

impl Unpin for TssStruct

impl UnwindSafe for TssStruct

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.