1.1 --- a/sourcepawn/jit/x86/jit_x86.cpp Sat Aug 10 21:23:02 2013 -0700
1.2 +++ b/sourcepawn/jit/x86/jit_x86.cpp Sun Aug 11 11:27:19 2013 -0700
1.3 @@ -614,6 +614,9 @@
1.4 __ movl(frm, stk);
1.5 __ subl(tmp, dat);
1.6 __ movl(Operand(info, AMX_INFO_FRAME), tmp);
1.7 +
1.8 + // Align the stack to 16-bytes (each call adds 4 bytes).
1.9 + __ subl(esp, 12);
1.10 break;
1.11
1.12 case OP_IDXADDR_B:
1.13 @@ -988,6 +991,7 @@
1.14 // Remove parameters.
1.15 __ movl(tmp, Operand(stk, 0));
1.16 __ lea(stk, Operand(stk, tmp, ScaleFour, 4));
1.17 + __ addl(esp, 12);
1.18 __ ret();
1.19 break;
1.20 }
1.21 @@ -1585,12 +1589,6 @@
1.22 // Save registers.
1.23 __ push(edx);
1.24
1.25 - // Align the stack to 16 bytes.
1.26 - __ push(ebx);
1.27 - __ movl(ebx, esp);
1.28 - __ andl(esp, 0xfffffff0);
1.29 - __ subl(esp, 4);
1.30 -
1.31 // Push the parameters for the C++ function.
1.32 __ push(stk);
1.33 __ push(native_index);
1.34 @@ -1616,9 +1614,8 @@
1.35 __ j(not_zero, &extern_error_);
1.36
1.37 // Restore local state.
1.38 - __ movl(esp, ebx);
1.39 - __ pop(ebx);
1.40 __ addl(stk, dat);
1.41 + __ addl(esp, 12);
1.42 __ pop(edx);
1.43
1.44 if (op == OP_SYSREQ_N) {
1.45 @@ -1786,7 +1783,10 @@
1.46 __ movl(ebx, edi);
1.47 __ movl(Operand(esi, AMX_INFO_NSTACK), esp);
1.48
1.49 - // Call into plugin.
1.50 + // Align the stack.
1.51 + __ andl(esp, 0xfffffff0);
1.52 +
1.53 + // Call into plugin (align the stack first).
1.54 __ call(ecx);
1.55
1.56 __ movl(ecx, Operand(info, AMX_INFO_RETVAL));