Fix kernel crash after an interrupt occurs on the BSP

This commit is contained in:
Alex 2023-04-11 11:30:37 +03:00
parent 046c693a52
commit fa4713fdff
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 5 additions and 2 deletions

View File

@ -63,6 +63,7 @@ namespace InterruptDescriptorTable
extern "C" __naked __used __no_stack_protector __aligned(16) void ExceptionHandlerStub()
{
asm("cld\n"
"cli\n"
"pushq %rax\n"
"pushq %rbx\n"
@ -107,6 +108,7 @@ namespace InterruptDescriptorTable
extern "C" __naked __used __no_stack_protector __aligned(16) void InterruptHandlerStub()
{
asm("cld\n"
"cli\n"
"pushq %rax\n"
"pushq %rbx\n"
@ -145,6 +147,7 @@ namespace InterruptDescriptorTable
"addq $16, %rsp\n"
"sti\n"
"iretq"); // pop CS RIP RFLAGS SS RSP
}

View File

@ -74,8 +74,8 @@ LockClass mExtTrkLock;
* - [ ] Rework the stack guard.
*
* ISSUES:
* - [ ] Kernel stack is smashed when an interrupt occurs. (this bug it occurs when an interrupt like IRQ1 or IRQ12 occurs)
* - [?] After setting the new stack pointer, the kernel crashes with an invalid opcode.
* - [x] Kernel stack is smashed when an interrupt occurs. (this bug it occurs when an interrupt like IRQ1 or IRQ12 occurs)
* - [x] After setting the new stack pointer, the kernel crashes with an invalid opcode.
* - [ ] Somewhere in the kernel, the memory is wrongly freed or memcpy/memset.
* - [ ] GlobalDescriptorTable::SetKernelStack() is not working properly.
* - [ ] Sometimes while the kernel is inside BeforeShutdown(), we end up in a deadlock.