AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
idt.c File Reference

x86: the Interrupt Descriptor Table (IDT), which says where each interrupt and exception vector goes. More...

#include <core/system.h>
#include "cpu.h"

Go to the source code of this file.

Data Structures

struct  idt_entry
struct  idt_ptr

Macros

#define DPL0   0
#define DPL3   3

Functions

void x86_idt_gate_set (uint32_t id, uintptr_t offset)
 Sets an interrupt gate that only the hardware (and the kernel) can raise: an exception or a device interrupt.
void x86_idt_gate_user_set (uint32_t id, uintptr_t offset)
 Sets an interrupt gate that user mode may raise with int too: the system call vector.
void x86_idt_setup ()
 Loads the IDT on the running CPU.

Variables

static struct idt_entry idt [256]
struct idt_ptr idt_pointer

Detailed Description

x86: the Interrupt Descriptor Table (IDT), which says where each interrupt and exception vector goes.

All CPUs share it.

Definition in file idt.c.

Macro Definition Documentation

◆ DPL0

#define DPL0   0

Definition at line 34 of file idt.c.

◆ DPL3

#define DPL3   3

Definition at line 35 of file idt.c.

Function Documentation

◆ x86_idt_gate_set()

void x86_idt_gate_set ( uint32_t id,
uintptr_t offset )

Sets an interrupt gate that only the hardware (and the kernel) can raise: an exception or a device interrupt.

The handler runs in the kernel's code segment, with interrupts disabled.

Parameters
idthe vector
offsetthe handler's address

Definition at line 45 of file idt.c.

References idt_entry::dpl, DPL0, idt_entry::flags, idt, idt_entry::offset_ext, idt_entry::offset_hi, idt_entry::offset_lo, idt_entry::p, idt_entry::selector, and x86_idt_gate_set().

Referenced by x86_idt_gate_set(), x86_irq_gates_setup(), and x86_isr_setup().

◆ x86_idt_gate_user_set()

void x86_idt_gate_user_set ( uint32_t id,
uintptr_t offset )

Sets an interrupt gate that user mode may raise with int too: the system call vector.

The handler still runs in the kernel's code segment.

Parameters
idthe vector
offsetthe handler's address

Definition at line 67 of file idt.c.

References idt_entry::dpl, DPL3, idt_entry::flags, idt, idt_entry::offset_ext, idt_entry::offset_hi, idt_entry::offset_lo, idt_entry::p, idt_entry::selector, and x86_idt_gate_user_set().

Referenced by x86_idt_gate_user_set(), and x86_isr_setup().

◆ x86_idt_setup()

void x86_idt_setup ( void )

Loads the IDT on the running CPU.

Definition at line 82 of file idt.c.

References idt_ptr::base, idt, idt_pointer, idt_ptr::limit, x86_idt_setup(), and x86_lidt().

Referenced by x86_ap_start(), x86_cpu_init(), and x86_idt_setup().

Variable Documentation

◆ idt

struct idt_entry idt[256]
static

◆ idt_pointer

struct idt_ptr idt_pointer

Referenced by x86_idt_setup().