aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src')
-rw-r--r--arch/x86_64/src/boot/boot.s4
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/access_byte.cpp14
2 files changed, 16 insertions, 2 deletions
diff --git a/arch/x86_64/src/boot/boot.s b/arch/x86_64/src/boot/boot.s
index 2197dce..dbea42a 100644
--- a/arch/x86_64/src/boot/boot.s
+++ b/arch/x86_64/src/boot/boot.s
@@ -197,10 +197,10 @@ _start:
call enable_paging
call enable_sse
- cli // Clears the interrupt flag during the GDT setup
+ cli /* Clears the interrupt flag during the GDT setup */
lgdt (global_descriptor_table_pointer)
jmp $global_descriptor_table_code,$_transition_to_long_mode
- // The interrupt flag is set in cpp after setting up the GDT
+ /* The interrupt flag is set in cpp after setting up the GDT */
call halt
diff --git a/arch/x86_64/src/context_switching/descriptor_table/access_byte.cpp b/arch/x86_64/src/context_switching/descriptor_table/access_byte.cpp
new file mode 100644
index 0000000..15a0947
--- /dev/null
+++ b/arch/x86_64/src/context_switching/descriptor_table/access_byte.cpp
@@ -0,0 +1,14 @@
+#include "arch/context_switching/descriptor_table/access_byte.hpp"
+
+#include <bitset>
+
+namespace teachos::arch::context_switching::descriptor_table
+{
+ auto access_byte::contains_flags(std::bitset<8U> other) const -> bool { return (flags & other) == other; }
+
+ auto access_byte::get_privilege_level() const -> privilege_level
+ {
+ constexpr uint8_t PRIVILEGE_MASK = 0b0110'0000;
+ return static_cast<privilege_level>(flags.to_ulong() & PRIVILEGE_MASK);
+ }
+} // namespace teachos::arch::context_switching::descriptor_table