align SP to 16 byte boundary on Darwin in cdecl.S

This commit is contained in:
Joel Dice 2007-09-19 18:36:35 -06:00
parent 1d68f87f75
commit 54cabf9240

View File

@ -1,9 +1,14 @@
#include "types.h" #include "types.h"
.text .text
.globl cdeclCall
#ifdef __APPLE__
.globl _cdeclCall
_cdeclCall:
#else
.globl cdeclCall
cdeclCall: cdeclCall:
#endif
pushl %ebp pushl %ebp
movl %esp,%ebp movl %esp,%ebp
@ -14,6 +19,14 @@ cdeclCall:
// reserve space for arguments // reserve space for arguments
movl 16(%ebp),%ecx movl 16(%ebp),%ecx
#ifdef __APPLE__
// align to a 16 byte boundary on Darwin
addl $15,%ecx
andl $0xFFFFFFF0,%ecx
addl $8,%ecx
#endif
subl %ecx,%esp subl %ecx,%esp
// copy arguments into place // copy arguments into place