Fix PIC, add small delays when initializing

This commit is contained in:
2025-11-18 23:27:49 +01:00
parent 638214a0e2
commit 28c95303e9
8 changed files with 51 additions and 24 deletions

View File

@ -186,7 +186,6 @@ void intr_init(void) {
idt_init();
intr_pic_init();
intr_pit_init();
intr_disable();
}
void intr_dumpframe(IntrStackFrame *frame) {
@ -246,12 +245,18 @@ void intr_handleintr(IntrStackFrame *frame) {
cpu_hang();
}
} else if (frame->trapnum >= 32 && frame->trapnum <= 47) {
intr_pic_eoi();
IntrHandler *ih, *ihtmp;
LL_FOREACH_SAFE(INTR_HANDLERS, ih, ihtmp) {
if ((uint64_t)ih->irq == frame->trapnum) {
ih->fn(frame);
if (frame->trapnum == INTR_IRQBASE+0) {
PIT_TICKS++;
intr_pic_eoi(frame->trapnum >= 40);
proc_sched((void *)frame);
} else {
IntrHandler *ih, *ihtmp;
LL_FOREACH_SAFE(INTR_HANDLERS, ih, ihtmp) {
if ((uint64_t)ih->irq == frame->trapnum) {
ih->fn(frame);
}
}
intr_pic_eoi(frame->trapnum >= 40);
}
} else if (frame->trapnum == 0x80) {
intr_syscalldispatch(frame);