Say I have the following code written in (AT&T) Assembly:
push qword 0
push qword 0
mov rax, 2 ;Tell rax we receive 2 floats
mov rdi, floatformat ;floatformat db "%lf %lf",0
mov rsi, rsp ;I am assuming my logic flaw is in these two lines
mov rdx, rsp
call scanf
pop rax ;Clean up the stack
pop rax
movsd xmm0, [rsi] ;This does not give the value I want
As stated in the comments above, I want xmm0
to hold the first float the user types in when call scanf
is performed, but only receive the second float. I am aware that this is most likely due to the mov rdx, rsp
operation, but if that is not performed, my program does not operate correctly to read in the user inputs.
How can I get the first float the user types in? I have tried researching scanf
calling conventions but have yet to find a clear answer.