Mike wrote:Hm... We might need to see how you have set everything up to answer that one. I assume you enabled hardware interrupts (sti instruction)?
What hardware interrupts have you tried?
Thanks for the reply. The interrupts I have tried is 0 and 1 for the timer and the keyboard. The keyboard never fires, because the timer goes first, and then they all stop. However, I disabled all IRQs once except the one for the keyboard, and then it let me hit one key, then they all stopped.
Yes, I did use sti.
I don't have my code on this computer, but all it is is tutorial 15 + the information from your PIC tutorial to remap the PIC + writing the timer handler and the keyboard handler to IRs 32 and 33. My timer and keyboard code isn't the problem though because I tried setting the handlers to just a simple handler to print some text, and it still only triggers once.
[edit]
I'll try to give a bit more information.
After the HAL is initialized, I remap the PIC, then set the the timer and keyboard to their respective IRs, then I use sti. I commented out the asm code in kmain() before "for(;; );" because it was clearing interrupts and I didn't know if that was the problem. I've moved sti around to see if that helped (like before I set the handlers), but still no luck.
[edit x2]
As it turns out, this is affecting all my interrupts. For example, I forced a divide by zero exception. The handler fired. Then I tried another one right behind it, and the handler didn't fire. At first I thought maybe the system was halting after each interrupts, but I placed some DebugPrintf messages after where I forced the exception, and they displayed. So it seems my interrupts are getting disabled all together.
[edit x3]
Just wanted to point out one more thing. When I use geninterrupt(0), it takes me to the default handler; however, if I use _asm int 0, it takes me to my interrupt 0 handler.
[edit x4]
This pertains to the geninterrupt problem. It works (as in, it triggers the right handler), but immediately after it generates an invalid opcode exception.
[edit x5]
Hardware interrupt problem solved. I put "_asm cli;" at the beginning of my handler and "outportb(0x20,0x20); _asm sti;" at the end, and it works now. However, I'm still having an issue with firing the same software interrupt back-to-back.