aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-07-22 20:48:11 +0000
committerFelix Morgner <felix.morgner@ost.ch>2025-07-22 20:51:52 +0000
commitce8683e63fc9ef59e1800927afb1753507a42ef6 (patch)
tree5bd32b1a291e81615695abe96bf093ad9a8e1692 /arch/x86_64/src
parenteb22cdcad4c27527a63a6e457e80c752f76821c6 (diff)
downloadteachos-ce8683e63fc9ef59e1800927afb1753507a42ef6.tar.xz
teachos-ce8683e63fc9ef59e1800927afb1753507a42ef6.zip
x86_64: extract constants from bootstrap code
Diffstat (limited to 'arch/x86_64/src')
-rw-r--r--arch/x86_64/src/boot/boot.S (renamed from arch/x86_64/src/boot/boot.s)19
-rw-r--r--arch/x86_64/src/memory.cpp5
2 files changed, 7 insertions, 17 deletions
diff --git a/arch/x86_64/src/boot/boot.s b/arch/x86_64/src/boot/boot.S
index 7a46795..d65c865 100644
--- a/arch/x86_64/src/boot/boot.s
+++ b/arch/x86_64/src/boot/boot.S
@@ -1,3 +1,5 @@
+#include "x86_64/boot/boot.hpp"
+
/**
* @brief Uninitialized data for the bootstrapping process.
*/
@@ -33,18 +35,12 @@ stack_top:
* @brief A basic GDT for long mode.
*/
global_descriptor_table:
-.set GDT_ACCESSED, 40
-.set GDT_READ_WRITE, 41
-.set GDT_EXECUTABLE, 43
-.set GDT_DESCRIPTOR_TYPE, 44
-.set GDT_PRESENT, 47
-.set GDT_LONG_MODE, 53
global_descriptor_table_null = . - global_descriptor_table
.quad 0
global_descriptor_table_code = . - global_descriptor_table
-.quad (1 << GDT_ACCESSED) | (1 << GDT_READ_WRITE) | (1 << GDT_EXECUTABLE) | (1 << GDT_DESCRIPTOR_TYPE) | (1 << GDT_PRESENT) | (1 << GDT_LONG_MODE)
+.quad GDT_ACCESSED | GDT_READ_WRITE | GDT_EXECUTABLE | GDT_DESCRIPTOR_TYPE | GDT_PRESENT | GDT_LONG_MODE
global_descriptor_table_data = . - global_descriptor_table
-.quad (1 << GDT_ACCESSED) | (1 << GDT_READ_WRITE) | (1 << GDT_DESCRIPTOR_TYPE) | (1 << GDT_PRESENT)
+.quad GDT_ACCESSED | GDT_READ_WRITE | GDT_DESCRIPTOR_TYPE | GDT_PRESENT
global_descriptor_table_end:
message_prefix_panic: .string "Panic: "
@@ -110,7 +106,6 @@ vga_buffer_pointer: .quad 0xb8000
* @param %ebx The Multiboot 2 information pointer.
* @return void This function does not return.
*/
-.global _start
_start:
call 0f
0:
@@ -145,7 +140,6 @@ _start:
*
* @return This function never returns.
*/
-.global halt
_halt:
function_start
@@ -227,7 +221,6 @@ _panic:
_assert_loaded_by_multiboot2_loader:
pie_function_start
- .set MULTIBOOT2_MAGIC, 0x36d76289
cmp $MULTIBOOT2_MAGIC, %eax
je 1f
lea (message_not_loaded_by_multiboot2 - 0b)(%esi), %eax
@@ -316,8 +309,6 @@ _prepare_page_maps:
pie_function_start
push %ebx
- .set HUGE_PAGES_TO_MAP, 16
-
/* Map the P4 table recursively */
lea (page_map_level_4 - 0b)(%esi), %eax
mov %eax, %ebx
@@ -362,7 +353,7 @@ _prepare_page_maps:
* set up for use.
*
* @return void
- */For
+ */
_enable_paging:
pie_function_start
diff --git a/arch/x86_64/src/memory.cpp b/arch/x86_64/src/memory.cpp
index 2b16beb..a31627b 100644
--- a/arch/x86_64/src/memory.cpp
+++ b/arch/x86_64/src/memory.cpp
@@ -2,14 +2,13 @@
#include "kern/error.hpp"
-#include "arch/asm_pointer.hpp"
-#include "x86_64/memory/region_allocator.hpp"
+#include "x86_64/boot/boot.hpp"
#include <multiboot2/information.hpp>
#include <atomic>
-extern "C" teachos::arch::asm_pointer<multiboot2::information_view> multiboot_information_pointer;
+// extern "C" teachos::arch::asm_pointer<multiboot2::information_view> multiboot_information_pointer;
namespace teachos::arch::memory
{