summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/interrupts
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/i386/interrupts')
-rw-r--r--src/kernel/arch/i386/interrupts/irq.c21
-rw-r--r--src/kernel/arch/i386/interrupts/isr.c4
2 files changed, 13 insertions, 12 deletions
diff --git a/src/kernel/arch/i386/interrupts/irq.c b/src/kernel/arch/i386/interrupts/irq.c
index cb33bc8..7b8c166 100644
--- a/src/kernel/arch/i386/interrupts/irq.c
+++ b/src/kernel/arch/i386/interrupts/irq.c
@@ -5,27 +5,24 @@
static const int PIC1 = 0x20;
static const int PIC2 = 0xA0;
-static void irq_unmask(uint8_t line) {
- uint16_t pic = line < 8 ? PIC1 : PIC2;
- line &= 7;
-
- port_out8(pic+1, port_in8(pic+1) & ~(1 << line));
-}
-
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(PIC1+1, 0x20); /* interrupt offsets */
port_out8(PIC2+1, 0x30);
- port_out8(PIC1+1, 0x4); /* just look at the osdev wiki lol */
+ port_out8(PIC1+1, 0x4); /* just look at the osdev wiki lol */
port_out8(PIC2+1, 0x2);
- port_out8(PIC1+1, 0x1); /* 8086 mode */
+ port_out8(PIC1+1, 0x1); /* 8086 mode */
port_out8(PIC2+1, 0x1);
- port_out8(PIC1+1, 0xfd); /* mask */
+ uint8_t mask = 0xff;
+ mask &= ~(1 << 1); // keyboard
+ mask &= ~(1 << 4); // COM1
+
+ port_out8(PIC1+1, mask);
port_out8(PIC2+1, 0xff);
}
diff --git a/src/kernel/arch/i386/interrupts/isr.c b/src/kernel/arch/i386/interrupts/isr.c
index 1448f44..cc90fae 100644
--- a/src/kernel/arch/i386/interrupts/isr.c
+++ b/src/kernel/arch/i386/interrupts/isr.c
@@ -24,6 +24,10 @@ void isr_stage3(int interrupt) {
irq_eoi(1);
return;
+ case 0x24:; // COM1 irq
+ irq_eoi(1);
+ return;
+
default:
// TODO check if the exception was in the kernel
process_kill(process_current, interrupt);