Skip to content

Commit

Permalink
Kernel: Add KERNEL_MAPPING_BASE to Sections.h and use it in Prekernel
Browse files Browse the repository at this point in the history
  • Loading branch information
FireFox317 authored and linusg committed Jan 24, 2023
1 parent 95992a2 commit 33581d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Kernel/Prekernel/Prekernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion Kernel/Prekernel/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions Kernel/Sections.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 33581d5

Please sign in to comment.