summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/machdep.c18
-rw-r--r--sys/include/sys/machdep.h1
-rw-r--r--sys/kern/init_main.c1
3 files changed, 16 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();
-
}
diff --git a/sys/include/sys/machdep.h b/sys/include/sys/machdep.h
index c337b17..f494f73 100644
--- a/sys/include/sys/machdep.h
+++ b/sys/include/sys/machdep.h
@@ -36,6 +36,7 @@
#if defined(_KERNEL)
__weak void processor_init(void);
+__weak void pre_init(void);
__weak void processor_halt(void);
#endif /* defined(_KERNEL) */
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 8158bd0..8b8e431 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -73,6 +73,7 @@ list_timers(void)
void
main(void)
{
+ pre_init();
tty_init();
syslog_init();
PRINT_LOGO();