kernel/idt: Fix ExceptionHandlerStub setting fs & gs to 0

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2024-12-25 04:49:01 +02:00
parent b471645743
commit 95a8d6fb6f
No known key found for this signature in database
GPG Key ID: 2EE20AF089811A5A

View File

@ -139,10 +139,14 @@ namespace InterruptDescriptorTable
"pushq %r14\n" "pushq %r14\n"
"pushq %r15\n" "pushq %r15\n"
"movq %ds, %rax\n pushq %rax\n" // "movq %ds, %rax\n pushq %rax\n"
"movq %es, %rax\n pushq %rax\n" // "movq %es, %rax\n pushq %rax\n"
"movq %fs, %rax\n pushq %rax\n" // "movq %fs, %rax\n pushq %rax\n"
"movq %gs, %rax\n pushq %rax\n" // "movq %gs, %rax\n pushq %rax\n"
"pushq %rax\n"
"pushq %rax\n"
"pushq %rax\n"
"pushq %rax\n"
"movq %dr7, %rax\n pushq %rax\n" "movq %dr7, %rax\n pushq %rax\n"
"movq %dr6, %rax\n pushq %rax\n" "movq %dr6, %rax\n pushq %rax\n"
@ -173,10 +177,14 @@ namespace InterruptDescriptorTable
"popq %rax\n movq %rax, %dr6\n" "popq %rax\n movq %rax, %dr6\n"
"popq %rax\n movq %rax, %dr7\n" "popq %rax\n movq %rax, %dr7\n"
"popq %rax\n movq %rax, %gs\n" "popq %rax\n"
"popq %rax\n movq %rax, %fs\n" "popq %rax\n"
"popq %rax\n movq %rax, %es\n" "popq %rax\n"
"popq %rax\n movq %rax, %ds\n" "popq %rax\n"
// "popq %rax\n movq %rax, %gs\n"
// "popq %rax\n movq %rax, %fs\n"
// "popq %rax\n movq %rax, %es\n"
// "popq %rax\n movq %rax, %ds\n"
"popq %r15\n" "popq %r15\n"
"popq %r14\n" "popq %r14\n"
@ -273,13 +281,13 @@ namespace InterruptDescriptorTable
/* TODO: Add advanced check so we won't update the cr3 when not needed */ /* TODO: Add advanced check so we won't update the cr3 when not needed */
"movq %cr3, %rax\n pushq %rax\n" /* Push opt */ "movq %cr3, %rax\n pushq %rax\n" /* Push opt */
"pushq %rax\n" /* Push ppt */ "pushq %rax\n" /* Push ppt */
"movq %rsp, %rdi\n" "movq %rsp, %rdi\n"
"call SchedulerInterruptHandler\n" "call SchedulerInterruptHandler\n"
"popq %rax\n movq %rax, %cr3\n" /* Restore to ppt */ "popq %rax\n movq %rax, %cr3\n" /* Restore to ppt */
"popq %rax\n" /* Pop opt */ "popq %rax\n" /* Pop opt */
"popq %r15\n" "popq %r15\n"
"popq %r14\n" "popq %r14\n"