Hello everyone,
Well, I "fixed" the problem by removing the sub/add rsp,8 instruction. Then, if I simply use xmm0 directly into the printf call and also loading the format (s) into rdi, the program runs as expected. The new code is as follows:
global _start
extern printf
extern log
extern exit
section .data
;align 16
s db "%f",13,10,0
x dq 45.3
section .bss
result resq 1
section .text
_start:
movq xmm0, [x]
call log
mov rdi, s
mov rax, 1
call printf
mov rdi, 0
call exit
So, what I don't understand AT ALL is what purpose the sub/ rsp pair serves. Could someone kindly explain when the stack has to be aligned before a function call, and by how many bytes?
Thanks much.
Mark Allyn