Hey guys, this is by far one of the most annoying and worst bugs I have ever encountered in my system. So I have a GDT setup, and a IDT, and Interrupts are enabled and working. Everything works. If I set the PIT to run super faster, no issues. My code gets called, nothing crashes, I can switch tasks, the works. But the second I pressed a ton of keyboard keys, Bochs prints out "fetch_raw_descriptor: LDTR.valid=0" and it doesn't always happen. I can press a ton and it never happens and then it does. But whats odd is if I set the PIT to a slower speed and do that it takes a much longer time to actually cause a crash. But here's the annoying part, the keyboard code is super basic. I pretty much wiped it to nothing thinking it was a issue with the stack. I don't think it is.
In my main interrupt function that gets called in my ISR is my keyboard code.
Code: Select all
push 0x60
call IOPort_Read_8
pop eax
Code: Select all
;Input:
; - (int) Address
;Ouput:
; - (int) Data
;Description: Reads data from an ioport.
IOPort_Read_8_Return: db 0,0,0,0
IOPort_Read_8:
call Thread_Lock
pop dword[IOPort_Read_8_Return] ;Save the return address
pop edx ;Address
in al, dx
MOVZX eax, al
push eax
push dword[IOPort_Read_8_Return] ;Restore the return address
call Thread_Unlock
ret ;Return
Thanks, Matt