OSDev.org https://forum.osdev.org/ |
|
Reading bad data from keyboard https://forum.osdev.org/viewtopic.php?f=1&t=37347 |
Page 3 of 3 |
Author: | MichaelPetch [ Mon Oct 19, 2020 1:00 pm ] |
Post subject: | Re: Reading bad data from keyboard |
Your IRQ common stub would look like: Code: ; Common IRQ code. Identical to ISR code except for the 'call' One other change I made here was the use of EAX like that of the ISR common stub. Using EBX instead of EAX doesn't get you anything so I changed it to EAX compared with the code you have in Github.
irq_common_stub: pusha mov ax, ds push eax mov ax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax cld push esp call IRQHandler ; Different than the ISR code pop eax pop eax mov ds, ax mov es, ax mov fs, ax mov gs, ax popa add esp, 8 sti iret |
Author: | MichaelPetch [ Mon Oct 19, 2020 1:06 pm ] |
Post subject: | Re: Reading bad data from keyboard |
Someone else mentioned this previously on here. ISRs don't come in on the PIC so don't send any EOIs to the PIC. As well when doing the IRQ handlers you have part of the EOI processing before and after the IRQ handler. To start with to simplify things I would place the EOI processing after you call the IRQHandler. The code should look like: Code: void ISRHandler(Registers& registers)
{ InterruptHandler(registers); } void IRQHandler(Registers& registers) { InterruptHandler(registers); if (registers.interruptNumber >= 40) outb(0xA0, 0x20); /* slave */ outb(0x20, 0x20); /* master */ } |
Author: | austanss [ Mon Oct 19, 2020 1:31 pm ] |
Post subject: | Re: Reading bad data from keyboard |
Thanks for your help, Petch. I am no longer being spammed with general protection faults. I do believe my exception handlers were causing these issues, which in turn, since the exceptions were spamming, it triggered spams of GPFs. My real issue has shown itself to be invalid opcode exceptions. I will be working to find the faulty line of code. New screenshot: Attachment:
|
Author: | austanss [ Mon Oct 19, 2020 3:20 pm ] |
Post subject: | Re: Reading bad data from keyboard |
I used QEMU with -d int,in_asm and this is the output that I found relevant (I added an endless loop to act as a breakpoint when an exception occurs) [PASTEBIN: https://pastebin.com/5FCf7SsU] By "relevant", I mean since the last action that occurred that I recognized myself in my ASM code. (In this case, my hlt loop) |
Author: | MichaelPetch [ Mon Oct 19, 2020 3:30 pm ] |
Post subject: | Re: Reading bad data from keyboard |
You have a serious bug in Boot.S: Code: 1: You are jumping to memory address 0x00000001 and executing there. You meant to jmp back to the numbered label 1. To do that you should have done:hlt jmp 1 Code: 1: After the first interrupt you went off into never never land.
hlt jmp 1b |
Author: | austanss [ Mon Oct 19, 2020 3:52 pm ] |
Post subject: | Re: Reading bad data from keyboard |
MichaelPetch wrote: You have a serious bug in Boot.S: Code: 1: You are jumping to memory address 0x00000001 and executing there. You meant to jmp back to the numbered label 1. To do that you should have done:hlt jmp 1 Code: 1: After the first interrupt you went off into never never land.hlt jmp 1b Alas! This works! Thank you so much! I constantly receive IRQ 0, is this normal? It is the Programmable Interrupt Timer, I assume this is normal. |
Author: | MichaelPetch [ Mon Oct 19, 2020 3:56 pm ] |
Post subject: | Re: Reading bad data from keyboard |
The default timer (IRQ0) from PIT 0 will fire every 18.2 times a second (every 55ms) approximately. |
Author: | austanss [ Mon Oct 19, 2020 3:57 pm ] |
Post subject: | Re: Reading bad data from keyboard |
MichaelPetch wrote: The default timer (IRQ0) from PIT 0 will fire every 18.2 times a second approximately. Thank you so much! I will ignore this until I need it for chronology-related purpose. |
Page 3 of 3 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |