PS/2 Keyboard, USB emulation and IRQ1 issues :/
Posted: Tue Apr 14, 2020 4:03 pm
Hi all,
I hope youre all well. I feel slightly ashamed to be asking this as a first post but here goes.
Im writing a keyboard initialisation routine and driver for a Long mode OS that ive started developing that seems to be going nowhere and its driving me up the wall.
My biggest issue is that the code works on Bochs but when I try it on two fairly modern computers, it comes to no avail. I assumed that it is the USB emulation layer causing me grief, so I disabled SMIs in the LEGSUP registers for UHCI, EHCI and xHCI controllers (the routines detect, run through the OS handoff routine for the latter two, set the registers and soft reset the controllers; or so I think), and nothing. I still get nothing. The driver works in Bochs perfectly, even without this USB kerfuffle; every time a key is pressed, IRQ 1 is fired and the scan code is added to the buffer. Currently, im running an infinite loop of software interrupts (akin to just doing a loop of "xor ax, ax, int 16h, mov ah, 0Eh, int 10h"), which right now prints the scan codes to screen at the end of the init routine to check the hardware has been initialised properly. From the testing ive done, ive noticed is that IRQ1 is not being fired on neither of the real computers. More frustratingly, on one of the real computers, ive actually got a PS/2 keyboard connected but still nothing and im starting to lose my mind.
Does anyone have any idea what could be going on?
My general initialisation routine is as follows:
1) Interrupt disabling and PIC masking
2) Basic PCI enumeration and USB HC acquirement and deactivation (ish, im still not sure)
3) PIC remapping (I really dont want to use the APIC, just for simplicities sake, at least for now)
4) IDT writing and interrupt enabling with PIC line unmasking once a particular devices initialisation routine has been run through (ie, once I finish the keyboard init routine, I unmask line 1 of PIC1).
Ive done this sort of keyboard initialisation many times before on simpler hardware (pre-USB computers that are 15 years older than me, go figure ) so i cannot for the life of me figure out what is going on!
Also, im writing this all in assembly (I know, it makes life a lot harder but Im just an assembly geek), so sorry if things seem like a bit of a mess. It was all neat and nice to read until this starting destroying my nerves
Anyway, thanks in advance, and nice to join you all!
I hope youre all well. I feel slightly ashamed to be asking this as a first post but here goes.
Im writing a keyboard initialisation routine and driver for a Long mode OS that ive started developing that seems to be going nowhere and its driving me up the wall.
My biggest issue is that the code works on Bochs but when I try it on two fairly modern computers, it comes to no avail. I assumed that it is the USB emulation layer causing me grief, so I disabled SMIs in the LEGSUP registers for UHCI, EHCI and xHCI controllers (the routines detect, run through the OS handoff routine for the latter two, set the registers and soft reset the controllers; or so I think), and nothing. I still get nothing. The driver works in Bochs perfectly, even without this USB kerfuffle; every time a key is pressed, IRQ 1 is fired and the scan code is added to the buffer. Currently, im running an infinite loop of software interrupts (akin to just doing a loop of "xor ax, ax, int 16h, mov ah, 0Eh, int 10h"), which right now prints the scan codes to screen at the end of the init routine to check the hardware has been initialised properly. From the testing ive done, ive noticed is that IRQ1 is not being fired on neither of the real computers. More frustratingly, on one of the real computers, ive actually got a PS/2 keyboard connected but still nothing and im starting to lose my mind.
Does anyone have any idea what could be going on?
My general initialisation routine is as follows:
1) Interrupt disabling and PIC masking
2) Basic PCI enumeration and USB HC acquirement and deactivation (ish, im still not sure)
3) PIC remapping (I really dont want to use the APIC, just for simplicities sake, at least for now)
4) IDT writing and interrupt enabling with PIC line unmasking once a particular devices initialisation routine has been run through (ie, once I finish the keyboard init routine, I unmask line 1 of PIC1).
Ive done this sort of keyboard initialisation many times before on simpler hardware (pre-USB computers that are 15 years older than me, go figure ) so i cannot for the life of me figure out what is going on!
Also, im writing this all in assembly (I know, it makes life a lot harder but Im just an assembly geek), so sorry if things seem like a bit of a mess. It was all neat and nice to read until this starting destroying my nerves
Anyway, thanks in advance, and nice to join you all!