This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix stack alignment on *BSD/i386


The same thing was done to the "generic" SystemV ABI code back in
2010.  Without this, executing code that uses SSE instructions with
data on the stack will fail.


2013-04-01  Mark Kettenis  <kettenis@gnu.org>

	* src/x86/freebsd.S (ffi_call_SYSV): Align the stack pointer to
	16-bytes.

Index: src/x86/freebsd.S
===================================================================
--- src/x86/freebsd.S	(revision 197303)
+++ src/x86/freebsd.S	(working copy)
@@ -49,6 +49,9 @@
 	movl  16(%ebp),%ecx
 	subl  %ecx,%esp
 
+	/* Align the stack pointer to 16-bytes */
+	andl  $0xfffffff0, %esp
+
 	movl  %esp,%eax
 
 	/* Place all of the ffi_prep_args in position  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]