sched: thread: add cpu context pointer usable during interrupts and syscalls
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <kernel/panic.h>
|
||||
#include <kernel/sched.h>
|
||||
#include <kernel/syscall.h>
|
||||
#include <kernel/thread.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define MAX_ISR_HANDLERS 16
|
||||
@@ -166,6 +167,12 @@ int idt_load(struct idt_ptr *ptr)
|
||||
|
||||
void isr_dispatch(struct ml_cpu_context *regs)
|
||||
{
|
||||
struct thread *thr = get_current_thread();
|
||||
if (thr) {
|
||||
thr->tr_irqctx = regs;
|
||||
put_current_thread(thr);
|
||||
}
|
||||
|
||||
int_hook h = isr_handlers[regs->int_no];
|
||||
if (h) {
|
||||
h(regs);
|
||||
@@ -188,6 +195,13 @@ void irq_dispatch(struct ml_cpu_context *regs)
|
||||
end_charge_period();
|
||||
|
||||
irq_ack(regs->int_no);
|
||||
|
||||
struct thread *thr = get_current_thread();
|
||||
if (thr) {
|
||||
thr->tr_irqctx = regs;
|
||||
put_current_thread(thr);
|
||||
}
|
||||
|
||||
struct queue *hooks = &irq_hooks[regs->int_no - IRQ0];
|
||||
queue_foreach(struct irq_hook, hook, hooks, irq_entry)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user