Hey all,
I am new to the x86 and OS development in general. So far, I have setup a GDT and IDT (these appear to work) and transitioned to protected mode. I have also transitioned to graphics mode and written a very simple VGA puts/putc function. However, now I am trying to add keyboard interaction to my OS.
I have looked at the code on the wiki for keyboard interaction and I appear to have done everything correctly (or so I think...). I have also consulted the following link: http://www.computer-engineering.org/ps2keyboard/. I can read 0x64 and 0x60, but the IBUF value is NEVER set and I never generate an interrupt. I know interrupts work because I can manually call one, like 0x09 or 0x10 and print a string to the screen.
I am using the bochs x86 emulator to test my OS and also VMWare (not generating interrupts on either... :'(). I pretty much used http://www.jamesmolloy.co.uk/tutorial_h ... 20IDT.html to setup my GDT and IDT, so I believe them to be correct. I also tried remapping the IRQs using the code on the wiki, but I still didn't get any interrupts. I figure I should get int 0x9 anyway, even without the mapping. I have also tried reading port 0x60 until the OUTBF is cleared in the 0x64 status register, but that didn't seem to help either.
Please let me know what I can provide (code fragments, screenshots, bochs register data, etc.) so that my problem can be best diagnosed. I appreciate any and all help.
Thank you.
Keyboard does not gen IRQ
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Keyboard does not gen IRQ
You have enabled interrupts, right?
Also, interrupts should not be assigned to vectors < 32, since those are reserved by the processor
Also, interrupts should not be assigned to vectors < 32, since those are reserved by the processor
Re: Keyboard does not gen IRQ
I thought I had interrupts enabled, but I added in a call to "sti" to make sure. This has resulting in me receiving the following interrupts: 0x8, followed by neverending 0xD. Bochs gives me the following: "conforming code seg descriptor dpl>cpl, dpl=3, cpl=2". I am confused by this because only my 4th and 5th GDT entries have a ring level of 3. As far as I know I am using only the 2nd and 3rd entries which have a ring level of 0... (the first entry is of course null).
If I break the process, I am at a code segment of 0x8... which should have a dpl of 0... Perhaps I don't understand the GDT as well as I thought.
Any ideas or information I can provide to help?
Thank you.
If I break the process, I am at a code segment of 0x8... which should have a dpl of 0... Perhaps I don't understand the GDT as well as I thought.
Any ideas or information I can provide to help?
Thank you.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Keyboard does not gen IRQ
You *should* remap the IRQ interrupts. Most likely, you are getting a timer interrupt (no error code), you treat it like a doublefault (with error code), with as a result gives you a corrupt stack...
Re: Keyboard does not gen IRQ
I tried remapping the interrupts (using the code found in the wiki) and I even tried masking all the PICM/PICS interrupts to prevent the timer or keyboard from interfering. However, I still get an int 0x8 followed by neverending 0xDs...
Oops! I had an error in my outb function. This seems to fix the code descriptor error and neverending 0xDs. However, now I get a PANIC! (in bochs) when writing to port 0x20...? I don't think my remap code is working as a result. In addition, I only get ONE 0x8 interrupt and no additional interrupts .
Thank you for your continued help!
Oops! I had an error in my outb function. This seems to fix the code descriptor error and neverending 0xDs. However, now I get a PANIC! (in bochs) when writing to port 0x20...? I don't think my remap code is working as a result. In addition, I only get ONE 0x8 interrupt and no additional interrupts .
Thank you for your continued help!
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: Keyboard does not gen IRQ
What is the panic message you get from Bochs?
Re: Keyboard does not gen IRQ
">>PANIC<< write to port 20h = 21"
Wow, ok I just realized I was using my outb(data, port) function backwards. This appears to be the root of most of my problems...
I feel pretty foolish...
Thanks alot for the help all, I think I am all set now as I am generating interrupts when I press a key!!!
Wow, ok I just realized I was using my outb(data, port) function backwards. This appears to be the root of most of my problems...
I feel pretty foolish...
Thanks alot for the help all, I think I am all set now as I am generating interrupts when I press a key!!!