From 03a134445aded2386fb474cc4cf342f7580d2daa Mon Sep 17 00:00:00 2001 From: Matheus Date: Thu, 27 Apr 2023 23:34:32 -0300 Subject: [PATCH] interrupt: change how interrupts are handled on the general isr --- kernel-src/sys/interrupt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel-src/sys/interrupt.c b/kernel-src/sys/interrupt.c index 581f2400..4efbc180 100644 --- a/kernel-src/sys/interrupt.c +++ b/kernel-src/sys/interrupt.c @@ -6,14 +6,16 @@ void interrupt_isr(int vec, context_t *ctx) { isr_t *isr = &_cpu()->isr[vec]; + _cpu()->intstatus = false; + if (isr->func == NULL) _panic("Unregistered interrupt", ctx); if (_cpu()->ipl > isr->priority) { long oldipl = interrupt_setipl(isr->priority); - bool oldint = _cpu()->intstatus; + isr->func(isr, ctx); - _cpu()->intstatus = oldint; + interrupt_setipl(oldipl); } else { isr->pending = true; @@ -21,6 +23,8 @@ void interrupt_isr(int vec, context_t *ctx) { if (isr->eoi) isr->eoi(isr); + + // TODO context interrupt checking for struct } void interrupt_register(int vector, void (*func)(isr_t *self, context_t *ctx), void (*eoi)(isr_t *self), long priority) {