Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I suspect the problem has something to do with your code setting <code>rax</code> to <code>0</code> whereas it must be <code>1</code> because you pass a floating point argument (see <a href="https://stackoverflow.com/a/6212835/249230">here</a> for details). Basically <code>rax</code> should contain the number of variable arguments passed in <code>xmmN</code> registers.</p> <p>Edit:</p> <p>The crash in <code>printf</code> seems to be caused by stack miaslignment as the program crashes at a <code>movaps</code> instruction (which expects the memory operand to be aligned on 16-byte boundary):</p> <pre><code>=&gt; 0x7ffff7a65f84 &lt;__printf+36&gt;: movaps %xmm0,0x50(%rsp) 0x7ffff7a65f89 &lt;__printf+41&gt;: movaps %xmm1,0x60(%rsp) 0x7ffff7a65f8e &lt;__printf+46&gt;: movaps %xmm2,0x70(%rsp) 0x7ffff7a65f93 &lt;__printf+51&gt;: movaps %xmm3,0x80(%rsp) 0x7ffff7a65f9b &lt;__printf+59&gt;: movaps %xmm4,0x90(%rsp) 0x7ffff7a65fa3 &lt;__printf+67&gt;: movaps %xmm5,0xa0(%rsp) 0x7ffff7a65fab &lt;__printf+75&gt;: movaps %xmm6,0xb0(%rsp) 0x7ffff7a65fb3 &lt;__printf+83&gt;: movaps %xmm7,0xc0(%rsp) </code></pre> <p>When entering <code>main</code> the stack is not 16-byte aligned but if you fix this the program works fine. Below is my test program (notice the <code>sub rsp, 8</code> in the beginning):</p> <pre><code>global main extern printf section .data string db `%f\n`, 0 rs dq 1.6 section .text main: sub rsp, 8 movq xmm0, qword [rs] mov rdi, string mov rax, 1 call printf add rsp, 8 mov eax, 0x60 xor edi, edi syscall </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload