diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-06-25 22:36:17 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-26 11:08:52 +0200 |
commit | 29d9666e0257941f6458933dee9fc1871701dd28 (patch) | |
tree | 43231a33e45966ff12d8425f892f770c99eccf45 | |
parent | ee4fc970387c6fb4d94921152ec31e26190a45a1 (diff) | |
download | serenity-29d9666e0257941f6458933dee9fc1871701dd28.zip |
Kernel: Fix GDT limits
The GDT limits are inclusive, so for correctness we should subtract
one from the structs' size.
-rw-r--r-- | Kernel/Arch/x86/common/Processor.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Arch/x86/common/Processor.cpp b/Kernel/Arch/x86/common/Processor.cpp index 353b811af2..cb84c12ac7 100644 --- a/Kernel/Arch/x86/common/Processor.cpp +++ b/Kernel/Arch/x86/common/Processor.cpp @@ -1074,7 +1074,7 @@ UNMAP_AFTER_INIT void Processor::gdt_init() Descriptor fs_descriptor {}; fs_descriptor.set_base(VirtualAddress { this }); - fs_descriptor.set_limit(sizeof(Processor)); + fs_descriptor.set_limit(sizeof(Processor) - 1); fs_descriptor.dpl = 0; fs_descriptor.segment_present = 1; fs_descriptor.granularity = 0; @@ -1086,7 +1086,7 @@ UNMAP_AFTER_INIT void Processor::gdt_init() Descriptor tss_descriptor {}; tss_descriptor.set_base(VirtualAddress { &m_tss }); - tss_descriptor.set_limit(sizeof(TSS32)); + tss_descriptor.set_limit(sizeof(TSS32) - 1); tss_descriptor.dpl = 0; tss_descriptor.segment_present = 1; tss_descriptor.granularity = 0; |