diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2025-04-04 15:05:59 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2025-04-04 15:06:01 +0000 |
| commit | 8b66e4cd1d1487fefbae459f556396db61497a6b (patch) | |
| tree | 5c16241f3bce1671798809f2da9dc2e6f44dd6ee /arch/x86_64/include | |
| parent | f19681f4dfaaa0bdd3f22e76c48abda3c68bfe0c (diff) | |
| download | teachos-8b66e4cd1d1487fefbae459f556396db61497a6b.tar.xz teachos-8b66e4cd1d1487fefbae459f556396db61497a6b.zip | |
Multiplication by two for segment selector index
Diffstat (limited to 'arch/x86_64/include')
| -rw-r--r-- | arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
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 2c90152..b31f9e8 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,8 +43,12 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table /** * @brief Constructor. * - * @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 index Index into the local or global descriptor table. Processor multiplies the index value by 8 (number + * of bytes in 32-bit segment descriptor) and adds the result to the base GDT or LDT address. Because it only + * multiplies by 8, but we are using long mode the constructor additionally multiplies the given value by two. This + * is done because 64-bit segment descriptor are twice as big in size. If we wouldn't multiply by two, index 1 would + * result in the middle between the second part of the null entry and the first part of the code kernel segment and + * therefore be invalid. * @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. */ |
