1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:58:12 +00:00

Kernel: Fix the variable declaration for some linker script symbols

Despite what the declaration would have us believe these are not "u8*".
If they were we wouldn't have to use the & operator to get the address
of them and then cast them to "u8*"/FlatPtr afterwards.
This commit is contained in:
Gunnar Beutner 2021-07-22 22:11:17 +02:00 committed by Andreas Kling
parent 40580696a6
commit f2be1f9326
4 changed files with 75 additions and 75 deletions

View file

@ -61,20 +61,20 @@
// Defined in the linker script
typedef void (*ctor_func_t)();
extern ctor_func_t start_heap_ctors;
extern ctor_func_t end_heap_ctors;
extern ctor_func_t start_ctors;
extern ctor_func_t end_ctors;
extern ctor_func_t start_heap_ctors[];
extern ctor_func_t end_heap_ctors[];
extern ctor_func_t start_ctors[];
extern ctor_func_t end_ctors[];
extern size_t __stack_chk_guard;
size_t __stack_chk_guard;
extern "C" u8* start_of_safemem_text;
extern "C" u8* end_of_safemem_text;
extern "C" u8* start_of_safemem_atomic_text;
extern "C" u8* end_of_safemem_atomic_text;
extern "C" u8 start_of_safemem_text[];
extern "C" u8 end_of_safemem_text[];
extern "C" u8 start_of_safemem_atomic_text[];
extern "C" u8 end_of_safemem_atomic_text[];
extern "C" u8* end_of_kernel_image;
extern "C" u8 end_of_kernel_image[];
multiboot_module_entry_t multiboot_copy_boot_modules_array[16];
size_t multiboot_copy_boot_modules_count;
@ -149,7 +149,7 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init(BootInfo const& boot_info)
s_bsp_processor.early_initialize(0);
// Invoke the constructors needed for the kernel heap
for (ctor_func_t* ctor = &start_heap_ctors; ctor < &end_heap_ctors; ctor++)
for (ctor_func_t* ctor = start_heap_ctors; ctor < end_heap_ctors; ctor++)
(*ctor)();
kmalloc_init();
slab_alloc_init();
@ -163,12 +163,12 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init(BootInfo const& boot_info)
MemoryManager::initialize(0);
// Ensure that the safemem sections are not empty. This could happen if the linker accidentally discards the sections.
VERIFY(&start_of_safemem_text != &end_of_safemem_text);
VERIFY(&start_of_safemem_atomic_text != &end_of_safemem_atomic_text);
VERIFY(start_of_safemem_text != end_of_safemem_text);
VERIFY(start_of_safemem_atomic_text != end_of_safemem_atomic_text);
// Invoke all static global constructors in the kernel.
// Note that we want to do this as early as possible.
for (ctor_func_t* ctor = &start_ctors; ctor < &end_ctors; ctor++)
for (ctor_func_t* ctor = start_ctors; ctor < end_ctors; ctor++)
(*ctor)();
APIC::initialize();