Division by zero is an operation which is disallowed on the CPU level. Writing a program in ASM that divides by zero will result in a trap on the CPU carried out to the OS by the division overflow interrupt line. My question is whether the exception is originating in the CPU or is it the framework itself which handles it in its operators?
-
http://www.dotnetperls.com/dividebyzeroexception – MusicLovingIndianGirl Jun 03 '16 at 05:30
-
I think you can check this. In CPU for every event there is handling. http://stackoverflow.com/questions/23878400/how-processor-handles-case-of-division-by-zero – LifeOfPi Jun 03 '16 at 05:41
-
https://msdn.microsoft.com/en-us/library/system.dividebyzeroexception(v=vs.110).aspx – Spluf Jun 03 '16 at 06:57
-
I don't think there's a single straightforward answer to this. Each runtime (e.g. x86, x64, ARM) has to implement the correct semantics, but whether it's easier to implement them by letting the hardware trap or by slowing down each division operation by an explicit check may be a trade-off that varies. – Damien_The_Unbeliever Jun 03 '16 at 07:04
-
Is this about integer division, or is it for example division with `Decimal` or `BigInteger`? It could make a difference. Note that division with `Single` and `Double` will normally not raise a CLR exception. Instead you can get positive or negative infinity, or not-a-number, as your quotient. – Jeppe Stig Nielsen Jun 03 '16 at 07:51
1 Answers
Well I have a very definitive divide by zero error on a Pentium III clone by programming int 0a and 0d via int 15 in port 20 and 21.It is a bona fide flag confiremd stack overfloe by int 00. OV,DN and ZR are set. The error changes pointers when in real mode and PM but teh flags are still set-except that PM provides a carry which indicates an error.EMM386 sometimes reports it as an irrecoverable error.What exactly is an unrecoverable error and is it really unrecoverable-I would expect that even the most unrecoverable error is probably recoverable with a bit of effort and concentation-is this possible? What if a shut off stacks and trace the error w/o stacks-or just dont use stacks and swithc to Dr.DOS 7.03--there must be some form of solution if DR.DOS can find one.I use iret to set a breakpoint and pipe a patch through debug during boot to which I use to trace the error.