Handle ps2 keyboard, no APIC for now
This commit is contained in:
@ -8,11 +8,11 @@
|
||||
#include "kprintf.h"
|
||||
#include "compiler/attr.h"
|
||||
#include "pic.h"
|
||||
#include "apic.h"
|
||||
#include "pit.h"
|
||||
#include "proc/proc.h"
|
||||
#include "syscall/syscall.h"
|
||||
#include "errors.h"
|
||||
#include "drivers/ps2kb/ps2kb.h"
|
||||
|
||||
void hal_intr_disable(void) {
|
||||
asm volatile("cli");
|
||||
@ -172,6 +172,13 @@ void hal_syscalldispatch(IntrStackFrame *frame) {
|
||||
}
|
||||
}
|
||||
|
||||
void intr_eoi(uint8_t irq) {
|
||||
if (irq >= 8) {
|
||||
io_out8(PIC2_CMD, PIC_EOI);
|
||||
}
|
||||
io_out8(PIC1_CMD, PIC_EOI);
|
||||
}
|
||||
|
||||
void intr_handleintr(IntrStackFrame *frame) {
|
||||
if (frame->trapnum <= 31) {
|
||||
kprintf("ERROR %s, 0x%lX\n", exceptions[frame->trapnum], frame->errnum);
|
||||
@ -183,14 +190,17 @@ void intr_handleintr(IntrStackFrame *frame) {
|
||||
}
|
||||
hal_hang();
|
||||
} else if (frame->trapnum >= 32 && frame->trapnum <= 47) {
|
||||
if (frame->trapnum == INTR_TIMER) {
|
||||
io_out8(PIC2_CMD, 0x20);
|
||||
PIT_TICKS++;
|
||||
switch (frame->trapnum) {
|
||||
case INTR_IRQBASE+0:
|
||||
PIT_TICKS++;
|
||||
intr_eoi(frame->trapnum - INTR_IRQBASE);
|
||||
proc_sched((void *)frame);
|
||||
break;
|
||||
case INTR_IRQBASE+1:
|
||||
ps2kb_intr();
|
||||
intr_eoi(frame->trapnum - INTR_IRQBASE);
|
||||
break;
|
||||
}
|
||||
io_out8(PIC1_CMD, 0x20);
|
||||
lapic_write(LAPIC_EOI, 0x00);
|
||||
|
||||
proc_sched((void *)frame);
|
||||
} else if (frame->trapnum == 0x80) {
|
||||
hal_syscalldispatch(frame);
|
||||
}
|
||||
|
Reference in New Issue
Block a user