aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp20
-rw-r--r--arch/x86_64/include/arch/kernel/cpu/lgdt.hpp8
2 files changed, 26 insertions, 2 deletions
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp
index 06f40fe..ed17be3 100644
--- a/arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp
+++ b/arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp
@@ -18,8 +18,24 @@ namespace teachos::arch::context_switching::descriptor_table
*/
struct [[gnu::packed]] global_descriptor_table_pointer
{
- uint16_t table_length; ///< The amount of segment descriptor entries in the global descriptor table - 1.
- global_descriptor_table * address; ///< Pointer to the GDT base address.
+ /**
+ * @brief Default constructor.
+ */
+ global_descriptor_table_pointer() = default;
+
+ /**
+ * @brief Constructor.
+ */
+ global_descriptor_table_pointer(uint16_t table_length, global_descriptor_table * address);
+
+ /**
+ * @brief Defaulted three-way comparsion operator.
+ */
+ auto operator<=>(global_descriptor_table_pointer const & other) const -> std::strong_ordering = default;
+
+ private:
+ uint16_t table_length = {}; ///< The amount of segment descriptor entries in the global descriptor table - 1.
+ global_descriptor_table * address = {}; ///< Non-owning pointer to the GDT base address.
};
} // namespace teachos::arch::context_switching::descriptor_table
diff --git a/arch/x86_64/include/arch/kernel/cpu/lgdt.hpp b/arch/x86_64/include/arch/kernel/cpu/lgdt.hpp
index b0b2048..85e2949 100644
--- a/arch/x86_64/include/arch/kernel/cpu/lgdt.hpp
+++ b/arch/x86_64/include/arch/kernel/cpu/lgdt.hpp
@@ -8,6 +8,14 @@
namespace teachos::arch::kernel::cpu
{
+
+ /**
+ * @brief Returns the value in the GDTR register.
+ *
+ * @return Value of GDTR register.
+ */
+ auto store_global_descriptor_table() -> context_switching::descriptor_table::global_descriptor_table_pointer;
+
/**
* @brief Loads the global_descriptor_table_pointer into the global descriptor table register (GDTR).
*/