aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
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/include
parenteb22cdcad4c27527a63a6e457e80c752f76821c6 (diff)
downloadteachos-ce8683e63fc9ef59e1800927afb1753507a42ef6.tar.xz
teachos-ce8683e63fc9ef59e1800927afb1753507a42ef6.zip
x86_64: extract constants from bootstrap code
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/x86_64/boot/boot.hpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/x86_64/include/x86_64/boot/boot.hpp b/arch/x86_64/include/x86_64/boot/boot.hpp
new file mode 100644
index 0000000..066e49e
--- /dev/null
+++ b/arch/x86_64/include/x86_64/boot/boot.hpp
@@ -0,0 +1,66 @@
+#ifndef TEACHOS_X86_64_BOOT_BOOT_H
+#define TEACHOS_X86_64_BOOT_BOOT_H
+
+#ifdef __ASSEMBLER__
+/**
+ * @brief The number of huge pages to map during bootstrap.
+ */
+#define HUGE_PAGES_TO_MAP (16)
+
+/**
+ * @brief The magic value to be set in eax by the multiboot 2 loader.
+ */
+#define MULTIBOOT2_MAGIC (0x36d76289)
+
+/**
+ * @brief The "A" bit in a GDT entry.
+ */
+#define GDT_ACCESSED (1 << 40)
+
+/**
+ * @brief The "R/W" bit in a GDT entry
+ */
+#define GDT_READ_WRITE (1 << 41)
+
+/**
+ * @brief The "E" bit in a GDT entry.
+ */
+#define GDT_EXECUTABLE (1 << 43)
+
+/**
+ * @brief The "S" bit in a GDT entry.
+ */
+#define GDT_DESCRIPTOR_TYPE (1 << 44)
+
+/**
+ * @brief The "P" bit in a GDT entry.
+ */
+#define GDT_PRESENT (1 << 47)
+
+/**
+ * @brief The "L" bit in a GDT entry.
+ */
+#define GDT_LONG_MODE (1 << 53)
+
+#else
+
+#include "arch/asm_pointer.hpp"
+
+#include <multiboot2/information.hpp>
+
+extern "C"
+{
+ /**
+ * @brief A pointer to the multiboot 2 information structure provided by the boot loader.
+ */
+ extern teachos::arch::asm_pointer<multiboot2::information_view> multiboot_information_pointer;
+
+ /**
+ * @brief A pointer to the VGA text mode buffer.
+ */
+ extern teachos::arch::asm_pointer<std::pair<char, std::byte>> vga_buffer_pointer;
+}
+
+#endif
+
+#endif