mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Call the constructors in the aarch64 init function
Now that we have separated the kmalloc.cpp constructors into a separate library, we can actually call the constructors in the init function.
This commit is contained in:
parent
2e49d6b001
commit
ed4bfaed12
Notes:
sideshowbarker
2024-07-17 11:07:25 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/ed4bfaed12 Pull-request: https://github.com/SerenityOS/serenity/pull/13991 Reviewed-by: https://github.com/linusg
2 changed files with 19 additions and 0 deletions
|
@ -38,6 +38,12 @@ extern "C" [[noreturn]] void halt();
|
|||
extern "C" [[noreturn]] void init();
|
||||
extern "C" void exception_common(TrapFrame const* const trap_frame);
|
||||
|
||||
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 "C" [[noreturn]] void init()
|
||||
{
|
||||
dbgln("Welcome to Serenity OS!");
|
||||
|
@ -45,7 +51,16 @@ extern "C" [[noreturn]] void init()
|
|||
dbgln("Observed deviations from that ideal are shortcomings of your imagination.");
|
||||
dbgln();
|
||||
|
||||
// We call the constructors of kmalloc.cpp separately, because other constructors in the Kernel
|
||||
// might rely on being able to call new/kmalloc in the constructor. We do have to run the
|
||||
// kmalloc constructors, because kmalloc_init relies on that.
|
||||
for (ctor_func_t* ctor = start_heap_ctors; ctor < end_heap_ctors; ctor++)
|
||||
(*ctor)();
|
||||
kmalloc_init();
|
||||
|
||||
for (ctor_func_t* ctor = start_ctors; ctor < end_ctors; ctor++)
|
||||
(*ctor)();
|
||||
|
||||
Kernel::load_kernel_symbol_table();
|
||||
|
||||
auto firmware_version = query_firmware_version();
|
||||
|
|
|
@ -22,6 +22,10 @@ SECTIONS
|
|||
|
||||
.rodata ALIGN(4K) : AT (ADDR(.rodata))
|
||||
{
|
||||
start_heap_ctors = .;
|
||||
*libkernel_heap.a:*(.init_array)
|
||||
end_heap_ctors = .;
|
||||
|
||||
start_ctors = .;
|
||||
*(.init_array)
|
||||
end_ctors = .;
|
||||
|
|
Loading…
Reference in a new issue