mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 14:08:21 +00:00
interrupt: interrupt_set()
This commit is contained in:
@@ -80,3 +80,11 @@ void arch_idt_reload() {
|
|||||||
for (int i = 0; i < 32; ++i)
|
for (int i = 0; i < 32; ++i)
|
||||||
interrupt_register(i, exceptisr, NULL, 0); // TODO assign priority
|
interrupt_register(i, exceptisr, NULL, 0); // TODO assign priority
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void arch_interrupt_disable() {
|
||||||
|
asm("cli");
|
||||||
|
}
|
||||||
|
|
||||||
|
void arch_interrupt_enable() {
|
||||||
|
asm("sti");
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,5 +24,6 @@ void interrupt_register(int vector, void (*func)(isr_t *self, context_t *ctx), v
|
|||||||
isr_t *interrupt_allocate(void (*func)(isr_t *self, context_t *ctx), void (*eoi)(isr_t *self), long priority);
|
isr_t *interrupt_allocate(void (*func)(isr_t *self, context_t *ctx), void (*eoi)(isr_t *self), long priority);
|
||||||
void interrupt_raiseipl(long newipl);
|
void interrupt_raiseipl(long newipl);
|
||||||
void interrupt_loweripl(long newipl);
|
void interrupt_loweripl(long newipl);
|
||||||
|
bool interrupt_set(bool status);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,8 +6,10 @@
|
|||||||
|
|
||||||
#include <arch/msr.h>
|
#include <arch/msr.h>
|
||||||
#include <arch/ist.h>
|
#include <arch/ist.h>
|
||||||
|
#include <arch/archint.h>
|
||||||
#include <kernel/interrupt.h>
|
#include <kernel/interrupt.h>
|
||||||
#include <kernel/vmm.h>
|
#include <kernel/vmm.h>
|
||||||
|
#include <kernel/timer.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t gdt[7];
|
uint64_t gdt[7];
|
||||||
@@ -16,6 +18,8 @@ typedef struct {
|
|||||||
isr_t isr[MAX_ISR_COUNT];
|
isr_t isr[MAX_ISR_COUNT];
|
||||||
vmmcontext_t *vmmctx;
|
vmmcontext_t *vmmctx;
|
||||||
int acpiid;
|
int acpiid;
|
||||||
|
timer_t *timer;
|
||||||
|
bool intstatus;
|
||||||
} cpu_t;
|
} cpu_t;
|
||||||
|
|
||||||
static inline cpu_t *_cpu() {
|
static inline cpu_t *_cpu() {
|
||||||
|
|||||||
@@ -47,3 +47,16 @@ void interrupt_raiseipl(long newipl) {
|
|||||||
void interrupt_loweripl(long newipl) {
|
void interrupt_loweripl(long newipl) {
|
||||||
__assert(!"Unimplemented");
|
__assert(!"Unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void arch_interrupt_disable();
|
||||||
|
void arch_interrupt_enable();
|
||||||
|
|
||||||
|
bool interrupt_set(bool status) {
|
||||||
|
if (status)
|
||||||
|
arch_interrupt_enable();
|
||||||
|
else
|
||||||
|
arch_interrupt_disable();
|
||||||
|
bool old = _cpu()->intstatus;
|
||||||
|
_cpu()->intstatus = status;
|
||||||
|
return old;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user