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

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

#define IDT_MAX_ENTRY 200
#define IDT_INT_GATE 0x8E00
#define IDT_TRAP_GATE 0xEF00

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