aboutsummaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-01-10 18:58:15 -0500
committerIan Moffett <ian@osmora.org>2024-01-10 18:58:15 -0500
commit3de50c965376fa47e664f2f2701b339765763767 (patch)
tree38cf5ce8f222c4a3a646e7ca3d401456f5032a79 /sys/arch
parenta4e6328b6e91d582c4579554c293995e3d4f8851 (diff)
kernel/amd64: machdep: Add pre_init()
This commit introduces a pre_init() function for setting up things that processor_init() may depend on Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/machdep.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 1000ebf..ec1d48f 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -80,6 +80,20 @@ processor_halt(void)
__ASMV("cli; hlt");
}
+/*
+ * Things set up before processor_init() call...
+ */
+void
+pre_init(void)
+{
+ /*
+ * These are critical things that need to be set up as soon as possible
+ * way before the processor_init() call.
+ */
+ interrupts_init();
+ gdt_load(&g_gdtr);
+}
+
void
processor_init(void)
{
@@ -88,9 +102,6 @@ processor_init(void)
struct cpu_info *cur_cpu = this_cpu();
- interrupts_init();
- gdt_load(&g_gdtr);
-
CPU_INFO_LOCK(cur_cpu);
init_tss(cur_cpu);
@@ -114,5 +125,4 @@ processor_init(void)
/* Use spectre mitigation if enabled */
if (try_spectre_mitigate != NULL)
try_spectre_mitigate();
-
}