The following code is giving floating point exception for some range of values. If this is because of division by zero, then it should occur for every dividend. Any pointer would be appreciated

Thank you

.intel_syntax noprefix
.section .data
          .word 10
         .int 1234567     # is working fine if say, the value is 123456

.section .text
   .globl _start
       mov ax, dividend
       mov dx, dividend+2
       div   word ptr divisor

       mov eax, 1
       mov ebx, 0
       int 0x80
Posted on 2009-11-02 23:25:58 by uglyhunK
it's overflow error. The result doesn't fit in 16 bits, so the exception is triggered.
Posted on 2009-11-02 23:32:33 by Ultrano
Thank you. I overlooked the size of ax register. May be the exception message could have been more specific to the error.
Posted on 2009-11-03 00:12:43 by uglyhunK
In order to be more specific, #DE fault handler has to decode faulting opcode to determine, which of the cases is in effect (division by 0 or division overflow). It's not hard, but rarely occurs.
Posted on 2009-11-03 00:26:47 by baldr