diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2025-02-27 10:13:35 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2025-02-27 10:13:35 +0000 |
| commit | d8a8efe3e8d90ec83069d1c934ff319626e87a2d (patch) | |
| tree | 1117cde95361e6e9aeac080aa5a53d52592ab4c5 /arch/x86_64/src/context_switching | |
| parent | 8d14c729c43ee555c240a043e3909617e4fa5043 (diff) | |
| download | teachos-d8a8efe3e8d90ec83069d1c934ff319626e87a2d.tar.xz teachos-d8a8efe3e8d90ec83069d1c934ff319626e87a2d.zip | |
add descriptor_table access_byte
Diffstat (limited to 'arch/x86_64/src/context_switching')
| -rw-r--r-- | arch/x86_64/src/context_switching/descriptor_table/access_byte.cpp | 14 |
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 |
