PatchworkOS  da8a090
A non-POSIX operating system.
Loading...
Searching...
No Matches
TSS

Task State Segment. More...

Collaboration diagram for TSS:

Detailed Description

Task State Segment.

The Task State Segment is more or less deprecated, we use it only to tell the cpu what stack pointer to use when handling interrupts. This is done using the Interrupt Stack Table (IST).

See also
OSDev Wiki TTS

Data Structures

struct  tss_t
 Task State Segment structure. More...
 

Macros

#define TSS_IST_EXCEPTION   TSS_IST1
 The IST index to use for exceptions.
 
#define TSS_IST_DOUBLE_FAULT   TSS_IST2
 The IST index to use for double faults.
 
#define TSS_IST_NMI   TSS_IST3
 The IST index to use for non-maskable interrupts.
 
#define TSS_IST_INTERRUPT   TSS_IST4
 The IST index to use for other interrupts.
 

Enumerations

enum  tss_ist_t {
  TSS_IST_NONE = 0 , TSS_IST1 = 1 , TSS_IST2 = 2 , TSS_IST3 = 3 ,
  TSS_IST4 = 4 , TSS_IST5 = 5 , TSS_IST6 = 6 , TSS_IST7 = 7 ,
  TSS_IST_COUNT = 7
}
 Interrupt Stack Table indices. More...
 

Functions

void tss_load (void)
 Load the TSS.
 
void tss_init (tss_t *tss)
 Initialize a TSS structure.
 
void tss_ist_load (tss_t *tss, tss_ist_t ist, stack_pointer_t *stack)
 Load a stack into an IST entry.
 

Macro Definition Documentation

◆ TSS_IST_EXCEPTION

#define TSS_IST_EXCEPTION   TSS_IST1

The IST index to use for exceptions.

Definition at line 40 of file tss.h.

◆ TSS_IST_DOUBLE_FAULT

#define TSS_IST_DOUBLE_FAULT   TSS_IST2

The IST index to use for double faults.

Definition at line 45 of file tss.h.

◆ TSS_IST_NMI

#define TSS_IST_NMI   TSS_IST3

The IST index to use for non-maskable interrupts.

Definition at line 50 of file tss.h.

◆ TSS_IST_INTERRUPT

#define TSS_IST_INTERRUPT   TSS_IST4

The IST index to use for other interrupts.

Definition at line 55 of file tss.h.

Enumeration Type Documentation

◆ tss_ist_t

enum tss_ist_t

Interrupt Stack Table indices.

Enumerator
TSS_IST_NONE 
TSS_IST1 
TSS_IST2 
TSS_IST3 
TSS_IST4 
TSS_IST5 
TSS_IST6 
TSS_IST7 
TSS_IST_COUNT 

Definition at line 24 of file tss.h.

Function Documentation

◆ tss_load()

void tss_load ( void  )
extern

Load the TSS.

Loads the TSS using the ltr instruction, the TSS must already be present in the GDT.

Here is the caller graph for this function:

◆ tss_init()

void tss_init ( tss_t tss)

Initialize a TSS structure.

Parameters
tssThe TSS structure to initialize.

Definition at line 5 of file tss.c.

Here is the caller graph for this function:

◆ tss_ist_load()

void tss_ist_load ( tss_t tss,
tss_ist_t  ist,
stack_pointer_t stack 
)

Load a stack into an IST entry.

Parameters
tssThe TSS structure to load the IST into.
istThe IST index to load the stack into.
stackThe stack to load into the TSS.

Definition at line 21 of file tss.c.

Here is the caller graph for this function: