Interrupt Handler

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
Andrejus

Interrupt Handler

Post by Andrejus »

Hi,

I implement Interrupt Handler, but now I have very strange bug:

if I write:
__asm__("int $0");
it is works

but if I try:
int a;
int b;
a = 0;
b = 1;
b = 1/a;
(division by zero)
my isr procedure is called a lot of times (cycle)

Thanks
Therx

Re:Interrupt Handler

Post by Therx »

You must resolve the problem in the ISR. What is currently happening is that fter your ISR is finished it returns to exactly the same peice of code and the error occurs again. You need to change to value of EIP on the stack so that when the ISR returns it skips over the problematic code. However in a multitasking enviroment you are better off killing the task as by skipping the code the variables in the program will not be correct so the program will return the wrong result or crash again later.

Pete
Andrejus

Re:Interrupt Handler

Post by Andrejus »

Thanks for your advice.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Interrupt Handler

Post by Pype.Clicker »

a possible way of changing the IP address in a secure way would be to let the task decide of a "recovery point" which would catch the error. Standard functions like setjmp() and longjmp allow you to create such "recovery points" under the standard C library. As you'll not have such a library you'll need to reimplement them, however.
Post Reply