loops and exceptions

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
Adek336

loops and exceptions

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

RE:loops and exceptions

Post by jamethiel »

Are you sure you're catching an exception from your code, and not from a hardware interrupt?
carbonBased

RE:loops and exceptions

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

RE:loops and exceptions

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

RE:loops and exceptions

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

RE:loops and exceptions

Post by Adek336 »

you're a genius! now it works :)

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

Thnx, Adrian.

Thanx :)
Post Reply