summaryrefslogtreecommitdiff
path: root/Kernel/init.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-12-19 18:04:55 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-22 00:02:36 -0800
commitfd3be7ffccc18b92dace3e8f26489b99e0c4cce7 (patch)
tree82221007149e0712dd7682e291a718f590c442d4 /Kernel/init.cpp
parent6c8f1e62db181e2cdede167b0d7353f0eebfbc5c (diff)
downloadserenity-fd3be7ffccc18b92dace3e8f26489b99e0c4cce7.zip
Kernel: Setup APIC AP cores boot environment before init_stage2
Since this range is mapped in already in the kernel page directory, we can initialize it before jumping into the first kernel process which lets us avoid mapping in the range into init_stage2's address space. This brings us half-way to removing the shared bottom 2 MiB mapping in every process, leaving only the Prekernel.
Diffstat (limited to 'Kernel/init.cpp')
-rw-r--r--Kernel/init.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index 700e166752..fee2ec1af9 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -216,6 +216,13 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init(BootInfo const& boot_info)
Scheduler::initialize();
+ if (APIC::initialized() && APIC::the().enabled_processor_count() > 1) {
+ // We must set up the AP boot environment before switching to a kernel process,
+ // as pages below address USER_RANGE_BASE are only accesible through the kernel
+ // page directory.
+ APIC::the().setup_ap_boot_environment();
+ }
+
dmesgln("Starting SerenityOS...");
{