summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/interrupts/irq.c
diff options
context:
space:
mode:
authordzwdz2022-08-03 21:34:58 +0200
committerdzwdz2022-08-03 21:34:58 +0200
commit4a844820866094ff7d57435a16b7c23a9126814d (patch)
treea13643ddf95a4b310e9d615857bb0eed1038cd28 /src/kernel/arch/amd64/interrupts/irq.c
parentc510603cedcd3e39681ae38560f62adc9d70a53b (diff)
amd64: cleanup the irq code, #define the magic numbers
Diffstat (limited to 'src/kernel/arch/amd64/interrupts/irq.c')
-rw-r--r--src/kernel/arch/amd64/interrupts/irq.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/kernel/arch/amd64/interrupts/irq.c b/src/kernel/arch/amd64/interrupts/irq.c
index 74bc48c..b5e9255 100644
--- a/src/kernel/arch/amd64/interrupts/irq.c
+++ b/src/kernel/arch/amd64/interrupts/irq.c
@@ -6,21 +6,20 @@ static const int PIC1 = 0x20;
static const int PIC2 = 0xA0;
void irq_init(void) {
- port_out8(PIC1, 0x11); /* start init sequence */
+ port_out8(PIC1, 0x11); /* start init sequence */
port_out8(PIC2, 0x11);
- port_out8(PIC1+1, 0x20); /* interrupt offsets */
- port_out8(PIC2+1, 0x30);
+ port_out8(PIC1+1, IRQ_IBASE); /* interrupt offsets */
+ port_out8(PIC2+1, IRQ_IBASE + 8);
- port_out8(PIC1+1, 0x4); /* just look at the osdev wiki lol */
+ port_out8(PIC1+1, 0x4);
port_out8(PIC2+1, 0x2);
-
- port_out8(PIC1+1, 0x1); /* 8086 mode */
+ port_out8(PIC1+1, 0x1);
port_out8(PIC2+1, 0x1);
uint8_t mask = 0xff;
- mask &= ~(1 << 1); // keyboard
- mask &= ~(1 << 4); // COM1
+ mask &= ~(1 << IRQ_PS2);
+ mask &= ~(1 << IRQ_COM1);
port_out8(PIC1+1, mask);
port_out8(PIC2+1, 0xff);