aboutsummaryrefslogtreecommitdiff
path: root/sys/arch/amd64/machdep.c
diff options
context:
space:
mode:
authorsigsegv7 <ian@vegaa.systems>2023-09-14 00:22:21 -0400
committersigsegv7 <ian@vegaa.systems>2023-09-14 00:22:21 -0400
commit3a72a201448fe16657a14cfc5916b672df94acf0 (patch)
treeff0f71e02fd2791b85f7791ab6ec98a0c58bf743 /sys/arch/amd64/machdep.c
parentec0809d472d0f79420b7e0cebc32a01b93aeff39 (diff)
kernel/amd64: Introduce initial I/O APIC support
Signed-off-by: sigsegv7 <ian@vegaa.systems>
Diffstat (limited to 'sys/arch/amd64/machdep.c')
-rw-r--r--sys/arch/amd64/machdep.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/arch/amd64/machdep.c b/sys/arch/amd64/machdep.c
index 4da73ae..0b52792 100644
--- a/sys/arch/amd64/machdep.c
+++ b/sys/arch/amd64/machdep.c
@@ -32,8 +32,10 @@
#include <machine/trap.h>
#include <machine/idt.h>
#include <machine/gdt.h>
+#include <machine/ioapic.h>
#define ISR(func) ((uintptr_t)func)
+#define INIT_FLAG_IOAPIC 0x00000001U
static void
interrupts_init(void)
@@ -61,6 +63,14 @@ processor_halt(void)
void
processor_init(void)
{
+ /* Indicates what doesn't need to be init anymore */
+ static uint8_t init_flags = 0;
+
+ if (!__TEST(init_flags, INIT_FLAG_IOAPIC)) {
+ init_flags |= INIT_FLAG_IOAPIC;
+ ioapic_init();
+ }
+
gdt_load(&g_gdtr);
interrupts_init();
}