Brendan wrote:
Hi,
pedrodemargomes wrote:
I dont know whats wrong with my code.
My problem is that when an interruption happens, the virtualbox crash.
Can someone help me, please?
Start by trying to figure out if the problem is the IDT itself or in the "keyboard specific" part of the IRQ handler. An easy way to do this is to change "keyboard_handler" so it only does "iret" and nothing else - if that crashes there's a problem with the IDT itself (IDT base, IDT limit, pages IDT uses aren't mapped properly, ...) or that specific IDT entry (wrong interrupt, wrong IDT entry, wrong fields); and if that doesn't crash then the problem would be in something that "keyboard_handler_main()" does (e.g. maybe there's a bug in "printfHex()" that has nothing to do keyboard or IRQs).
The next step would be to try to divide the possibilities again - maybe (if the problem was something to do with the IDT) try starting the interrupt handler with a software interrupt (to rule out the possibly of "wrong interrupt"); maybe (if the problem was something to do with the "keyboard_handler_main()") you can comment out lines of code to determine which one is the problem.
Once you've run out of ways to divide the possibilities you'd want to gather more information about the symptoms. What happens in other emulators? If there's an exception, which one (and what does the CPU tell you about the exception)? Can you put a breakpoint just before the crash and single-step (while checking everything at between each step)?
Eventually you'll have a very specific idea of where the problem is, and enough information about the symptoms to figure out exactly what is going on (and probably have a very good idea of some way to fix the problem).
Cheers,
Brendan
I did all of that and i discovered that the problem is located in the part where i set the IDT.
The error message is
--------------------------------------------------------------------------------
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
!! Guru Meditation 1155 (VINF_EM_TRIPLE_FAULT)
!!
!! Skipping ring-0 registers and stack, rcErr=VINF_EM_TRIPLE_FAULT
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DBGF: No debugger attached, waiting 1 second for one to attach (event=100)
1.Stopping the VM!
I still dont get what i am doing wrong.