aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-06-09 11:40:02 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-06-09 11:40:02 +0000
commit3a7a596299580a3fd7d8b61f3ec34a3c0bfc5a3c (patch)
treecceba605997a6c61fca7b0cc80d67102d6aed40d
parentc4ced070ab057e4be6552b2f10ec1bf35509e245 (diff)
downloadteachos-3a7a596299580a3fd7d8b61f3ec34a3c0bfc5a3c.tar.xz
teachos-3a7a596299580a3fd7d8b61f3ec34a3c0bfc5a3c.zip
Add constexpr to create segment descriptor
-rw-r--r--arch/x86_64/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86_64/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp b/arch/x86_64/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp
index d692e51..bbcee31 100644
--- a/arch/x86_64/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp
+++ b/arch/x86_64/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp
@@ -12,9 +12,9 @@ namespace teachos::arch::context_switching::segment_descriptor_table
auto create_segment_descriptor(segment_descriptor_type segment_descriptor_type, access_byte access_level)
-> segment_descriptor_base
{
- uint64_t const base = 0x0;
- std::bitset<20U> const limit{0xFFFFF};
- gdt_flags flags{gdt_flags::GRANULARITY, limit};
+ uint64_t constexpr BASE = 0x0;
+ std::bitset<20U> constexpr LIMIT{0xFFFFF};
+ gdt_flags flags{gdt_flags::GRANULARITY, LIMIT};
access_level |= access_byte::PRESENT | access_byte::CODE_OR_DATA_SEGMENT;
if (segment_descriptor_type == segment_descriptor_type::CODE_SEGMENT)
@@ -27,13 +27,13 @@ namespace teachos::arch::context_switching::segment_descriptor_table
access_level |= access_byte::WRITABLE;
}
- segment_descriptor_base const segment_descriptor_base{access_level, flags, base, limit};
+ segment_descriptor_base const segment_descriptor_base{access_level, flags, BASE, LIMIT};
return segment_descriptor_base;
}
auto create_tss_descriptor(task_state_segment * tss) -> segment_descriptor_extension
{
- constexpr uint64_t TSS_LIMIT = sizeof(task_state_segment) - 1;
+ uint64_t constexpr TSS_LIMIT = sizeof(task_state_segment) - 1;
access_byte const tss_access_byte{access_byte::PRESENT | access_byte::DESCRIPTOR_LEVEL_KERNEL |
access_byte::TASK_STATE_SEGMENT_AVAILABLE};
gdt_flags const tss_gdt_flags{0U, TSS_LIMIT};