aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-03-18 10:48:24 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-03-18 10:48:24 +0000
commitfd557fb19c4ad25fbcb1368a73fddd91921496fd (patch)
tree0b1350083eefcae329250a75245a6aefdbb67a44 /arch/x86_64
parent3c01f820a064f3120a46aa3afdd9f88ce9e00db3 (diff)
downloadteachos-fd557fb19c4ad25fbcb1368a73fddd91921496fd.tar.xz
teachos-fd557fb19c4ad25fbcb1368a73fddd91921496fd.zip
Fix invalid bit values in access byte and typo in create_segment_descriptor method
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp10
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/global_descriptor_table.cpp2
2 files changed, 6 insertions, 6 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 bafce8d..646c2ca 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
@@ -44,15 +44,15 @@ namespace teachos::arch::context_switching::descriptor_table
TRAP_GATE = 15, ///< The actual type of sytem segment is a trap gate.
CODE_OR_DATA_SEGMENT = 1U << 4U, ///< Defines a system segment (if 0) or a code/data segment (if 1).
ACCESS_LEVEL_KERNEL =
- 0U << 4U, ///< Highest privileged level used by the kernel to allow for full access of resources.
+ 0U << 5U, ///< Highest privileged level used by the kernel to allow for full access of resources.
ACCESS_LEVEL_ADMIN =
- 2U << 4U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
+ 1U << 5U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
///< than two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
ACCESS_LEVEL_PRIVILEGED_USER =
- 4U << 4U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
+ 2U << 5U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
///< than two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
- ACCESS_LEVEL_USER = 6U << 4U, ///< Restricts access to only application and their specific memory.
- PRESENT = 1U << 3U << 4U, ///< Present bit; Allows an entry to refer to a valid segment.
+ ACCESS_LEVEL_USER = 3U << 5U, ///< Restricts access to only application and their specific memory.
+ PRESENT = 1U << 7U, ///< Present bit; Allows an entry to refer to a valid segment.
///< Must be set (1) for any valid segment.
};
diff --git a/arch/x86_64/src/context_switching/descriptor_table/global_descriptor_table.cpp b/arch/x86_64/src/context_switching/descriptor_table/global_descriptor_table.cpp
index b338d9d..578e264 100644
--- a/arch/x86_64/src/context_switching/descriptor_table/global_descriptor_table.cpp
+++ b/arch/x86_64/src/context_switching/descriptor_table/global_descriptor_table.cpp
@@ -19,7 +19,7 @@ namespace teachos::arch::context_switching::descriptor_table
}
else if (access_level == access_level::USER)
{
- access_level_bitset = access_byte::ACCESS_LEVEL_USER;
+ access_level_bitset |= access_byte::ACCESS_LEVEL_USER;
}
uint8_t gdt_flags_bitset = gdt_flags::GRANULARITY;