Crashes...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
petrusss

Crashes...

Post 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 ;)
Tim

Re:Crashes...

Post 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.
petrusss

Re:Crashes...

Post by petrusss »

Well, it crashes when I've pressed a key. Not until then.
petrusss

Re:Crashes...

Post by petrusss »

btw: I don't have any functions for IRQ interrupts, and it still crashes.
petrusss

Re:Crashes...

Post 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?
neowert

Re:Crashes...

Post 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.
petrusss

Re:Crashes...

Post 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
petrusss

Re:Crashes...

Post by petrusss »

Okey! I've solved it... the problem was that I used hexadecimal in one place, but not in another :)
Post Reply