Fix interrupts not working with -enable-kvm

This commit is contained in:
2025-11-18 14:20:46 +01:00
parent edcdaa5c60
commit 2a0dddead3
5 changed files with 5 additions and 11 deletions

View File

@ -165,7 +165,7 @@ int ps2kbdev_intr(IntrStackFrame *frame) {
ipc_mbuspublish("ps2kb", &b); ipc_mbuspublish("ps2kb", &b);
} }
return INTR_OK; return 0;
} }
void ps2kbdev_init(void) { void ps2kbdev_init(void) {

View File

@ -246,16 +246,13 @@ void intr_handleintr(IntrStackFrame *frame) {
cpu_hang(); cpu_hang();
} }
} else if (frame->trapnum >= 32 && frame->trapnum <= 47) { } else if (frame->trapnum >= 32 && frame->trapnum <= 47) {
bool send = true;
IntrHandler *ih, *ihtmp; IntrHandler *ih, *ihtmp;
LL_FOREACH_SAFE(INTR_HANDLERS, ih, ihtmp) { LL_FOREACH_SAFE(INTR_HANDLERS, ih, ihtmp) {
if ((uint64_t)ih->irq == frame->trapnum) { if ((uint64_t)ih->irq == frame->trapnum) {
if (ih->fn(frame) == INTR_NOEOI) { ih->fn(frame);
send = false;
}
} }
} }
if (send) intr_pic_eoi(); intr_pic_eoi();
} else if (frame->trapnum == 0x80) { } else if (frame->trapnum == 0x80) {
intr_syscalldispatch(frame); intr_syscalldispatch(frame);
} }

View File

@ -7,9 +7,6 @@
#define INTR_IRQBASE 0x20 #define INTR_IRQBASE 0x20
#define INTR_OK 1
#define INTR_NOEOI 2
typedef struct { typedef struct {
uint64_t r15; uint64_t r15;
uint64_t r14; uint64_t r14;

View File

@ -33,7 +33,7 @@ void intr_pit_wait(uint32_t ms) {
int intr_pit_intr(IntrStackFrame *frame) { int intr_pit_intr(IntrStackFrame *frame) {
PIT_TICKS++; PIT_TICKS++;
return INTR_OK; return 0;
} }
void intr_pit_init(void) { void intr_pit_init(void) {

View File

@ -256,7 +256,7 @@ void proc_killself(void) {
int proc_intr(IntrStackFrame *frame) { int proc_intr(IntrStackFrame *frame) {
intr_pic_eoi(); intr_pic_eoi();
proc_sched(frame); proc_sched(frame);
return INTR_NOEOI; return 0;
} }
void proc_init(void) { void proc_init(void) {