Change order of sending EOI to PIC, works with -enable-kvm now
This commit is contained in:
@ -19,14 +19,14 @@
|
||||
|
||||
typedef struct IntrHandler {
|
||||
struct IntrHandler *next;
|
||||
int (*fn)(IntrStackFrame *frame);
|
||||
void (*fn)(IntrStackFrame *frame);
|
||||
int irq;
|
||||
} IntrHandler;
|
||||
|
||||
IntrHandler *INTR_HANDLERS = NULL;
|
||||
SpinLock INTR_HANDLERS_SPINLOCK;
|
||||
|
||||
void intr_attchhandler(int (*fn)(IntrStackFrame *frame), int irq) {
|
||||
void intr_attchhandler(void (*fn)(IntrStackFrame *frame), int irq) {
|
||||
IntrHandler *ih = dlmalloc(sizeof(*ih));
|
||||
ih->fn = fn;
|
||||
ih->irq = irq;
|
||||
@ -246,13 +246,13 @@ 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);
|
||||
}
|
||||
}
|
||||
intr_pic_eoi();
|
||||
} else if (frame->trapnum == 0x80) {
|
||||
intr_syscalldispatch(frame);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user