-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterrupts.h
More file actions
111 lines (92 loc) · 4.01 KB
/
interrupts.h
File metadata and controls
111 lines (92 loc) · 4.01 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef __INTERRUPTMANAGER_H
#define __INTERRUPTMANAGER_H
#include "gdt.h"
#include "types.h"
#include "port.h"
class InterruptManager;
class InterruptHandler
{
protected:
uint8_t InterruptNumber;
InterruptManager* interruptManager;
InterruptHandler(InterruptManager* interruptManager, uint8_t InterruptNumber);
~InterruptHandler();
public:
virtual uint32_t HandleInterrupt(uint32_t esp);
};
class InterruptManager
{
friend class InterruptHandler;
protected:
static InterruptManager* ActiveInterruptManager;
InterruptHandler* handlers[256];
struct GateDescriptor
{
uint16_t handlerAddressLowBits;
uint16_t gdt_codeSegmentSelector;
uint8_t reserved;
uint8_t access;
uint16_t handlerAddressHighBits;
} __attribute__((packed));
static GateDescriptor interruptDescriptorTable[256];
struct InterruptDescriptorTablePointer
{
uint16_t size;
uint32_t base;
} __attribute__((packed));
uint16_t hardwareInterruptOffset;
static void SetInterruptDescriptorTableEntry(uint8_t interrupt,
uint16_t codeSegmentSelectorOffset, void (*handler)(),
uint8_t DescriptorPrivilegeLevel, uint8_t DescriptorType);
static void InterruptIgnore();
static void HandleInterruptRequest0x00();
static void HandleInterruptRequest0x01();
static void HandleInterruptRequest0x02();
static void HandleInterruptRequest0x03();
static void HandleInterruptRequest0x04();
static void HandleInterruptRequest0x05();
static void HandleInterruptRequest0x06();
static void HandleInterruptRequest0x07();
static void HandleInterruptRequest0x08();
static void HandleInterruptRequest0x09();
static void HandleInterruptRequest0x0A();
static void HandleInterruptRequest0x0B();
static void HandleInterruptRequest0x0C();
static void HandleInterruptRequest0x0D();
static void HandleInterruptRequest0x0E();
static void HandleInterruptRequest0x0F();
static void HandleInterruptRequest0x31();
static void HandleException0x00();
static void HandleException0x01();
static void HandleException0x02();
static void HandleException0x03();
static void HandleException0x04();
static void HandleException0x05();
static void HandleException0x06();
static void HandleException0x07();
static void HandleException0x08();
static void HandleException0x09();
static void HandleException0x0A();
static void HandleException0x0B();
static void HandleException0x0C();
static void HandleException0x0D();
static void HandleException0x0E();
static void HandleException0x0F();
static void HandleException0x10();
static void HandleException0x11();
static void HandleException0x12();
static void HandleException0x13();
static uint32_t HandleInterrupt(uint8_t interrupt, uint32_t esp);
uint32_t DoHandleInterrupt(uint8_t interrupt, uint32_t esp);
Port8BitSlow programmableInterruptControllerMasterCommandPort;
Port8BitSlow programmableInterruptControllerMasterDataPort;
Port8BitSlow programmableInterruptControllerSlaveCommandPort;
Port8BitSlow programmableInterruptControllerSlaveDataPort;
public:
InterruptManager(uint16_t hardwareInterruptOffset, GlobalDescriptorTable* globalDescriptorTable);
~InterruptManager();
uint16_t HardwareInterruptOffset();
void Activate();
void Deactivate();
};
#endif