diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2025-03-15 14:56:12 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2025-03-15 14:56:12 +0000 |
| commit | ecb67842d3578dfc8c7d685b0cd168efd24505e6 (patch) | |
| tree | de6cba51c3aa47a0773a0dfbdc6c034d467a2458 /arch | |
| parent | e6a9d939ed5e9f89e69efdacc60a1ce6edd1061c (diff) | |
| download | teachos-ecb67842d3578dfc8c7d685b0cd168efd24505e6.tar.xz teachos-ecb67842d3578dfc8c7d685b0cd168efd24505e6.zip | |
create TSS descriptor
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86_64/src/context_switching/descriptor_table/global_descriptor_table.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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 c5554a7..6474739 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 @@ -12,6 +12,7 @@ namespace teachos::arch::context_switching::descriptor_table segment_descriptor null_segment{0}; std::bitset<20U> limit{0xFFFFF}; + // Kernel space code segment access_byte kernel_code_access_byte{access_byte::PRESENT | access_byte::ACCESS_LEVEL_KERNEL | access_byte::CODE_OR_DATA_SEGMENT | access_byte::CODE_SEGMENT | @@ -38,6 +39,15 @@ namespace teachos::arch::context_switching::descriptor_table gdt_flags user_data_gdt_flags{gdt_flags::GRANULARITY | gdt_flags::UPPER_BOUND, limit}; segment_descriptor user_data_segment{user_data_access_byte, user_data_gdt_flags, 0, limit}; + // Task state segment + // TODO: Create TSS + access_byte tss_access_byte{access_byte::PRESENT | access_byte::ACCESS_LEVEL_KERNEL | + access_byte::TASK_STATE_SEGMENT_AVAILABLE}; + gdt_flags tss_gdt_flags{0U, limit}; + uint64_t tss_address = 0; // &TSS + uint64_t tss_limit = 0U; // sizeof(TSS) - 1 + segment_descriptor task_state_segment{tss_access_byte, tss_gdt_flags, tss_address, tss_limit}; + stl::vector<segment_descriptor> global_descriptor_table{null_segment, kernel_code_segment, kernel_data_segment, user_code_segment, user_data_segment}; return global_descriptor_table; |
