The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
idt.h File Reference
#include "common/stdint.h"

Go to the source code of this file.

Enumerations

enum  idt_flags {
  IDT_FLAG_GATE_TASK = 0x05 , IDT_FLAG_GATE_16BIT_INT = 0x06 , IDT_FLAG_GATE_16BIT_TRAP = 0x07 , IDT_FLAG_GATE_32BIT_INT = 0x0E ,
  IDT_FLAG_GATE_32BIT_TRAP = 0x0F , IDT_FLAG_RING0 = (0 << 5) , IDT_FLAG_RING1 = (1 << 5) , IDT_FLAG_RING2 = (2 << 5) ,
  IDT_FLAG_RING3 = (3 << 5) , IDT_FLAG_PRESENT = 0x80
}
 IDT gate type and attribute flags. More...

Functions

void idt_initialize (void)
 initialize the Interrupt Descriptor Table (IDT) and load it into the IDTR register.
void idt_load_core (void)
 load the IDT into the IDTR of the core that runs the call.
void idt_set_gate (int vector, void *base, uint16_t segment, uint8_t flags)
 configure a single IDT gate entry.
void idt_enable_gate (int vector)
 enable an IDT gate by setting its present bit.
void idt_disable_gate (int vector)
 disable an IDT gate by clearing its present bit.

Enumeration Type Documentation

◆ idt_flags

enum idt_flags

IDT gate type and attribute flags.

combine these with bitwise OR to build the flags byte for an IDT entry.

Enumerator
IDT_FLAG_GATE_TASK 
IDT_FLAG_GATE_16BIT_INT 
IDT_FLAG_GATE_16BIT_TRAP 
IDT_FLAG_GATE_32BIT_INT 
IDT_FLAG_GATE_32BIT_TRAP 
IDT_FLAG_RING0 
IDT_FLAG_RING1 
IDT_FLAG_RING2 
IDT_FLAG_RING3 
IDT_FLAG_PRESENT 

Function Documentation

◆ idt_initialize()

void idt_initialize ( void )

initialize the Interrupt Descriptor Table (IDT) and load it into the IDTR register.

◆ idt_load_core()

void idt_load_core ( void )

load the IDT into the IDTR of the core that runs the call.

idt_initialize() does it for the boot core; each other core calls this when it starts.

◆ idt_set_gate()

void idt_set_gate ( int vector,
void * base,
uint16_t segment,
uint8_t flags )

configure a single IDT gate entry.

Parameters
vectorinterrupt vector number (0–255).
basepointer to the interrupt service routine.
segmentcode segment selector for the ISR.
flagsgate type and attribute flags (see idt_flags).

◆ idt_enable_gate()

void idt_enable_gate ( int vector)

enable an IDT gate by setting its present bit.

Parameters
vectorinterrupt vector number (0–255).

◆ idt_disable_gate()

void idt_disable_gate ( int vector)

disable an IDT gate by clearing its present bit.

Parameters
vectorinterrupt vector number (0–255).