diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2025-03-10 16:05:31 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2025-03-10 16:05:31 +0000 |
| commit | 52fffdf2c76def4a875e0328eb45d74c6e97e805 (patch) | |
| tree | 39e712ac4eaa968dd0d3adf4110aa7493cd58713 /arch/x86_64/include | |
| parent | c5151739698620e77622423c109e638f903f01c4 (diff) | |
| download | teachos-52fffdf2c76def4a875e0328eb45d74c6e97e805.tar.xz teachos-52fffdf2c76def4a875e0328eb45d74c6e97e805.zip | |
Adjust segment descriptor to use defined helpers
Diffstat (limited to 'arch/x86_64/include')
| -rw-r--r-- | arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp index b7665d9..59f99f6 100644 --- a/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp +++ b/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp @@ -1,44 +1,44 @@ #ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_SEGMENT_DESCRIPTOR_HPP #define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_SEGMENT_DESCRIPTOR_HPP +#include "arch/context_switching/descriptor_table/access_byte.hpp" #include "arch/context_switching/descriptor_table/gdt_flags.hpp" - -#include <bitset> +#include "arch/context_switching/descriptor_table/segment_descriptor_type.hpp" +#include "arch/context_switching/descriptor_table/type_field.hpp" namespace teachos::arch::context_switching::descriptor_table { + __extension__ typedef __int128 int128_t; + __extension__ typedef unsigned __int128 uint128_t; - /* - TODO: Lookup segment_descriptor in intel manual chapter 3.4.5 - */ - + /** + * @brief Defines helper function for all states and the actual data the segment descriptor can have. + */ struct segment_descriptor { /** - * @brief Possible set bits in our underlying std::bitset and the meaning when they are set. + * @brief Constructor. + * + * @note Created segment descriptor copies the given bytes into theese components ending with a 32 bit reserved + * field that has to be used, because the 64-bit segment descriptor needs to be big enough for two 32-bit segment + * descriptor. + * - 8 bit Access Type + * - 4 bit Flags + * - 64 bit Base Address + * - 20 bit Limit + * + * @param flags Copies the bits set from the given data into the individual components of a segment + * descriptor. */ - enum bitset : uint64_t - { - BASE = 1U << 0U, - FLAGS = 1U << 8U, - LIMIT = 1U << 12U, - ACCESS_BYTE = 1U << 16U, - BASE = 1U << 32U, - BASE = 1U << 40U, - LIMIT = 1U << 56U - }; - - explicit segment_descriptor(uint64_t flags) - : flags(flags) - { - // Nothing to do - } + explicit segment_descriptor(uint128_t flags); private: - std::uint8_t base1; - gdt_flags flags; - std::bitset<64U> flags; ///< Underlying bitset used to read the flags from + uint32_t _reserved; + access_byte _access; + gdt_flags _flag; + uint64_t _base; + std::bitset<20U> _limit; }; } // namespace teachos::arch::context_switching::descriptor_table -#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_SEGMENT_DESCRIPTOR_HPP
\ No newline at end of file +#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_SEGMENT_DESCRIPTOR_HPP |
