aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/boot/pointers.hpp2
-rw-r--r--arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp9
-rw-r--r--arch/x86_64/include/arch/kernel/cpu/if.hpp7
-rw-r--r--arch/x86_64/include/arch/kernel/cpu/jmp.hpp14
4 files changed, 22 insertions, 10 deletions
diff --git a/arch/x86_64/include/arch/boot/pointers.hpp b/arch/x86_64/include/arch/boot/pointers.hpp
index 2a43f22..5bcb792 100644
--- a/arch/x86_64/include/arch/boot/pointers.hpp
+++ b/arch/x86_64/include/arch/boot/pointers.hpp
@@ -11,7 +11,7 @@ namespace teachos::arch::boot
extern "C" size_t const multiboot_information_pointer;
/**
- * @brief Address pointing to the start of the multiboot information structure.
+ * @brief Address pointing to the method that clears all segment registers.
*/
extern "C" size_t const segment_register_reload_pointer;
diff --git a/arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp b/arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
index c31e2d0..73cd176 100644
--- a/arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
+++ b/arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
@@ -43,7 +43,8 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
/**
* @brief Constructor.
*
- * @param index Index into the local or global descriptor table.
+ * @param index Index into the local or global descriptor table. Processor multiplies the index value by 16 (number
+ * of bytes in segment descriptor) and adds the result to the base address.
* @param flags Allows to set flags for the flags field using the unscoped enum contained in this class, used to
* allow for direct integer conversion.
*/
@@ -66,8 +67,10 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
auto operator<=>(segment_selector const & other) const -> std::strong_ordering = default;
private:
- uint8_t _flags : 3 = {}; ///< Underlying bits used to read the flags from.
- uint16_t _index : 13 = {}; ///< Index into the local or global descriptor table.
+ uint8_t _flags : 3 = {}; ///< Underlying bits used to read the flags from.
+ uint16_t _index : 13 =
+ {}; ///< Index into the local or global descriptor table. Processor multiplies the index value by 16 (number of
+ ///< bytes in segment descriptor) and adds the result to the base address.
};
} // namespace teachos::arch::context_switching::interrupt_descriptor_table
diff --git a/arch/x86_64/include/arch/kernel/cpu/if.hpp b/arch/x86_64/include/arch/kernel/cpu/if.hpp
index 51f5d9a..48707dc 100644
--- a/arch/x86_64/include/arch/kernel/cpu/if.hpp
+++ b/arch/x86_64/include/arch/kernel/cpu/if.hpp
@@ -9,6 +9,13 @@ namespace teachos::arch::kernel::cpu
*/
auto set_interrupt_flag() -> void;
+ /**
+ * @brief Clears the interrupt flag (IF) in the EFLAGS register.
+ * This will stop the processor to respond to maskable hardware interrupts and needs to be done before changing the
+ * Interrupt Descriptor Table with lidt.
+ */
+ auto clear_interrupt_flag() -> void;
+
} // namespace teachos::arch::kernel::cpu
#endif // TEACHOS_ARCH_X86_64_KERNEL_CPU_IF_HPP
diff --git a/arch/x86_64/include/arch/kernel/cpu/jmp.hpp b/arch/x86_64/include/arch/kernel/cpu/jmp.hpp
index 666174c..5bc7d07 100644
--- a/arch/x86_64/include/arch/kernel/cpu/jmp.hpp
+++ b/arch/x86_64/include/arch/kernel/cpu/jmp.hpp
@@ -1,6 +1,8 @@
#ifndef TEACHOS_ARCH_X86_64_KERNEL_CPU_JMP_HPP
#define TEACHOS_ARCH_X86_64_KERNEL_CPU_JMP_HPP
+#include "arch/context_switching/interrupt_descriptor_table/segment_selector.hpp"
+
#include <cstdint>
namespace teachos::arch::kernel::cpu
@@ -10,14 +12,15 @@ namespace teachos::arch::kernel::cpu
*/
struct [[gnu::packed]] far_pointer
{
- uint64_t offset; ///< Selector of the segment in which the jump occurs.
- uint16_t segment; ///< Address to jump to within the segment.
+ uint64_t offset; ///< Selector of the segment in which the jump occurs. (0- 63)
+ context_switching::interrupt_descriptor_table::segment_selector
+ selector; ///< Address to jump to within the segment. (64 - 79)
};
/**
* @brief Near jump - A jump to an instruction within the current code segment.
*
- * @param address to jump to.
+ * @param address Address we want to jump to.
*/
auto jmp(uint64_t address) -> void;
@@ -25,10 +28,9 @@ namespace teachos::arch::kernel::cpu
* @brief Far jump - A jump to an instruction located in a different segment than the current code segment but at the
* same privilege level.
*
- * @param segment in which the jump occurs.
- * @param offset to jump to.
+ * @param pointer 64-bit operand size far pointer that we should jump too.
*/
- auto jmp(uint64_t segment, uint64_t offset) -> void;
+ auto jmp(far_pointer pointer) -> void;
} // namespace teachos::arch::kernel::cpu