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/segment_descriptor_table/gdt_flags.hpp17
-rw-r--r--arch/x86_64/include/arch/context_switching/segment_descriptor_table/global_descriptor_table_pointer.hpp4
-rw-r--r--arch/x86_64/include/arch/kernel/cpu/jmp.hpp7
4 files changed, 18 insertions, 12 deletions
diff --git a/arch/x86_64/include/arch/boot/pointers.hpp b/arch/x86_64/include/arch/boot/pointers.hpp
index c08de52..9bf5cfd 100644
--- a/arch/x86_64/include/arch/boot/pointers.hpp
+++ b/arch/x86_64/include/arch/boot/pointers.hpp
@@ -13,7 +13,7 @@ namespace teachos::arch::boot
/**
* @brief Address pointing to the method that clears all segment registers.
*/
- extern "C" size_t reload_segment_register;
+ extern "C" void reload_segment_register();
} // namespace teachos::arch::boot
diff --git a/arch/x86_64/include/arch/context_switching/segment_descriptor_table/gdt_flags.hpp b/arch/x86_64/include/arch/context_switching/segment_descriptor_table/gdt_flags.hpp
index fdf0044..764aec5 100644
--- a/arch/x86_64/include/arch/context_switching/segment_descriptor_table/gdt_flags.hpp
+++ b/arch/x86_64/include/arch/context_switching/segment_descriptor_table/gdt_flags.hpp
@@ -18,17 +18,24 @@ namespace teachos::arch::context_switching::segment_descriptor_table
*/
enum bitset : uint8_t
{
- LENGTH = 1U << 0U, ///< Defines in IA-32e mode (64-bit code and 32-bit compatability mode) if the segment
- ///< contains 64-bit code. Otherwise this bit should always be 0. Enable if instructions are
- ///< executed in 64-bit code, otherwise they are executed in compatability 32-bit mode. If bis
- ///< is set the DEFAULT_LENGTH bis needs to be 0
+ LONG_MODE = 1U << 1U, ///< Defines in IA-32e mode (64-bit code and 32-bit compatability mode) if the segment
+ ///< contains 64-bit code. Otherwise this bit should always be 0. Enable if instructions are
+ ///< executed in 64-bit code, otherwise they are executed in compatability 32-bit mode. If bis
+ ///< is set the DEFAULT_LENGTH bis needs to be 0
+
+ // FIXME: Where does this come from, and is this value correct?
UPPER_BOUND = 1U << 1U, ///< Specifies the upper bound of the segment for expand down data segment. Enable for 5
///< GiB, 4 KiB otherwise.
+
+ // FIXME: Where does this come from, and is this value correct?
STACK_POINTER_SIZE = 1U << 1U, ///< Specifies the size of the Stack Pointer (SP) for stack segments used for
///< implicit stack operations. Enable for 32 bit, 16 bit otherwise.
+
+ // FIXME: Where does this come from, and is this value correct?
DEFAULT_LENGTH = 1U << 1U, ///< Indicates the default length for code segments with effective addresses and
///< operands. Enable for 32 bit, 16 bit otherwise.
- GRANULARITY = 1U << 2U, ///< Indicates the size the Limit value in the segment descriptor is scaled by 1 Byte
+
+ GRANULARITY = 1U << 3U, ///< Indicates the size the Limit value in the segment descriptor is scaled by 1 Byte
///< blocks if the bit is not set or by 4 KiB blocks if the bit is set.
};
diff --git a/arch/x86_64/include/arch/context_switching/segment_descriptor_table/global_descriptor_table_pointer.hpp b/arch/x86_64/include/arch/context_switching/segment_descriptor_table/global_descriptor_table_pointer.hpp
index 13d6f53..6fac2a0 100644
--- a/arch/x86_64/include/arch/context_switching/segment_descriptor_table/global_descriptor_table_pointer.hpp
+++ b/arch/x86_64/include/arch/context_switching/segment_descriptor_table/global_descriptor_table_pointer.hpp
@@ -26,7 +26,7 @@ namespace teachos::arch::context_switching::segment_descriptor_table
/**
* @brief Constructor.
*/
- global_descriptor_table_pointer(uint16_t table_length, global_descriptor_table * address);
+ global_descriptor_table_pointer(uint16_t table_length, segment_descriptor * address);
/**
* @brief Defaulted three-way comparsion operator.
@@ -35,7 +35,7 @@ namespace teachos::arch::context_switching::segment_descriptor_table
private:
uint16_t table_length = {}; ///< The amount of segment descriptor entries in the global descriptor table - 1.
- global_descriptor_table * address = {}; ///< Non-owning pointer to the GDT base address.
+ segment_descriptor * address = {}; ///< Non-owning pointer to the GDT base address.
};
} // namespace teachos::arch::context_switching::segment_descriptor_table
diff --git a/arch/x86_64/include/arch/kernel/cpu/jmp.hpp b/arch/x86_64/include/arch/kernel/cpu/jmp.hpp
index 163fac6..0ed38e9 100644
--- a/arch/x86_64/include/arch/kernel/cpu/jmp.hpp
+++ b/arch/x86_64/include/arch/kernel/cpu/jmp.hpp
@@ -10,11 +10,10 @@ namespace teachos::arch::kernel::cpu
/**
* @brief Far jump - A jump to an instruction located in a different segment.
*/
- struct [[gnu::packed]] far_pointer
+ struct far_pointer
{
- std::size_t function; ///< Address of the function we want to jump too. (0- 63)
- context_switching::interrupt_descriptor_table::segment_selector
- selector; ///< Segment selector that shows the segment we want to jump into. (64 - 79)
+ void (*function)(); ///< Address of the function we want to jump too. (0-63)
+ std::uint16_t index; ///< Index of the GDT entry we want to load into register CS. (64-79)
};
/**