Bug 928381 - ctypes/libffi: Fix stack alignment on *BSD/i386 r=glandium

This commit is contained in:
Landry Breuil 2013-11-04 22:05:46 +01:00
parent b2eb675207
commit 6b5d125afe
2 changed files with 34 additions and 0 deletions

View File

@ -49,6 +49,9 @@ ffi_call_SYSV:
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 */

View File

@ -0,0 +1,31 @@
# HG changeset patch
# User Landry Breuil <landry@openbsd.org>
# Date 1382105758 -7200
# Fri Oct 18 16:15:58 2013 +0200
# Node ID 5f82dae8c495a7fddf5ed935eb2a8be7f47b9bd8
# Parent d50df2233e95f4d45b35eddbfbe84bcdda6a11e2
Bug 928381 - ctypes/libffi: Fix stack alignment on *BSD/i386 r=glandium
diff --git a/js/src/ctypes/libffi/src/x86/freebsd.S b/js/src/ctypes/libffi/src/x86/freebsd.S
--- a/js/src/ctypes/libffi/src/x86/freebsd.S
+++ b/js/src/ctypes/libffi/src/x86/freebsd.S
@@ -44,16 +44,19 @@ ffi_call_SYSV:
pushl %ebp
.LCFI0:
movl %esp,%ebp
.LCFI1:
/* Make room for all of the new args. */
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 */
pushl 12(%ebp)
pushl %eax
call *8(%ebp)
/* Return stack to previous state and call the function */