ISRs

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
Cjmovie

ISRs

Post by Cjmovie »

This is an odd problem - I've never had it before each of previous times of using it (about 5 to data :) ).

I'm installing my IDT, setting my ISRs, and etc.
But when I divide by 0, nothing happens! Well, not EXACTLY. It just continues to run as if nothing ever happened.

Also, I've used:

Code: Select all

__asm__ __volatile__ ("int $0");
And it calls it correctly (except for the fact that if it returned the 'iret' would kill the stack :D )

I've also tried not defining any ISR except the double fault. Then I'd do a divide by zero, and as logic would follow:
It would try to divide by 0 (fault #1)
It would lookup the exception (0) and find it not their, causing a double fault. But double fault never gets called either!

Any general ideas of what might cause this? My IDT also is known to work for other software interrupts (eg. define interrupt 55 to call MyFunc). Also, I'm not so sure that anyone would want to look through 150+ lines of C code and at least 100 lines of ASM code unless required to do so, so I'd like to see if it's a general problem first.

Also, I've checked the Troubleshooting area of the OS-Faq for this, found nothing to be of use.
bluecode

Re:ISRs

Post by bluecode »

hi,

perhaps your compiler optimizes that variable and the division away. If you can you should step through your code to see what really happens. Or implement the division by zero in assembler. Perhaps you've mixed up the...ohm dictionary... denominator and couter ??? (I don't think that's the correct translation, but who knows ;) ). Just guessing.
Cjmovie

Re:ISRs

Post by Cjmovie »

No, GCC does not kill division by zero's. As I said, I have done this before. And I couldn't have mixed up the denominator, as it is a "0/0" :).

Also, to make the warning to go away, I do this:

Code: Select all

int i;
i = 0;
i = i/i;
Cjmovie

Re:ISRs

Post by Cjmovie »

Oh, I feel like an idiot!
It was error in my memory manager. I was testing it at the same time and was getting memory pointers from it. But I accidently went one over on the pointers and it overflows into the '0' in i :).

Problem solved, cool!
Post Reply