aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
authorFabian Imhof <fabian.imhof@ost.ch>2025-04-05 15:27:20 +0000
committerFabian Imhof <fabian.imhof@ost.ch>2025-04-05 15:27:20 +0000
commita8852f91967a7e55e62e30f5cc07d076092b8b78 (patch)
tree12708befd57fc0b89dbadc2e856c935b71c88807 /arch/x86_64/include
parentc01d080bdc6bd843e840e4834424fe587286b274 (diff)
downloadteachos-a8852f91967a7e55e62e30f5cc07d076092b8b78.tar.xz
teachos-a8852f91967a7e55e62e30f5cc07d076092b8b78.zip
add wip context switch to user mode
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/boot/pointers.hpp5
-rw-r--r--arch/x86_64/include/arch/kernel/cpu/segment_register.hpp23
-rw-r--r--arch/x86_64/include/arch/kernel/cpu/ss.hpp27
3 files changed, 23 insertions, 32 deletions
diff --git a/arch/x86_64/include/arch/boot/pointers.hpp b/arch/x86_64/include/arch/boot/pointers.hpp
index 9bf5cfd..fe9c657 100644
--- a/arch/x86_64/include/arch/boot/pointers.hpp
+++ b/arch/x86_64/include/arch/boot/pointers.hpp
@@ -10,11 +10,6 @@ namespace teachos::arch::boot
*/
extern "C" size_t const multiboot_information_pointer;
- /**
- * @brief Address pointing to the method that clears all segment registers.
- */
- extern "C" void reload_segment_register();
-
} // namespace teachos::arch::boot
#endif // TEACHOS_ARCH_X86_64_BOOT_POINTERS_HPP
diff --git a/arch/x86_64/include/arch/kernel/cpu/segment_register.hpp b/arch/x86_64/include/arch/kernel/cpu/segment_register.hpp
new file mode 100644
index 0000000..bd244fd
--- /dev/null
+++ b/arch/x86_64/include/arch/kernel/cpu/segment_register.hpp
@@ -0,0 +1,23 @@
+#ifndef TEACHOS_ARCH_X86_64_KERNEL_CPU_SEGMENT_REGISTER_HPP
+#define TEACHOS_ARCH_X86_64_KERNEL_CPU_SEGMENT_REGISTER_HPP
+
+#include "arch/context_switching/interrupt_descriptor_table/segment_selector.hpp"
+
+namespace teachos::arch::kernel::cpu
+{
+ /**
+ * @brief Clear all segment registers.
+ */
+ [[gnu::naked]]
+ auto reload_segment_registers() -> void;
+
+ /**
+ * @brief Set the value of all segment registers.
+ *
+ * @param segment_selector
+ */
+ auto set_segment_registers(context_switching::interrupt_descriptor_table::segment_selector segment_selector) -> void;
+
+} // namespace teachos::arch::kernel::cpu
+
+#endif // TEACHOS_ARCH_X86_64_KERNEL_CPU_SEGMENT_REGISTER_HPP
diff --git a/arch/x86_64/include/arch/kernel/cpu/ss.hpp b/arch/x86_64/include/arch/kernel/cpu/ss.hpp
deleted file mode 100644
index b5fa5e3..0000000
--- a/arch/x86_64/include/arch/kernel/cpu/ss.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_KERNEL_CPU_SS_HPP
-#define TEACHOS_ARCH_X86_64_KERNEL_CPU_SS_HPP
-
-#include "arch/context_switching/interrupt_descriptor_table/segment_selector.hpp"
-
-#include <bitset>
-#include <cstdint>
-
-namespace teachos::arch::kernel::cpu
-{
- /**
- * @brief Reads the current value of the stack segment (SS) register.
- *
- * @return The current SS register value.
- */
- auto read_ss() -> context_switching::interrupt_descriptor_table::segment_selector;
-
- /**
- * @brief Writes a new value to the stack segment (SS) register.
- *
- * @param selector The segment selector to be written to SS.
- */
- auto write_ss(context_switching::interrupt_descriptor_table::segment_selector selector) -> void;
-
-} // namespace teachos::arch::kernel::cpu
-
-#endif // TEACHOS_ARCH_X86_64_KERNEL_CPU_SS_HPP