I decided to start work on an interrupt handler so I could get keyboard events. I managed it relatively easy. setting up the IDT entry and stuff.
It works great.. in QEMU.
When I burn the OS to a usb and run it on real hardware it breaks. The OS loads pretty much everything, but then when trying to load_IDT it reboots. I assume its triple faulting?
I managed to narrow down the issue by commenting out sections and trial and error. The exact point that the OS crashes is on the call of STI in the load_IDT function:
Code: Select all
global load_idt
load_idt:
mov edx, [esp + 4]
lidt [edx]
sti ; HERE
ret
I'm not sure what the problem is, why would it run perfectly on QEMU but not real hardware? The laptop I used to test has an AMD processor but I doubt it could be that?
Here is the link to my github: https://github.com/dannywrayuk/DanOS , check kernel.asm and IDT.h