Division in x86 Assembly GAS
<p>Im not quite sure yet how division works in x86 assembly (GAS AT&amp;T syntax). What i wanna do is to divide two longs, and then multiply the quotient with the divisor to see if the new number is equal to the initial number (n/m * m = n). </p>

<pre><code>movl %ebx, %eax
movl %ecx, %edx
idivl %edx
imull %ebx, %edx

cmp %edx, %ebx
je .equal
</code></pre>

<p>The code above is a snippet where i do the division. ebx and ecx are two counters that i want to divide, is it correct that the eax register is used as divisor? so when i write idivl %edx i am dividing edx with eax, and i get the integer closest 0? Like 7/2 = 3? I read one place that the quotient is stored in the edx register and the remainder in the ah register, but i was also told that the quotient is stored in the eax register and the remainder in the edx register, which has gotten me confused. </p>

<p>Though the main question here is: i want to divide the value of the ebx register with the value of the ecx register, how should i proceed?</p>

<p>Thanks!</p>

<p>EDIT: the code above yields an floating point exception</p>