Linux maps the #DE
(division by zero exception) generated by the CPU to the SIGFPE
signal, which is then translated to the human-readable error message "Floating point exception"; unfortunately, it's quite misleading, as no floating point at all is involved into the process.
Now, given that rbx
is 2
, of course you are not dividing by zero. Still, there's another case when x86 generates a #DE
exception: if the result is too big to fit into the target register.
In your code you are using the 64 bit form of the instruction (you wrote rbx
- a 64 bit register - as divisor) which means that you are asking to divide rdx:rax
(i.e. the 128 bit value obtained by joining rdx
and rax
) by rbx
, and to put the result into rax
(quotient) and rdx
(remainder).
Since you are not zeroing out rdx
, most probably it contains some big garbage value (residual from some previous computation?), and the division by two results in a quotient too big for rax
. Hence, the #DE
exception.
Long story short: zero out rdx
before the div
and everything will work out smoothly.