mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
Kernel: Move boot info declarations to a header file
Instead of manually redeclaring those variables in various files this now adds a header file for them.
This commit is contained in:
parent
b4600f2996
commit
dd42093b93
8 changed files with 53 additions and 51 deletions
23
Kernel/BootInfo.h
Normal file
23
Kernel/BootInfo.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Kernel/VirtualAddress.h>
|
||||||
|
|
||||||
|
extern "C" u8 const* start_of_prekernel_image;
|
||||||
|
extern "C" u8 const* end_of_prekernel_image;
|
||||||
|
extern "C" __attribute__((section(".boot_bss"))) FlatPtr kernel_base;
|
||||||
|
#if ARCH(X86_64)
|
||||||
|
extern "C" u32 gdt64ptr;
|
||||||
|
extern "C" u16 code64_sel;
|
||||||
|
extern "C" FlatPtr boot_pml4t;
|
||||||
|
#endif
|
||||||
|
extern "C" FlatPtr boot_pdpt;
|
||||||
|
extern "C" FlatPtr boot_pd0;
|
||||||
|
extern "C" FlatPtr boot_pd_kernel;
|
||||||
|
extern "C" FlatPtr boot_pd_kernel_pt1023;
|
||||||
|
extern "C" const char* kernel_cmdline;
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <AK/Platform.h>
|
|
||||||
#include <Kernel/Multiboot.h>
|
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
struct [[gnu::packed]] BootInfo {
|
|
||||||
u8 const* start_of_prekernel_image;
|
|
||||||
u8 const* end_of_prekernel_image;
|
|
||||||
FlatPtr kernel_base;
|
|
||||||
multiboot_info* multiboot_info_ptr;
|
|
||||||
#if ARCH(X86_64)
|
|
||||||
u32 gdt64ptr;
|
|
||||||
u16 code64_sel;
|
|
||||||
FlatPtr boot_pml4t;
|
|
||||||
#endif
|
|
||||||
FlatPtr boot_pdpt;
|
|
||||||
FlatPtr boot_pd0;
|
|
||||||
FlatPtr boot_pd_kernel;
|
|
||||||
FlatPtr boot_pd_kernel_pt1023;
|
|
||||||
char const* kernel_cmdline;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -6,4 +6,30 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# include <Kernel/Multiboot.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_KERNEL_SIZE 0x3000000
|
#define MAX_KERNEL_SIZE 0x3000000
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
namespace Kernel {
|
||||||
|
|
||||||
|
struct [[gnu::packed]] BootInfo {
|
||||||
|
u8 const* start_of_prekernel_image;
|
||||||
|
u8 const* end_of_prekernel_image;
|
||||||
|
FlatPtr kernel_base;
|
||||||
|
multiboot_info* multiboot_info_ptr;
|
||||||
|
# if ARCH(X86_64)
|
||||||
|
u32 gdt64ptr;
|
||||||
|
u16 code64_sel;
|
||||||
|
FlatPtr boot_pml4t;
|
||||||
|
# endif
|
||||||
|
FlatPtr boot_pdpt;
|
||||||
|
FlatPtr boot_pd0;
|
||||||
|
FlatPtr boot_pd_kernel;
|
||||||
|
FlatPtr boot_pd_kernel_pt1023;
|
||||||
|
char const* kernel_cmdline;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <Kernel/Multiboot.h>
|
#include <Kernel/Multiboot.h>
|
||||||
#include <Kernel/Prekernel/BootInfo.h>
|
|
||||||
#include <Kernel/Prekernel/Prekernel.h>
|
#include <Kernel/Prekernel/Prekernel.h>
|
||||||
#include <Kernel/VirtualAddress.h>
|
#include <Kernel/VirtualAddress.h>
|
||||||
#include <LibC/elf.h>
|
#include <LibC/elf.h>
|
||||||
|
|
|
@ -9,15 +9,12 @@
|
||||||
#include <AK/Platform.h>
|
#include <AK/Platform.h>
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
# include <AK/Types.h>
|
# include <AK/Types.h>
|
||||||
|
# include <Kernel/BootInfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define READONLY_AFTER_INIT __attribute__((section(".ro_after_init")))
|
#define READONLY_AFTER_INIT __attribute__((section(".ro_after_init")))
|
||||||
#define UNMAP_AFTER_INIT NEVER_INLINE __attribute__((section(".unmap_after_init")))
|
#define UNMAP_AFTER_INIT NEVER_INLINE __attribute__((section(".unmap_after_init")))
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" FlatPtr kernel_base;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define KERNEL_PD_END (kernel_base + 0x31000000)
|
#define KERNEL_PD_END (kernel_base + 0x31000000)
|
||||||
#define KERNEL_PT1024_BASE (kernel_base + 0x3FE00000)
|
#define KERNEL_PT1024_BASE (kernel_base + 0x3FE00000)
|
||||||
#define KERNEL_QUICKMAP_PT (KERNEL_PT1024_BASE + 0x6000)
|
#define KERNEL_QUICKMAP_PT (KERNEL_PT1024_BASE + 0x6000)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/Memory.h>
|
#include <AK/Memory.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
|
#include <Kernel/BootInfo.h>
|
||||||
#include <Kernel/CMOS.h>
|
#include <Kernel/CMOS.h>
|
||||||
#include <Kernel/FileSystem/Inode.h>
|
#include <Kernel/FileSystem/Inode.h>
|
||||||
#include <Kernel/Heap/kmalloc.h>
|
#include <Kernel/Heap/kmalloc.h>
|
||||||
|
@ -22,8 +23,6 @@
|
||||||
#include <Kernel/VM/PhysicalRegion.h>
|
#include <Kernel/VM/PhysicalRegion.h>
|
||||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||||
|
|
||||||
extern u8* start_of_prekernel_image;
|
|
||||||
extern u8* end_of_prekernel_image;
|
|
||||||
extern u8* start_of_kernel_image;
|
extern u8* start_of_kernel_image;
|
||||||
extern u8* end_of_kernel_image;
|
extern u8* end_of_kernel_image;
|
||||||
extern FlatPtr start_of_kernel_text;
|
extern FlatPtr start_of_kernel_text;
|
||||||
|
@ -36,9 +35,6 @@ extern FlatPtr end_of_unmap_after_init;
|
||||||
extern FlatPtr start_of_kernel_ksyms;
|
extern FlatPtr start_of_kernel_ksyms;
|
||||||
extern FlatPtr end_of_kernel_ksyms;
|
extern FlatPtr end_of_kernel_ksyms;
|
||||||
|
|
||||||
extern "C" void* boot_pd_kernel;
|
|
||||||
extern "C" void* boot_pd_kernel_pt1023;
|
|
||||||
|
|
||||||
extern multiboot_module_entry_t multiboot_copy_boot_modules_array[16];
|
extern multiboot_module_entry_t multiboot_copy_boot_modules_array[16];
|
||||||
extern size_t multiboot_copy_boot_modules_count;
|
extern size_t multiboot_copy_boot_modules_count;
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,6 @@ RefPtr<PageDirectory> PageDirectory::find_by_cr3(FlatPtr cr3)
|
||||||
return cr3_map().get(cr3).value_or({});
|
return cr3_map().get(cr3).value_or({});
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" FlatPtr kernel_base;
|
|
||||||
#if ARCH(X86_64)
|
|
||||||
extern "C" void* boot_pml4t;
|
|
||||||
#endif
|
|
||||||
extern "C" void* boot_pdpt;
|
|
||||||
extern "C" void* boot_pd0;
|
|
||||||
extern "C" void* boot_pd_kernel;
|
|
||||||
|
|
||||||
UNMAP_AFTER_INIT PageDirectory::PageDirectory()
|
UNMAP_AFTER_INIT PageDirectory::PageDirectory()
|
||||||
{
|
{
|
||||||
// make sure this starts in a new page directory to make MemoryManager::initialize_physical_pages() happy
|
// make sure this starts in a new page directory to make MemoryManager::initialize_physical_pages() happy
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <Kernel/ACPI/MultiProcessorParser.h>
|
#include <Kernel/ACPI/MultiProcessorParser.h>
|
||||||
#include <Kernel/Arch/PC/BIOS.h>
|
#include <Kernel/Arch/PC/BIOS.h>
|
||||||
#include <Kernel/Arch/x86/Processor.h>
|
#include <Kernel/Arch/x86/Processor.h>
|
||||||
|
#include <Kernel/BootInfo.h>
|
||||||
#include <Kernel/Bus/PCI/Access.h>
|
#include <Kernel/Bus/PCI/Access.h>
|
||||||
#include <Kernel/Bus/PCI/Initializer.h>
|
#include <Kernel/Bus/PCI/Initializer.h>
|
||||||
#include <Kernel/Bus/USB/UHCIController.h>
|
#include <Kernel/Bus/USB/UHCIController.h>
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
#include <Kernel/Net/NetworkTask.h>
|
#include <Kernel/Net/NetworkTask.h>
|
||||||
#include <Kernel/Net/NetworkingManagement.h>
|
#include <Kernel/Net/NetworkingManagement.h>
|
||||||
#include <Kernel/Panic.h>
|
#include <Kernel/Panic.h>
|
||||||
#include <Kernel/Prekernel/BootInfo.h>
|
#include <Kernel/Prekernel/Prekernel.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/ProcessExposed.h>
|
#include <Kernel/ProcessExposed.h>
|
||||||
#include <Kernel/RTC.h>
|
#include <Kernel/RTC.h>
|
||||||
|
@ -110,8 +111,6 @@ u8 const* start_of_prekernel_image;
|
||||||
u8 const* end_of_prekernel_image;
|
u8 const* end_of_prekernel_image;
|
||||||
__attribute__((section(".boot_bss"))) FlatPtr kernel_base;
|
__attribute__((section(".boot_bss"))) FlatPtr kernel_base;
|
||||||
#if ARCH(X86_64)
|
#if ARCH(X86_64)
|
||||||
extern "C" u32 gdt64ptr;
|
|
||||||
extern "C" u16 code64_sel;
|
|
||||||
FlatPtr boot_pml4t;
|
FlatPtr boot_pml4t;
|
||||||
#endif
|
#endif
|
||||||
FlatPtr boot_pdpt;
|
FlatPtr boot_pdpt;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue