Page 1 of 1

loops and exceptions

Posted: Sat Jan 11, 2003 12:00 am
by Adek336
hi I have an exception system up, and when I try infintive looping, I get an exception. Also it does when I have sumfin like for(i = 1; i<1000; i++) {code()}
it blocks it.

It works only if I CLI.

Is this normal behaviour?

Thnx, Adrian.

RE:loops and exceptions

Posted: Sat Jan 11, 2003 12:00 am
by jamethiel
Are you sure you're catching an exception from your code, and not from a hardware interrupt?

RE:loops and exceptions

Posted: Sat Jan 11, 2003 12:00 am
by carbonBased
Indeed!  Have you redirected hardware interrupts to beyond 0x20?

Also, which exception?  There are many :)  I could see an alignment exception being caused... but you'd have to voluntarily set the alignment bit in... CR0 (?) I think, as well as eflags.  Most ppl don't do this :)  (my OS, on the other hand, will cause an exception at any unaligned code... I wanna make sure all my apps are properly compiled :) )

Jeff

RE:loops and exceptions

Posted: Mon Jan 13, 2003 12:00 am
by Adek336
Ahh! I considered the timer, but then I moved my research to keyboards. I am just trying to get my IRQ working but it doh runs only once. Haven't forgotten about outportb(0x20, 0x20).

Any suggestions?

Thnx, Adrian.

RE:loops and exceptions

Posted: Mon Jan 13, 2003 12:00 am
by carbonBased
> Any suggestions?

Yeah!  Actually write the ISR :)

The keyboard interrupt will only be recognised if the keyboard knows you've received the last keystroke, so-to-speak.  In other words, in your keyboard ISR, be sure to actually _get_ the keystroke (inportb(0x60) iirc), then all should work as expected.

Cheers!
Jeff

RE:loops and exceptions

Posted: Mon Jan 13, 2003 12:00 am
by Adek336
you're a genius! now it works :)

now i get a "hello world" message each keystroke.

Thnx, Adrian.

Thanx :)