summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2023-01-10 10:34:25 +0100
committerLinus Groh <mail@linusgroh.de>2023-01-24 14:54:44 +0000
commit33581d5c447e29622ba0a26f691e20b8cc03af52 (patch)
tree4d075e5bb037fa91354063c35687972ee636f645
parent95992a255eeadfa8a932d117370148a1f03dfdc8 (diff)
downloadserenity-33581d5c447e29622ba0a26f691e20b8cc03af52.zip
Kernel: Add KERNEL_MAPPING_BASE to Sections.h and use it in Prekernel
-rw-r--r--Kernel/Prekernel/Prekernel.h4
-rw-r--r--Kernel/Prekernel/init.cpp2
-rw-r--r--Kernel/Sections.h2
3 files changed, 7 insertions, 1 deletions
diff --git a/Kernel/Prekernel/Prekernel.h b/Kernel/Prekernel/Prekernel.h
index f237286e2f..7c0176fc12 100644
--- a/Kernel/Prekernel/Prekernel.h
+++ b/Kernel/Prekernel/Prekernel.h
@@ -15,6 +15,10 @@
#define MAX_KERNEL_SIZE 0x4000000
#define KERNEL_PD_SIZE 0x31000000
+// FIXME: This should be using the define from Sections.h, but that currently is not possible
+// and causes linker errors, because Sections.h includes BootInfo.h.
+#define KERNEL_MAPPING_BASE 0x2000000000
+
#ifdef __cplusplus
namespace Kernel {
diff --git a/Kernel/Prekernel/init.cpp b/Kernel/Prekernel/init.cpp
index 1f95655941..b7ad0e96ec 100644
--- a/Kernel/Prekernel/init.cpp
+++ b/Kernel/Prekernel/init.cpp
@@ -90,7 +90,7 @@ extern "C" [[noreturn]] void init()
__builtin_memcpy(kernel_program_headers, kernel_image + kernel_elf_header.e_phoff, sizeof(ElfW(Phdr)) * kernel_elf_header.e_phnum);
FlatPtr kernel_physical_base = 0x200000;
- FlatPtr default_kernel_load_base = 0x2000200000;
+ FlatPtr default_kernel_load_base = KERNEL_MAPPING_BASE + 0x200000;
FlatPtr kernel_load_base = default_kernel_load_base;
diff --git a/Kernel/Sections.h b/Kernel/Sections.h
index 9142dc6ccc..37593b1aca 100644
--- a/Kernel/Sections.h
+++ b/Kernel/Sections.h
@@ -15,6 +15,8 @@
#define READONLY_AFTER_INIT __attribute__((section(".ro_after_init")))
#define UNMAP_AFTER_INIT NEVER_INLINE __attribute__((section(".unmap_after_init")))
+#define KERNEL_MAPPING_BASE 0x2000000000
+
#define KERNEL_PD_END (kernel_mapping_base + KERNEL_PD_SIZE)
#define KERNEL_PT1024_BASE (kernel_mapping_base + 0x3FE00000)