-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel.idt.d
96 lines (87 loc) · 1.63 KB
/
kernel.idt.d
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright (C) 2021 Mateus de Lima Oliveira
module kernel.idt;
extern(C)
struct IDTDescr {
align (1):
ushort offset_1; // offset bits 0..15
ushort selector; // a code segment selector in GDT or LDT
ubyte zero; // unused, set to 0
ubyte type_attr; // type and attributes, see below
ushort offset_2; // offset bits 16..31
};
extern(C)
struct IDTPointer {
align (1):
ushort limit;
uint base;
}
extern(C) {
@safe void load_idt(scope IDTPointer *p);
@safe void EnableInterrupts();
@safe void DisableInterrupts();
}
extern(C) {
//extern(C) extern __gshared IDTDescr[256] idt;
static __gshared IDTDescr[256] idt;
static __gshared IDTPointer idtPtr;
}
extern(C) {
void isr0();
void isr1();
void isr2();
void isr3();
void isr4();
void isr5();
void isr6();
void isr7();
void isr8();
void isr9();
void isr10();
void isr11();
void isr12();
void isr13();
void isr14();
void isr15();
void isr16();
void isr17();
void isr18();
void isr19();
void isr20();
void isr21();
void isr22();
void isr23();
void isr24();
void isr25();
void isr26();
void isr27();
void isr28();
void isr29();
void isr30();
void isr31();
void isr32();
void isr33();
void isr34();
void isr35();
void isr36();
void isr37();
void isr38();
void isr39();
void isr40();
void isr41();
void isr42();
void isr43();
void isr44();
void isr45();
void isr46();
void isr47();
void isr128();
}
extern(C)
void SetIDTGate(ubyte num, uint base, ushort selector, ubyte flags)
{
idt[num].offset_1 = base & 0xFFFF;
idt[num].offset_2 = (base >> 16) & 0xFFFF;
idt[num].selector = selector;
idt[num].zero = 0;
idt[num].type_attr = flags | 0x60;
}