acpi: add APIC irq ack and legacy vector remapping

This commit is contained in:
2023-03-24 14:21:02 +00:00
parent cb622f5ad4
commit 864362ba82
11 changed files with 286 additions and 49 deletions

View File

@@ -1,5 +1,6 @@
#include <arch/irq.h>
#include <arch/ports.h>
#include <arch/acpi.h>
#include <socks/printk.h>
#include <socks/libc/string.h>
#include <socks/machine/irq.h>
@@ -217,7 +218,7 @@ int idt_init(struct idt_ptr *ptr)
int idt_load(struct idt_ptr *ptr)
{
asm volatile("lidt (%0)" ::"r" (ptr));
__asm__ __volatile__("lidt (%0)" ::"r" (ptr));
return 0;
}
@@ -231,16 +232,11 @@ void isr_dispatch(struct cpu_context *regs)
void irq_dispatch(struct cpu_context *regs)
{
if (regs->int_no >= 40) {
outportb(0xA0, 0x20);
}
outportb(0x20, 0x20);
queue_t *hooks = &irq_hooks[regs->int_no - IRQ0];
queue_foreach(irq_hook_t, hook, hooks, irq_entry) {
hook->irq_callback();
}
irq_ack(regs->int_no);
queue_t *hooks = &irq_hooks[regs->int_no - IRQ0];
queue_foreach(irq_hook_t, hook, hooks, irq_entry) {
hook->irq_callback();
}
}
void syscall_dispatch(struct cpu_context *regs)
@@ -248,16 +244,6 @@ void syscall_dispatch(struct cpu_context *regs)
}
void ml_int_enable()
{
asm volatile("sti");
}
void ml_int_disable()
{
asm volatile("cli");
}
void hook_irq(irq_vector_t vec, irq_hook_t *hook)
{
queue_t *hook_queue = &irq_hooks[vec - IRQ0];