aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/boot
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/boot')
-rw-r--r--arch/x86_64/src/boot/boot32.S14
-rw-r--r--arch/x86_64/src/boot/entry64.s14
-rw-r--r--arch/x86_64/src/boot/initialize_runtime.cpp11
3 files changed, 15 insertions, 24 deletions
diff --git a/arch/x86_64/src/boot/boot32.S b/arch/x86_64/src/boot/boot32.S
index 79b3ec7..cea1607 100644
--- a/arch/x86_64/src/boot/boot32.S
+++ b/arch/x86_64/src/boot/boot32.S
@@ -5,14 +5,6 @@
*/
.section .boot_bss, "aw", @nobits
-/**
- * @brief Storage for the multiboot2 information pointer.
- */
-.global multiboot_information_pointer
-multiboot_information_pointer: .skip 8
-
-.align 4096
-
page_maps_start:
page_map_level_4: .skip 512 * 8
page_map_level_3_high: .skip 512 * 8
@@ -22,6 +14,12 @@ page_maps_end = .
page_maps_size = page_maps_end - page_maps_start
/**
+ * @brief Storage for the multiboot2 information pointer.
+ */
+.global multiboot_information_pointer
+multiboot_information_pointer: .skip 8
+
+/**
* @brief Storage for the bootstrap stack.
*/
.section .boot_stack, "aw", @nobits
diff --git a/arch/x86_64/src/boot/entry64.s b/arch/x86_64/src/boot/entry64.s
index 657b0a8..29fb778 100644
--- a/arch/x86_64/src/boot/entry64.s
+++ b/arch/x86_64/src/boot/entry64.s
@@ -1,3 +1,11 @@
+.section .stack, "aw", @nobits
+
+.align 16
+.global stack_top
+stack_bottom: .skip 1 << 20
+stack_top:
+stack_size = stack_top - stack_bottom
+
.section .bss, "aw", @nobits
//! A structure containing information gathered during the bootstrap process.
@@ -11,12 +19,6 @@
.global bootstrap_information
bootstrap_information: .skip 16
-.align 16
-.global stack_top
-stack_bottom: .skip 1 << 20
-stack_top:
-stack_size = stack_top - stack_bottom
-
.section .boot_text, "ax", @progbits
.code64
diff --git a/arch/x86_64/src/boot/initialize_runtime.cpp b/arch/x86_64/src/boot/initialize_runtime.cpp
index 46dd5e4..f413448 100644
--- a/arch/x86_64/src/boot/initialize_runtime.cpp
+++ b/arch/x86_64/src/boot/initialize_runtime.cpp
@@ -6,21 +6,12 @@ extern "C"
{
using global_initializer = auto (*)() -> void;
- extern global_initializer __ctors_start;
- extern global_initializer __ctors_end;
extern global_initializer __init_array_start;
extern global_initializer __init_array_end;
auto invoke_global_constructors() -> void
{
- auto constructors = std::span{&__ctors_start, &__ctors_end};
auto initializers = std::span{&__init_array_start, &__init_array_end};
-
- auto apply_invoke = [](auto invokable) -> void {
- std::invoke(invokable);
- };
-
- std::ranges::for_each(constructors, apply_invoke);
- std::ranges::for_each(initializers, apply_invoke);
+ std::ranges::for_each(initializers, [](auto invokable) { std::invoke(invokable); });
}
}