diff options
author | dzwdz | 2022-08-07 22:07:27 +0200 |
---|---|---|
committer | dzwdz | 2022-08-07 22:07:27 +0200 |
commit | 9a43ead118ec1506848bad9d2bcddfb0fd458552 (patch) | |
tree | 295103e04a01e0eaa319d0984c9a74bb50956c4c /src/kernel/arch/amd64/interrupts | |
parent | fbbe8a1cb4c421e9658c5009ecfab6845137587b (diff) |
kernel: ps2 mouse support
Diffstat (limited to 'src/kernel/arch/amd64/interrupts')
-rw-r--r-- | src/kernel/arch/amd64/interrupts/irq.c | 10 | ||||
-rw-r--r-- | src/kernel/arch/amd64/interrupts/irq.h | 3 | ||||
-rw-r--r-- | src/kernel/arch/amd64/interrupts/isr.c | 5 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/kernel/arch/amd64/interrupts/irq.c b/src/kernel/arch/amd64/interrupts/irq.c index 9872ec7..1760825 100644 --- a/src/kernel/arch/amd64/interrupts/irq.c +++ b/src/kernel/arch/amd64/interrupts/irq.c @@ -23,13 +23,15 @@ void irq_init(void) { port_out8(PIC1+1, 0x1); port_out8(PIC2+1, 0x1); - uint8_t mask = 0xff; + uint16_t mask = 0xffff; mask &= ~(1 << IRQ_PIT); - mask &= ~(1 << IRQ_PS2); + mask &= ~(1 << 2); // cascade + mask &= ~(1 << IRQ_PS2KB); mask &= ~(1 << IRQ_COM1); + mask &= ~(1 << IRQ_PS2MOUSE); - port_out8(PIC1+1, mask); - port_out8(PIC2+1, 0xff); + port_out8(PIC1+1, mask & 0xff); + port_out8(PIC2+1, (mask >> 8) & 0xff); pit_init(); } diff --git a/src/kernel/arch/amd64/interrupts/irq.h b/src/kernel/arch/amd64/interrupts/irq.h index 2a4b12d..3243224 100644 --- a/src/kernel/arch/amd64/interrupts/irq.h +++ b/src/kernel/arch/amd64/interrupts/irq.h @@ -4,8 +4,9 @@ #define IRQ_IBASE 0x20 #define IRQ_PIT 0 -#define IRQ_PS2 1 +#define IRQ_PS2KB 1 #define IRQ_COM1 4 +#define IRQ_PS2MOUSE 12 void irq_init(void); void irq_eoi(uint8_t line); diff --git a/src/kernel/arch/amd64/interrupts/isr.c b/src/kernel/arch/amd64/interrupts/isr.c index 0bfd865..d1c2b26 100644 --- a/src/kernel/arch/amd64/interrupts/isr.c +++ b/src/kernel/arch/amd64/interrupts/isr.c @@ -34,9 +34,10 @@ void isr_stage3(int interrupt, uint64_t *stackframe) { irq_eoi(IRQ_PIT); return; - case IRQ_IBASE + IRQ_PS2: + case IRQ_IBASE + IRQ_PS2KB: + case IRQ_IBASE + IRQ_PS2MOUSE: ps2_irq(); - irq_eoi(IRQ_PS2); + irq_eoi(interrupt - IRQ_IBASE); return; case IRQ_IBASE + IRQ_COM1: |