OSDev.org https://forum.osdev.org/ |
|
Can't get keyboard working when booting with GRUB https://forum.osdev.org/viewtopic.php?f=1&t=33182 |
Page 1 of 1 |
Author: | KSMb [ Wed Sep 12, 2018 3:57 am ] |
Post subject: | Can't get keyboard working when booting with GRUB |
Hi! I'm trying to get my toy-os working with GRUB since i want to use it on real hardware. For this reason i implemented a multiboot header (as described here) and a minimal grub.cfg file. All seems to works fine(IRSs and IRQs are correctly loaded) except for the keyboard driver: for some reason i can't type nothing into the console. The weird thing is that, without GRUB(loading the bootsector as a floppy image in QEMU), the keyboard driver works and i can type things on it. Here on the forum i read that this can be a problem related with the GDT, but i've implemented it and it is loaded successfully before actually loading the kernel, and,as i said before,it works without QEMU. What could be the cause of this problem? If it can be helpful i post the source code of the GDT: Code: gdt_start:
dd 0x0 dd 0x0 ; code segment descriptor gdt_code: dw 0xffff dw 0x0 db 0x0 db 10011010b db 11001111b db 0x0 ; data segment descriptor gdt_data: dw 0xffff dw 0x0 db 0x0 db 10010010b db 11001111b db 0x0 ) gdt_end: gdt_descriptor: dw gdt_end - gdt_start - 1 ; the size dd gdt_start ; start address of the gdt CODE_SEG equ gdt_code - gdt_start DATA_SEG equ gdt_data - gdt_start |
Author: | iansjack [ Wed Sep 12, 2018 4:04 am ] |
Post subject: | Re: Can't get keyboard working when booting with GRUB |
You really need to provide a link to an online repository of sour source code before anyone can make sensible suggestions. Posting random selections is unlikely to pinpoint the problem. |
Author: | Brendan [ Wed Sep 12, 2018 4:23 am ] |
Post subject: | Re: Can't get keyboard working when booting with GRUB |
Hi, KSMb wrote: All seems to works fine(IRSs and IRQs are correctly loaded) except for the keyboard driver: for some reason i can't type nothing into the console. The weird thing is that, without GRUB(loading the bootsector as a floppy image in QEMU), the keyboard driver works and i can type things on it. Consider this:
The end result is that the PS/2 controller is left in a "one-byte buffer full" state waiting for an IRQ handler to read from its buffer, where the IRQ was lost so nothing will read the buffer, and where the PS/2 controller can't accept any more bytes from the keyboard because that buffer is full. To work around this; you can do a few dummy "in al,0x60" instructions to clear the buffer (the "Step 4" mentioned here). Cheers, Brendan |
Author: | KSMb [ Wed Sep 12, 2018 9:05 am ] |
Post subject: | Re: Can't get keyboard working when booting with GRUB |
Quote: To work around this; you can do a few dummy "in al,0x60" instructions to clear the buffer (the "Step 4" mentioned here). Thanks for your reply. I've just tried to clear the buffer on the port 0x60 but the situation still the same...from the wiki page about the PS/2 Controller i also tried to implement the Cpu Reset but without any success. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |