aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/context_switching/main.cpp
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-03-27 09:40:32 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-03-27 09:40:32 +0000
commita6c5f6a273d0c5c4161f600fca6d4fe49858c23c (patch)
treebf02711f9d3e0424dccef4dc1299b5a70c9f839a /arch/x86_64/src/context_switching/main.cpp
parentdb555089dea369d9dd3010d1853077e7a4118b90 (diff)
downloadteachos-a6c5f6a273d0c5c4161f600fca6d4fe49858c23c.tar.xz
teachos-a6c5f6a273d0c5c4161f600fca6d4fe49858c23c.zip
Attempt to fix crash in far jump. WIP does not return from call to assembler method
Diffstat (limited to 'arch/x86_64/src/context_switching/main.cpp')
-rw-r--r--arch/x86_64/src/context_switching/main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86_64/src/context_switching/main.cpp b/arch/x86_64/src/context_switching/main.cpp
index 95a25e0..c3c0cf0 100644
--- a/arch/x86_64/src/context_switching/main.cpp
+++ b/arch/x86_64/src/context_switching/main.cpp
@@ -13,7 +13,10 @@ namespace teachos::arch::context_switching
decltype(auto) global_descriptor_table = segment_descriptor_table::initialize_global_descriptor_table();
decltype(auto) interrupt_descriptor_table = interrupt_descriptor_table::initialize_interrupt_descriptor_table();
- kernel::cpu::jmp((uint64_t)&global_descriptor_table.at(1), boot::segment_register_reload_pointer);
+ interrupt_descriptor_table::segment_selector segment_selector{
+ 1U, interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_KERNEL};
+ kernel::cpu::far_pointer pointer{boot::segment_register_reload_pointer, segment_selector};
+ kernel::cpu::jmp(pointer);
// Load task state segment descriptor from the last element in the global descriptor table, done by calculating
// offset in bytes to the start of the segment descriptor (5 * 16) = 80