Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
My PIC and IDT is almost finished now, and it seems to react fine on divide by zero and keyboard strokes...
But when the interrupt has finished, my OS just reboots. How can this be?
this typically occurs when you messes up the stack ... while IRET'ing, the processor finds an invalid segment somewhere and issues an exception.
If your exception processing code is not 100% up and running, you're heading straight towards a system reset (due to a triple fault)
Some C function calling conventions actually expect the function being called to clear off the stack, not the caller. That would screw up the stack for you, and lead to the exception.
The other thing that's a little curious is you reading in a doubleword from port 0x60. The data register is only 1 byte in length, and ports 0x62/0x63 might not even exist on your system. I'm not sure what happens in that scenario (NMI?), but it can't be anything good.
i also know there were versions of NASM mishandling "iret" and "popa/pusha" in 32bits (e.g. not making them "iretd", "popad" and "pushad")... I'm not sure if that's what happening to you but i'd cross-check the bytes generated against the instructions reference as a last resort...
Well, you're right that's what it says to me, but then how can i fix this error? It's pretty anoying, to get an triple fault every time an interrupt ocours...
i cannot tell just like that! Your code seems correct, but obviously either it isn't, or something else occurs (kernel not completely loaded, memory overwritten, or any other NastyBug)
One way to sort out what actually occurs is to request the emulator to produce a list of *every instruction* it performs. This way, you'll be able to check *what* is going wrong and *why* ...
If you can tell me what were the last few instructions that were performed before the triple fault occur, i could probably help better...
Otherwise, making sure that you catch and report exceptions (see the FAQ) can help figuring out what's wrong too, but it's usually harder than watching the trace.