PatchworkOS
Loading...
Searching...
No Matches
IDT

Interrupt Descriptor Table. More...

Data Structures

struct  idt_desc_t
 IDT descriptor structure. More...
 
struct  idt_gate_t
 IDT gate structure. More...
 
struct  idt_t
 IDT structure. More...
 

Enumerations

enum  idt_attributes_t {
  IDT_ATTR_INTERRUPT = 0b1110 ,
  IDT_ATTR_TRAP = 0b1111 ,
  IDT_ATTR_RING0 = 0b00 ,
  IDT_ATTR_RING1 = 0b01 ,
  IDT_ATTR_RING2 = 0b10 ,
  IDT_ATTR_RING3 = 0b11 ,
  IDT_ATTR_PRESENT = 1 << 7
}
 IDT gate attributes. More...
 

Functions

void idt_init (void)
 Initialize the IDT structure in memory.
 
void idt_cpu_load (void)
 Load the IDT on the current CPU.
 

Detailed Description

Interrupt Descriptor Table.

The Interrupt Descriptor Table tells a CPU what to do when it receives an interrupt or exception.

Enumeration Type Documentation

◆ idt_attributes_t

IDT gate attributes.

Enumerator
IDT_ATTR_INTERRUPT 

Interrupt gate, will disable interrupts when invoked.

IDT_ATTR_TRAP 

Trap gate, will NOT disable interrupts when invoked.

IDT_ATTR_RING0 

Can be invoked from ring 0 or hardware only.

IDT_ATTR_RING1 

Can be invoked from ring 1 or lower.

IDT_ATTR_RING2 

Can be invoked from ring 2 or lower.

IDT_ATTR_RING3 

Can be invoked from ring 3 or lower.

IDT_ATTR_PRESENT 

Must be set for the entry to be valid.

Definition at line 22 of file idt.h.

Function Documentation

◆ idt_cpu_load()

void idt_cpu_load ( void  )

Load the IDT on the current CPU.

This will load the IDT using the lidt instruction.

Must be called after idt_init().

Definition at line 47 of file idt.c.

References idt_load_descriptor(), idt_desc_t::offset, and idt_desc_t::size.

Referenced by cpu_init().

◆ idt_init()

void idt_init ( void  )

Initialize the IDT structure in memory.

This will setup the IDT structure in memory, but will not load it. Loading is done in idt_cpu_load().

Definition at line 26 of file idt.c.

References EXCEPTION_AMOUNT, EXCEPTION_DOUBLE_FAULT, IDT_ATTR_INTERRUPT, IDT_ATTR_PRESENT, IDT_ATTR_RING0, idt_gate(), INTERRUPT_AMOUNT, TSS_IST_DOUBLE_FAULT, TSS_IST_EXCEPTION, TSS_IST_INTERRUPT, and vectorTable.

Referenced by init_early().