-
Notifications
You must be signed in to change notification settings - Fork 0
/
idt.h
42 lines (35 loc) · 915 Bytes
/
idt.h
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
38
39
40
41
42
#ifndef KERNEL_IDT_H
#define KERNEL_IDT_H
#include "base.h"
#include "gdt.h"
struct idt_gate
{
uint16_t base_low;
uint16_t selector;
uint8_t reserved;
uint8_t access;
uint16_t base_high;
}__attribute__((packed));
struct idt_pointer
{
uint16_t limit;
uint32_t base;
}__attribute__((packed));
struct idt_info
{
uint32_t gs, fs, es, ds;
uint32_t edi, esi, ebp, esp;
uint32_t ebx, edx, ecx, eax;
uint32_t code, error;
uint32_t eip, cs, eflags, reeip, ress;
}__attribute__((packed));
typedef void (*irq_handler_impl)(struct idt_info*);
extern void idt_set_gate(int i, uint16_t selector, uint32_t addr, uint8_t access);
extern void idt_load();
extern void idt_install();
extern void isrs_install();
extern void fault_handler(struct idt_info* ptr);
extern void irq_handler(struct idt_info *ptr);
extern void irq_install();
extern void irq_set_handler(int i, void (*handler)(struct idt_info*));
#endif