aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-12-29 14:43:20 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-12-29 14:43:20 +0100
commitfb1c180c431e3ac07ca56f53299edea316883842 (patch)
tree60344689657d6c9512c697e3ac714709cc3c958c /arch/x86_64/src
parentc522a3634e0cd20804b1e3216caedd5e15cbee19 (diff)
downloadteachos-fb1c180c431e3ac07ca56f53299edea316883842.tar.xz
teachos-fb1c180c431e3ac07ca56f53299edea316883842.zip
x86_64/boot: fix section assignments in ld script
Diffstat (limited to 'arch/x86_64/src')
-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); });
}
}