aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp6
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp41
2 files changed, 44 insertions, 3 deletions
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp
index b3bce11..36b22ce 100644
--- a/arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp
+++ b/arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp
@@ -1,6 +1,6 @@
-#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_POINTERS_HPP
-#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_POINTERS_HPP
+#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_ACCESS_BYTE_HPP
+#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_ACCESS_BYTE_HPP
#include <bitset>
#include <cstddef>
@@ -84,4 +84,4 @@ namespace teachos::arch::context_switching::descriptor_table
};
} // namespace teachos::arch::context_switching::descriptor_table
-#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_POINTERS_HPP \ No newline at end of file
+#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_ACCESS_BYTE_HPP \ No newline at end of file
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp
index e69de29..ced0d89 100644
--- a/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp
+++ b/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp
@@ -0,0 +1,41 @@
+#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_SEGMENT_DESCRIPTOR_HPP
+#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_SEGMENT_DESCRIPTOR_HPP
+
+#include "arch/context_switching/descriptor_table/gdt_flags.hpp"
+
+#include <bitset>
+#include <cstddef>
+#include <cstdint>
+
+namespace teachos::arch::context_switching::descriptor_table
+{
+ struct segment_descriptor
+ {
+ /**
+ * @brief Possible set bits in our underlying std::bitset and the meaning when they are set.
+ */
+ enum bitset : uint64_t
+ {
+ BASE = 1U << 0U,
+ FLAGS = 1U << 8U,
+ LIMIT = 1U << 12U,
+ ACCESS_BYTE = 1U << 16U,
+ BASE = 1U << 32U,
+ BASE = 1U << 40U,
+ LIMIT = 1U << 56U
+ };
+
+ explicit segment_descriptor(uint64_t flags)
+ : flags(flags)
+ {
+ // Nothing to do
+ }
+
+ private:
+ std::uint8_t base1;
+ gdt_flags flags;
+ std::bitset<64U> flags; ///< Underlying bitset used to read the flags from
+ };
+} // namespace teachos::arch::context_switching::descriptor_table
+
+#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_SEGMENT_DESCRIPTOR_HPP \ No newline at end of file