As far as I understood, idiv %ebx
will divide edx:eax
(concatenated into 64-bit value, in that order) with 32-bit ebx
.
However, when I try to divide 0x00000000:0xfffffffb
(0 and -5) with 0xffffffff
(-1), I get a floating-point exception.
Can someone explain why? I'm quite puzzled why this is happening because I'm not dividing by 0 after all.
Note that I know I need to sign extend edx:eax
to achieve what I want, which is to calculate -5/-1
. However, even without sign extension the below should
not cause an FPE.