Hey, I've recently been working on implementing an IDT and everything seems to be working fine, but after quite a few key presses a general protection fault occurs and I'm unable to identify what's wrong. Help would be greatly appreciated.
Code: https://github.com/LeonTheDev/Trout/tre ... rc/cpu/idt
(IDT) General protection fault after a few key presses
-
- Posts: 3
- Joined: Mon Jan 10, 2022 12:04 pm
- Libera.chat IRC: leon
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: (IDT) General protection fault after a few key presses
Your assembly stub does not save registers that will be clobbered by the C++ code. Your assembly stub does not ensure registers contain values that are appropriate for the C++ ABI (particularly RFLAGS.DF and RSP). Your "irq" variable will be clobbered by any nested interrupts. Your assembly stub for exceptions that push error codes onto the stack does not pass the error code to the exception handler.
What have you tried so far to debug the issue?
What have you tried so far to debug the issue?