Page 1 of 1
ISRs not working
Posted: Wed Jun 19, 2013 7:00 pm
by nicetrynsa
I've recently been workin on my OS's error handling, and have come to find that the ISR error handling is not working. My error handler is not getting called at all, even if I do strange things like
Code: Select all
int arr[0];
arr[666] = 666;
int a = 0 / 0;
My code is exactly out of the bkerndev series, and has worked before. Is there any things I can do to find the root of the problem?
Re: ISRs not working
Posted: Wed Jun 19, 2013 7:09 pm
by bluemoon
1. the first test code would corrupt things, but the damage may be random, and may not be instantaneous.
2. review the code generated, 99.2% chance your second test code get optimized.
3. general debug skill applies
4. use the emulator's debug facility
Re: ISRs not working
Posted: Wed Jun 19, 2013 7:47 pm
by nicetrynsa
I turned optimizations off, same problem.
Re: ISRs not working
Posted: Thu Jun 20, 2013 1:32 am
by Antti
This does nothing at run-time. If you get it compiled at all, the effective end result would probably be
Even the calculation is something reasonable, like
every sane compiler would not do produce machine instructions for calculating 2*2.
This code would be more likely to produce divide-by-zero error if there are no optimizations enabled:
Code: Select all
int a = 1;
int b = 0;
int c;
c = a / b;
Re: ISRs not working
Posted: Thu Jun 20, 2013 1:40 am
by Combuster
2. review the code generated, 99.2% chance your second test code get optimized.
Actually, optimisations turn the function into a single ret opcode, as none of the results you try to make are ever read.
But looking at the disassembly is the only way to check that you're actually creating the circumstances to trigger the division by zero exception. Since you didn't explicitly write the exception throwing code in assembly, any and all code snippets posted here might not yield the result you want.