Page 1 of 1

Crashes...

Posted: Sat Dec 20, 2003 1:49 pm
by petrusss
When I either poll or use IRQ when I want the keyboard, the computer crashes after some millieseconds with this message in bochs:

Code: Select all

00021335454i[CPU  ] read_virtual_checks(): write beyond limit
00021335502p[CPU  ] >>PANIC<< fetch_raw_descriptor: LDTR.valid=0
Do you know why? When I poll, I just read the data from port 0x60...
It crashes when I press a key, but first I get some keypresses.
Can someone explain which parts I need to do to poll the keyboard? Or just help me with this one ;)

Re:Crashes...

Posted: Sat Dec 20, 2003 7:27 pm
by Tim
Looks like your interrupt handler code is wrong somehow. For example, it might be that each time it returns from an interrupt, the ESP value is out by a small amount. Gradually this small amount builds up, so after many timer interrupts, you get a crash. I suspect the keyboard stuff isn't related.

Re:Crashes...

Posted: Sun Dec 21, 2003 7:46 am
by petrusss
Well, it crashes when I've pressed a key. Not until then.

Re:Crashes...

Posted: Sun Dec 21, 2003 7:47 am
by petrusss
btw: I don't have any functions for IRQ interrupts, and it still crashes.

Re:Crashes...

Posted: Sun Dec 21, 2003 7:49 am
by petrusss
When I don't read the 0x60 port, it doesn't crash.

Sorry for so much replying, but I've registered now so I can edit my posts ;)

I've fixed the polling!
If I turn of interrupts when I've read 0x60, it doesn't crash.

Is polling such a bad alternative?

Re:Crashes...

Posted: Sun Dec 21, 2003 10:56 am
by neowert
Yes. You will spend too much time trying to read. It sort of depends on how you use it to. In a game its acceptable, because it only polls when it needs input. It would not be useful to get interrupted everytime something happens. But an OS does not work like that. Your poll loop would be time consuming.

Re:Crashes...

Posted: Sun Dec 21, 2003 11:34 am
by petrusss
Tim Robinson wrote: Looks like your interrupt handler code is wrong somehow. For example, it might be that each time it returns from an interrupt, the ESP value is out by a small amount. Gradually this small amount builds up, so after many timer interrupts, you get a crash. I suspect the keyboard stuff isn't related.
ESP=0000ffe4 when it crashed
use to be ~00000080

Re:Crashes...

Posted: Sun Dec 21, 2003 4:50 pm
by petrusss
Okey! I've solved it... the problem was that I used hexadecimal in one place, but not in another :)