Page 1 of 1

Interrupt Handler

Posted: Sun Sep 14, 2003 7:41 am
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

Re:Interrupt Handler

Posted: Sun Sep 14, 2003 8:09 am
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

Re:Interrupt Handler

Posted: Sun Sep 14, 2003 10:23 am
by Andrejus
Thanks for your advice.

Re:Interrupt Handler

Posted: Mon Sep 15, 2003 1:07 am
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.