Page 1 of 1
Divide By 0 ISR
Posted: Fri Jun 27, 2003 4:45 pm
by ash
Hi, when a divide by 0 ISR is called, it repeatedly gets called. Ive heard that you not to pop the error code off the stack. But I cant seem to do that. I keep getting general protection faults? Any ideas? this is my ISR:
[extern interrupt_handler]
[global int_00]
int_00:
pusha
push ds
push es
push fs
push gs
mov eax, 0x00
push eax
call interrupt_handler ; Divide by Zero #DE
pop eax
pop gs
pop fs
pop es
pop ds
popa
iret
ta, ash
Re:Divide By 0 ISR
Posted: Fri Jun 27, 2003 5:26 pm
by Pype.Clicker
better check the holly manual, but i think division by zero has a return address that point to the faulty division. Thus if you simply return, it will fire the division exception again and again. What you have to do here is HaLTing ...
Re:Divide By 0 ISR
Posted: Fri Jun 27, 2003 5:36 pm
by ash
Do you have to buy the Intel Manual. Or is it free to download? thx ash.
Re:Divide By 0 ISR
Posted: Fri Jun 27, 2003 7:15 pm
by slacker
you can download it or send intel your name and they will send 3 fat FREE books....
Re:Divide By 0 ISR
Posted: Tue Jul 01, 2003 11:18 pm
by Peter_Vigren
slacker wrote:
you can download it or send intel your name and they will send 3 fat FREE books....
You can!?!? Free books as in really, really free books? And does this work outside US?
Re:Divide By 0 ISR
Posted: Wed Jul 02, 2003 1:39 am
by Tim
Yes. I've heard of people in Europe and Australia receiving free books shipped from the US.
Re:Divide By 0 ISR
Posted: Wed Jul 02, 2003 6:00 pm
by Peter_Vigren
Okay... Do you have a direct link to the ordering page? I have trouble finding any (Intel's site makes me dizzy to say the least...)...
By the way, sorry because this is a bit off topic...
Re:Divide By 0 ISR
Posted: Wed Jul 02, 2003 6:38 pm
by bkilgore
I went to the intel site, and unfortunately it says they're not available right now. It does give a 1-800 number to call to get them directly. Let me know if you try this and it works out. The documents are available online at:
http://developer.intel.com/design/pentium4/manuals/ and the site to request hardcopies is:
http://developer.intel.com/design/pentium4/manuals/index2.htm
- Brandon
Re:Divide By 0 ISR
Posted: Mon Jul 07, 2003 11:47 am
by Peter_Vigren
It's up again. But it seems that it is only for companies... you have to fill in a company name...
Re:Divide By 0 ISR
Posted: Mon Jul 07, 2003 12:06 pm
by Jamethiel
If they want a company name, give them one. It's not like they'll check it or anything.
Re:Divide By 0 ISR
Posted: Mon Jul 07, 2003 2:23 pm
by mr. xsism
a suggestion for the repeating: pop the address and increment the pointer, then return. This depends on the opcode size, but that would work if you could inc the right number of bytes to skip the errorneuos divide code.
Regards,
mr. xsism
Re:Divide By 0 ISR
Posted: Wed Jul 09, 2003 11:22 am
by elias
im looking to get these books too. i have searched intels developer site to no avail. i can never find anythign on that site. what exactly do i have to send?
Re:Divide By 0 ISR
Posted: Thu Jul 10, 2003 6:52 pm
by The Pro from Dover
mr. xsism wrote:
a suggestion for the repeating: pop the address and increment the pointer, then return. This depends on the opcode size, but that would work if you could inc the right number of bytes to skip the errorneuos divide code.
With this sort of exception, returning to the running code at the point following the error is a Bad Thing; the code in question is expecting the preceeding computation to have completed with a meaningful result, when in fact the values in question are in an indeterminant state.
The simplest practical solution is to kill the running process and return a failure message of some kind. Not very elegant, but completely general and unlikely to cause a catastophic data corruption later down the line. Halting the process and asking if the user want to open a debugger session is a bit more useful, at least for users who are also programmers.
The Right Thing would be to re-enter the process and raise an exception, so that the program itself could handle the problem sensibly; if the program doesn't trap the error,
then halt and ask to open a debugger session. This, however, depends on the language that the app is written in having an exception handling mechanism which can work with your system's exception handlers.
Or perhaps the real Right Thing is to have sanity checks in the code itself, either added manually or inserted by the compiler or interpreter automagically; the extra overhead of the checking would still be less than the overhead of trapping a system exception. Just a thought. ;D