summaryrefslogtreecommitdiff
path: root/kernel/cpu
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-05-05 16:51:59 +0200
committerAnton Kling <anton@kling.gg>2024-05-05 16:51:59 +0200
commit850596bd3374de20dd7b71bac27d351a975f772a (patch)
tree47ec2edf0fbce6a0f7c140a3358f908c053b35dc /kernel/cpu
parentc99d6608825c02783a58cddd930794cd0d35ab03 (diff)
Kernel: Clear more interrupts for mouse driver
I am not sure why the mouse requires interrupt line 2 to be cleared.
Diffstat (limited to 'kernel/cpu')
-rw-r--r--kernel/cpu/idt.c18
-rw-r--r--kernel/cpu/idt.h2
2 files changed, 11 insertions, 9 deletions
diff --git a/kernel/cpu/idt.c b/kernel/cpu/idt.c
index a1f78f9..7ad0be1 100644
--- a/kernel/cpu/idt.c
+++ b/kernel/cpu/idt.c
@@ -171,7 +171,7 @@ void pic_remap(int offset) {
outb(SLAVE_PIC_DATA_PORT, a2);
}
-void irq_set_mask(unsigned char irq_line) {
+void irq_set_mask(u8 irq_line) {
u16 port;
u8 value;
port = (irq_line < 8) ? MASTER_PIC_DATA_PORT : SLAVE_PIC_DATA_PORT;
@@ -182,14 +182,14 @@ void irq_set_mask(unsigned char irq_line) {
outb(port, value);
}
-void IRQ_clear_mask(unsigned char IRQline) {
+void irq_clear_mask(u8 irq_line) {
u16 port;
u8 value;
- port = (IRQline < 8) ? MASTER_PIC_DATA_PORT : SLAVE_PIC_DATA_PORT;
- if (IRQline >= 8) {
- IRQline -= 8;
+ port = (irq_line < 8) ? MASTER_PIC_DATA_PORT : SLAVE_PIC_DATA_PORT;
+ if (irq_line >= 8) {
+ irq_line -= 8;
}
- value = inb(port) & ~(1 << IRQline);
+ value = inb(port) & ~(1 << irq_line);
outb(port, value);
}
@@ -259,8 +259,8 @@ void install_handler(interrupt_handler handler_function, u16 type_attribute,
format_descriptor((u32)isr_list[entry], KERNEL_CODE_SEGMENT_OFFSET,
type_attribute, &IDT_Entry[entry]);
list_of_handlers[entry] = (interrupt_handler)handler_function;
- if (entry >= 0x20 && entry < 0x20 + 0xA) {
- IRQ_clear_mask(entry - 0x20);
+ if (entry >= 0x20 && entry <= 0x30) {
+ irq_clear_mask(entry - 0x20);
}
}
@@ -268,7 +268,7 @@ void idt_init(void) {
memset(list_of_handlers, 0, sizeof(void *) * 256);
pic_remap(0x20);
- for (int i = 0; i < 16; i++) {
+ for (int i = 0; i < 0x10; i++) {
irq_set_mask(i);
}
diff --git a/kernel/cpu/idt.h b/kernel/cpu/idt.h
index d866659..06e63ba 100644
--- a/kernel/cpu/idt.h
+++ b/kernel/cpu/idt.h
@@ -326,4 +326,6 @@ __attribute__((no_caller_saved_registers)) void EOI(unsigned char irq);
typedef void (*interrupt_handler)(reg_t *);
void install_handler(interrupt_handler handler_function, u16 type_attribute,
u8 entry);
+void irq_set_mask(u8 irq_line);
+void irq_clear_mask(u8 irq_line);
#endif