Trying simple mul
instruction, where the result is stored in edx-eax
registers:
section .data
a dd 315814
b dd 165432
result dq 0
format db 'The result is %d', 10
section .text
extern printf
global main
main:
mov eax, [a]
mul dword [b]
mov [result], eax
mov dword [result + 4], edx
sub rsp, 8
mov rdi, format
mov rsi, qword [result]
call printf
xor rdi, rdi
mov rax, 60
syscall
The final value is only taken from the eax
register (in other words, the mov dword [result + 4], edx
seems to have no effect. The output:
The result is 706134096
but should be 52,245,741,648. So what do I do wrong?