blob: 86a685ff223417ae4af4332f0599766f5c0b6495 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#pragma once
#include <stdint.h>
#define IDT_SIZE 256
#define IDT_INTERRUPTS 256
struct IdtEntry {
uint16_t isr_low;
uint16_t kernel_cs;
uint8_t _reserved;
uint8_t attributes;
uint16_t isr_high;
} __attribute__((packed));
struct Idtr {
uint16_t limit;
uint32_t base;
} __attribute__((packed));
enum IDTFlags {
IDT_FLAG_GATE_TASK = 0x5,
IDT_FLAG_GATE_16BIT_INT = 0x6,
IDT_FLAG_GATE_16BIT_TRAP = 0x7,
IDT_FLAG_GATE_32BIT_INT = 0xE,
IDT_FLAG_GATE_32BIT_TRAP = 0xF,
IDT_FLAG_RING0 = (0 << 5),
IDT_FLAG_RING1 = (1 << 5),
IDT_FLAG_RING2 = (2 << 5),
IDT_FLAG_RING3 = (3 << 5),
IDT_FLAG_PRESENT = 0x80,
};
void idt_init(void);
|