I'm busy with learning Assembly and was looking at dividing, however I ran into a pickle with the following statement:
mov edx,0x00000001
mov eax,0x00000000
mov ecx,0x00000002
idiv ecx
GDB:
0x08048071 <+17>: mov edx,0x1
0x08048076 <+22>: mov eax,0x0
0x0804807b <+27>: mov ecx,0x2
=> 0x08048080 <+32>: idiv ecx
I wanted to divide 0x100000000 by 0x00000002, so since the span for division is EDX:EAX I moved 0x1 into EDX and 0x0 into EAX. I then move 0x2 into ECX and divide, this unfortunately gives me a floating point exception, I' m not sure what I did wrong.
When using div (unsigned) it works normal, so I wonder what the difference is in interpretation between div and idiv for this particular statement which causes the exception.