]> xenbits.xensource.com Git - rumpuser-xen.git/commitdiff
Correct x86-64 stack alignment at thread entry (fixes #18)
authorMartin Lucina <martin@lucina.net>
Mon, 12 Jan 2015 14:20:00 +0000 (15:20 +0100)
committerMartin Lucina <martin@lucina.net>
Tue, 13 Jan 2015 16:50:23 +0000 (17:50 +0100)
The x86-64 ABI mandates in section 3.2.2 that (%rsp + 8) is always a
multiple of 16 when control is transferred to a function entry point. We
did not correctly implement this convention which resulted in broken
alignment for stack variables, and, following from that, SSE
instructions generated by GCC faulting due to bad alignment.

For the x86-32 version the alignment constraint appears to be[1] that
%esp must be a multiple of 16, this is already the case so no change is
made to x86-32.s.

[1] http://sourceforge.net/p/fbc/bugs/659/,
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38496

Signed-off-by: Martin Lucina <martin@lucina.net>
xen/arch/x86/x86_64.S

index c2078fc712c6f25117bf14f2e82163d7cb2c17f7..bee757f59364daebdccb9c6432c61dcd3beb1d24 100644 (file)
@@ -287,6 +287,7 @@ ENTRY(page_fault)
 ENTRY(thread_starter)
         popq %rdi
         popq %rbx
+        pushq $0                        /* correct stack alignment for SSE */
         pushq $0
         xorq %rbp,%rbp
         call *%rbx