summaryrefslogtreecommitdiff
path: root/Kernel/init.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-17 19:59:20 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-17 22:34:26 +0100
commite362b56b4fd73db86eb8bf62baa8963eec0a967b (patch)
tree38ff10b38b7a8f843c436b629cc8184b2e5f0287 /Kernel/init.cpp
parentcee597a728c89c0d7217a646aea84b14b534e200 (diff)
downloadserenity-e362b56b4fd73db86eb8bf62baa8963eec0a967b.zip
Kernel: Move kernel above the 3GB virtual address mark
The kernel and its static data structures are no longer identity-mapped in the bottom 8MB of the address space, but instead move above 3GB. The first 8MB above 3GB are pseudo-identity-mapped to the bottom 8MB of the physical address space. But things don't have to stay this way! Thanks to Jesse who made an earlier attempt at this, it was really easy to get device drivers working once the page tables were in place! :^) Fixes #734.
Diffstat (limited to 'Kernel/init.cpp')
-rw-r--r--Kernel/init.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index 7ba201f434..afea3a27c6 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -229,7 +229,7 @@ extern "C" int __cxa_atexit(void (*)(void*), void*, void*)
extern u32 __stack_chk_guard;
u32 __stack_chk_guard;
-extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
+extern "C" [[noreturn]] void init()
{
// this is only used one time, directly below here. we can't use this part
// of libc at this point in the boot process, or we'd just pull strstr in
@@ -247,7 +247,8 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
// process on live hardware.
//
// note: it must be the first option in the boot cmdline.
- if (multiboot_info_ptr->cmdline && bad_prefix_check(reinterpret_cast<const char*>(multiboot_info_ptr->cmdline), "serial_debug"))
+ u32 cmdline = low_physical_to_virtual(multiboot_info_ptr->cmdline);
+ if (cmdline && bad_prefix_check(reinterpret_cast<const char*>(cmdline), "serial_debug"))
set_serial_debug(true);
detect_cpu_features();
@@ -256,14 +257,16 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
slab_alloc_init();
// must come after kmalloc_init because we use AK_MAKE_ETERNAL in KParams
- new KParams(String(reinterpret_cast<const char*>(multiboot_info_ptr->cmdline)));
+ new KParams(String(reinterpret_cast<const char*>(cmdline)));
bool text_debug = KParams::the().has("text_debug");
bool complete_acpi_disable = KParams::the().has("noacpi");
bool dynamic_acpi_disable = KParams::the().has("noacpi_aml");
bool pci_mmio_disable = KParams::the().has("nopci_mmio");
- MemoryManager::initialize(physical_address_for_kernel_page_tables);
+ complete_acpi_disable = true;
+
+ MemoryManager::initialize();
if (complete_acpi_disable) {
ACPIParser::initialize_limited();