ISRs not working

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
nicetrynsa
Posts: 2
Joined: Wed Jun 19, 2013 6:57 pm

ISRs not working

Post 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?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: ISRs not working

Post 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
nicetrynsa
Posts: 2
Joined: Wed Jun 19, 2013 6:57 pm

Re: ISRs not working

Post by nicetrynsa »

I turned optimizations off, same problem.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: ISRs not working

Post by Antti »

Code: Select all

int a = 0 / 0;
This does nothing at run-time. If you get it compiled at all, the effective end result would probably be

Code: Select all

int a = 0;
Even the calculation is something reasonable, like

Code: Select all

int a = 2*2;
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;
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: ISRs not working

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply