From: Martin Lucina Date: Mon, 12 Jan 2015 14:20:00 +0000 (+0100) Subject: Correct x86-64 stack alignment at thread entry (fixes #18) X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=97afb0013eeb4eb28bcd173bcc83c9c9163c5bdd;p=rumpuser-xen.git Correct x86-64 stack alignment at thread entry (fixes #18) 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 --- diff --git a/xen/arch/x86/x86_64.S b/xen/arch/x86/x86_64.S index c2078fc..bee757f 100644 --- a/xen/arch/x86/x86_64.S +++ b/xen/arch/x86/x86_64.S @@ -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