-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathirq.C
executable file
·60 lines (46 loc) · 1.77 KB
/
irq.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
56
57
58
59
60
/*
File: irq.C
Author: R. Bettati
Department of Computer Science
Texas A&M University
Date : 09/03/05
This code borrows heavily from Brandon Friesen's the code in Brandon
Friesen's OS Development Tutorial.
*/
/*--------------------------------------------------------------------------*/
/* DEFINES */
/*--------------------------------------------------------------------------*/
#define IRQ_BASE 32
/*--------------------------------------------------------------------------*/
/* INCLUDES */
/*--------------------------------------------------------------------------*/
#include "utils.H"
#include "irq.H"
/*--------------------------------------------------------------------------*/
/* LOCAL FUNCTIONS . */
/*--------------------------------------------------------------------------*/
/* Normally, IRQs 0 to 7 are mapped to IDT entries 8 to 15.
For a variety of reasons it is a good idea to re-map these
IRQs to different locations
We send a sequence of commands to the PICs - 8259's - in order
to have IRQ0 to IRQ15 be remapped to IDT entries 32 to 47.
*/
static void irq_remap()
{
outportb(0x20, 0x11);
outportb(0xA0, 0x11);
outportb(0x21, 0x20);
outportb(0xA1, 0x28);
outportb(0x21, 0x04);
outportb(0xA1, 0x02);
outportb(0x21, 0x01);
outportb(0xA1, 0x01);
outportb(0x21, 0x0);
outportb(0xA1, 0x0);
}
/*--------------------------------------------------------------------------*/
/* EXPORTED FUNCTIONS . */
/*--------------------------------------------------------------------------*/
void IRQ::init() {
irq_remap();
}