i have a problem with assembler program x86, 32 bit, gas. I would like to code pgcd.
Here the code. When I execute it, it loops forever.
With gdb, i see the instruction movl $diviseur,dividende
is problematic. But I don't understand why.
I tested my code on Debian 9.
.data
dividende:
.long 21
diviseur:
.long 14
mresul:
.space 8
.text
.globl _start
_start:
movl $dividende,%eax
movl $diviseur,%ebx
cdq
div %ebx
movl $diviseur,dividende
movl %edx,diviseur
cmp $0,%edx
jnz _start
movl %ebx,mresul
done:
movl $0,%ebx
movl $1,%eax
int $0x80
the result should have been 7