#[repr(C, packed)]pub struct TaskStateSegment {
pub reserved: u32,
pub rsp: [u64; 3],
pub reserved2: u64,
pub ist: [u64; 7],
pub reserved3: u64,
pub reserved4: u16,
pub iomap_base: u16,
}
Expand description
Although hardware task-switching is not supported in 64-bit mode, a 64-bit task state segment (TSS) must exist.
The TSS holds information important to 64-bit mode and that is not directly related to the task-switch mechanism. This information includes:
RSPn
The full 64-bit canonical forms of the stack pointers (RSP) for privilege levels 0-2. RSPx is loaded in whenever an interrupt causes the CPU to change RPL to x. Note on a syscall entry this field is not used to load a stack, setting the stack there is the handler’s responsibility (however when using the int instruction in user-space, we load the stack from RSPn).
ISTn
The full 64-bit canonical forms of the interrupt stack table (IST) pointers. You can set an interrupt vector to use an IST entry in the Interrupt Descriptor Table by giving it a number from 0 - 7. If 0 is selected, then the IST mechanism is not used. If any other number is selected then when that interrupt vector is called the CPU will load RSP from the corresponding IST entry. This is useful for handling things like double faults, since you don’t have to worry about switching stacks; the CPU will do it for you.
I/O map base address
The 16-bit offset to the I/O permission bit map from the 64-bit TSS base.
The operating system must create at least one 64-bit TSS after activating IA-32e mode. It must execute the LTR instruction (in 64-bit mode) to load the TR register with a pointer to the 64-bit TSS responsible for both 64-bitmode programs and compatibility-mode programs (load_tr).
Fields
reserved: u32
rsp: [u64; 3]
The full 64-bit canonical forms of the stack pointers (RSP) for privilege levels 0-2.
reserved2: u64
ist: [u64; 7]
The full 64-bit canonical forms of the interrupt stack table (IST) pointers.
reserved3: u64
reserved4: u16
iomap_base: u16
The 16-bit offset to the I/O permission bit map from the 64-bit TSS base.
Implementations
sourceimpl TaskStateSegment
impl TaskStateSegment
Trait Implementations
sourceimpl Clone for TaskStateSegment
impl Clone for TaskStateSegment
sourcefn clone(&self) -> TaskStateSegment
fn clone(&self) -> TaskStateSegment
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TaskStateSegment
impl Debug for TaskStateSegment
sourceimpl Default for TaskStateSegment
impl Default for TaskStateSegment
sourcefn default() -> TaskStateSegment
fn default() -> TaskStateSegment
Returns the “default value” for a type. Read more
impl Copy for TaskStateSegment
Auto Trait Implementations
impl RefUnwindSafe for TaskStateSegment
impl Send for TaskStateSegment
impl Sync for TaskStateSegment
impl Unpin for TaskStateSegment
impl UnwindSafe for TaskStateSegment
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more