aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2023-12-13 12:38:19 -0500
committerIan Moffett <ian@osmora.org>2023-12-13 12:38:19 -0500
commit8c4d369672ef824237895b42c9a1ab93fb32cc2e (patch)
treea8d7400b48a5b267f4f72733a6ec7540cf6da640
parent951b20149d1cc4954863a76469ce152c1f453958 (diff)
kernel/amd64: machdep: Cleanup processor_init()
This commit cleans up processor_init() by tidying up and reordering calls to ensure things will be set up in the correct order. Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/arch/amd64/machdep.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/arch/amd64/machdep.c b/sys/arch/amd64/machdep.c
index 9a81c25..66778a6 100644
--- a/sys/arch/amd64/machdep.c
+++ b/sys/arch/amd64/machdep.c
@@ -86,23 +86,24 @@ processor_init(void)
struct cpu_info *cur_cpu = NULL;
+ cur_cpu = this_cpu();
+
interrupts_init();
gdt_load(&g_gdtr);
+ CPU_INFO_LOCK(cur_cpu);
+ init_tss(cur_cpu);
+ CPU_INFO_UNLOCK(cur_cpu);
+
if (!__TEST(init_flags, INIT_FLAG_IOAPIC)) {
init_flags |= INIT_FLAG_IOAPIC;
ioapic_init();
}
lapic_init(); /* Per core */
- cur_cpu = this_cpu();
-
- CPU_INFO_LOCK(cur_cpu);
- cur_cpu->tss = NULL;
- init_tss(cur_cpu);
- CPU_INFO_UNLOCK(cur_cpu);
/* Use spectre mitigation if enabled */
if (try_spectre_mitigate != NULL)
try_spectre_mitigate();
+
}