IOAPIC Troubles
Posted: Sun Jun 10, 2012 11:21 am
Hi all, for the past 2 weeks or so I've been trying to fix this problem on and off.
My implementation of the IOAPIC/LAPIC appears to be faulty, Boch's reports no problems in the log however...
The problem is that the system encounters a hardware hang (Verified on both Bochs and VBox). Using Boch's debugger, if I continue execution as normal and then break and attempt to single step it hangs on the same RIP (mov rax, <address of kernel function>).
I believe the problem is with the redirection table not being configured correctly, I read somewhere that it might cause this kind of hardware hang (The APIC tries to deliver the interrupt but does not know how so the machine enters a deadlock state). I also verified that the interrupt (PIT IRQ) never gets called. The hang occurs before any interrupt is executed.
Here's my implementation:
xapic.c http://pastebin.com/njL1xHsW
xapic.h http://pastebin.com/qsGgb5Jy
os/driver.h http://pastebin.com/7piSxS5S
misc/mp.h http://pastebin.com/Zjvuf5eG
OS Output: http://i.imgur.com/RrkW2.png
I'm completely at a loss, I have no idea why this is happening. I've tried at least 3 different redirection table configurations at this point, none of the other code seems to be invalid, I also know that the redirection table's values are being set to the expected value (read the values back after being written).
Cheers.
My implementation of the IOAPIC/LAPIC appears to be faulty, Boch's reports no problems in the log however...
The problem is that the system encounters a hardware hang (Verified on both Bochs and VBox). Using Boch's debugger, if I continue execution as normal and then break and attempt to single step it hangs on the same RIP (mov rax, <address of kernel function>).
I believe the problem is with the redirection table not being configured correctly, I read somewhere that it might cause this kind of hardware hang (The APIC tries to deliver the interrupt but does not know how so the machine enters a deadlock state). I also verified that the interrupt (PIT IRQ) never gets called. The hang occurs before any interrupt is executed.
Here's my implementation:
xapic.c http://pastebin.com/njL1xHsW
xapic.h http://pastebin.com/qsGgb5Jy
os/driver.h http://pastebin.com/7piSxS5S
misc/mp.h http://pastebin.com/Zjvuf5eG
OS Output: http://i.imgur.com/RrkW2.png
I'm completely at a loss, I have no idea why this is happening. I've tried at least 3 different redirection table configurations at this point, none of the other code seems to be invalid, I also know that the redirection table's values are being set to the expected value (read the values back after being written).
Cheers.