This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
[PATCH] Fix stack alignment on *BSD/i386
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: libffi-discuss at sourceware dot org
- Date: Mon, 1 Apr 2013 13:18:05 +0200 (CEST)
- Subject: [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 */