-
Notifications
You must be signed in to change notification settings - Fork 0
/
isr.c
55 lines (43 loc) · 1.31 KB
/
isr.c
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
/*------------------------------------------------------------------------------
//
// High level interrupt handler
// (c) maisvendoo, 06.07.2013
//
//----------------------------------------------------------------------------*/
#include "isr.h"
#include "text_framebuffer.h"
isr_t interrupt_handlers[256];
/*------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------*/
void isr_handler(registers_t regs)
{
if (interrupt_handlers[regs.int_num] != 0)
{
isr_t handler = interrupt_handlers[regs.int_num];
handler(regs);
}
}
/*------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------*/
void irq_handler(registers_t regs)
{
if (regs.int_num >= 40)
{
outb(0xA0, 0x20);
}
outb(0x20, 0x20);
if (interrupt_handlers[regs.int_num] != 0)
{
isr_t handler = interrupt_handlers[regs.int_num];
handler(regs);
}
}
/*------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------*/
void register_interrupt_handler(u8int n, isr_t handler)
{
interrupt_handlers[n] = handler;
}