aboutsummaryrefslogtreecommitdiff
path: root/src/core/idt.h
blob: aceb064209c8fdefa2d58aba74871801ef0cfc61 (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
37
#ifndef IDT_H
#define IDT_H

#include "core/types.h"
#include "core/mem.h"

#define IDT_MAX_ENTRY 200
#define IDT_INT_GATE 0x0E00
#define IDT_TRAP_GATE 0x0F00
#define IDT_P 0x8000
#define IDT_PRVL_0 0x0000
#define IDT_PRVL_1 0x2000
#define IDT_PRVL_2 0x4000
#define IDT_PRVL_3 0x6000

typedef struct IDT_ENTRY {
    u16 segment;
    u32 offset;
    u16 type;
} IDT_ENTRY;

struct IDT_REGISTER {
    u16 limit;
    u32 base;
} __attribute__((packed));

/**
 * Copy IDT into memory and load it
 */
void idt_init();

/**
 * Write an IDT entry into memory
 */
void idt_write_entry(IDT_ENTRY entry,int id);

#endif