aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/context_switching
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/context_switching')
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/access_byte.cpp14
1 files changed, 14 insertions, 0 deletions
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