Page 1 of 1

Weird keyboard bug

Posted: Thu Feb 13, 2014 4:04 am
by kutkloon7
Hi.

I've implemented some code to handle keypresses and everything seemed to work fine at first. However, I started seeing random spaces when I print the text I type on screen.

After some debugging, I am left with the following loop in my kernel:

Code: Select all

while (true)
{
    char woopwoop = foo();
    if (woopwoop != 0)
    {
        putChar(woopwoop);
        updateCursor();
    }
}
where foo is just:

Code: Select all

char foo(void)
{
    return 0;
}
I can't believe that this is happening, but random spaces (and the weird thing is: only spaces) are still showing up when I type on my keyboard! Any ideas what might be happening?

I wanted to start a debugging session, but the problems seems to be that a value seems to be changing, and I have no idea how to debug this...

Weird stuff! I hope somebody can help me :)

Re: Weird keyboard bug

Posted: Thu Feb 13, 2014 4:13 am
by Combuster
Grab bochs' debugger. Check if your ISRs are preserving registers correctly.

Re: Weird keyboard bug

Posted: Thu Feb 13, 2014 2:16 pm
by kutkloon7
That sounds logical, the only way the value could be changed is if the irq left another value in eax. Thanks :)

Re: Weird keyboard bug

Posted: Thu Feb 13, 2014 2:51 pm
by kutkloon7
You were absolutely right!