mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
interrupt: change how interrupts are handled on the general isr
This commit is contained in:
@@ -6,14 +6,16 @@
|
|||||||
|
|
||||||
void interrupt_isr(int vec, context_t *ctx) {
|
void interrupt_isr(int vec, context_t *ctx) {
|
||||||
isr_t *isr = &_cpu()->isr[vec];
|
isr_t *isr = &_cpu()->isr[vec];
|
||||||
|
_cpu()->intstatus = false;
|
||||||
|
|
||||||
if (isr->func == NULL)
|
if (isr->func == NULL)
|
||||||
_panic("Unregistered interrupt", ctx);
|
_panic("Unregistered interrupt", ctx);
|
||||||
|
|
||||||
if (_cpu()->ipl > isr->priority) {
|
if (_cpu()->ipl > isr->priority) {
|
||||||
long oldipl = interrupt_setipl(isr->priority);
|
long oldipl = interrupt_setipl(isr->priority);
|
||||||
bool oldint = _cpu()->intstatus;
|
|
||||||
isr->func(isr, ctx);
|
isr->func(isr, ctx);
|
||||||
_cpu()->intstatus = oldint;
|
|
||||||
interrupt_setipl(oldipl);
|
interrupt_setipl(oldipl);
|
||||||
} else {
|
} else {
|
||||||
isr->pending = true;
|
isr->pending = true;
|
||||||
@@ -21,6 +23,8 @@ void interrupt_isr(int vec, context_t *ctx) {
|
|||||||
|
|
||||||
if (isr->eoi)
|
if (isr->eoi)
|
||||||
isr->eoi(isr);
|
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) {
|
void interrupt_register(int vector, void (*func)(isr_t *self, context_t *ctx), void (*eoi)(isr_t *self), long priority) {
|
||||||
|
|||||||
Reference in New Issue
Block a user