Index: /trunk/src/recompiler/tcg/i386/tcg-target.c
===================================================================
--- /trunk/src/recompiler/tcg/i386/tcg-target.c	(revision 38063)
+++ /trunk/src/recompiler/tcg/i386/tcg-target.c	(revision 38064)
@@ -464,5 +464,5 @@
                the 32-bit-mode absolute addressing encoding.  */
 #ifdef VBOX
-            tcg_target_long pc = (tcg_target_long)s->code_ptr 
+            tcg_target_long pc = (tcg_target_long)s->code_ptr
                                + tcg_calc_opc_len(s, opc, r, 0, 0) + 1 + 4;
 #else
@@ -993,5 +993,5 @@
 {
 #ifdef VBOX
-    tcg_target_long disp = dest - (tcg_target_long)s->code_ptr 
+    tcg_target_long disp = dest - (tcg_target_long)s->code_ptr
                          - tcg_calc_opc_len(s, call ? OPC_CALL_Jz : OPC_JMP_long, 0, 0, 0)
                          - 4;
@@ -1519,5 +1519,8 @@
     }
 
-#if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB)
+# if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB)
+#  if defined(VBOX) && defined(RT_OS_DARWIN) && ARCH_BITS == 32
+#   define VBOX_16_BYTE_STACK_ALIGN
+#  endif
 
     /* XXX: move that code at the end of the TB */
@@ -1531,4 +1534,7 @@
         if (opc == 3) {
             tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_ECX, data_reg2);
+#  ifdef VBOX_16_BYTE_STACK_ALIGN
+            tcg_out_subi(s, TCG_REG_ESP, 12);
+#  endif
             tcg_out_pushi(s, mem_index);
             stack_adjust = 4;
@@ -1540,4 +1546,7 @@
         if (opc == 3) {
             tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_EDX, args[addrlo_idx + 1]);
+#  ifdef VBOX_16_BYTE_STACK_ALIGN
+            tcg_out_pushi(s, 0);
+#  endif
             tcg_out_pushi(s, mem_index);
             tcg_out_push(s, data_reg2);
@@ -1557,4 +1566,7 @@
                 break;
             }
+#  ifdef VBOX_16_BYTE_STACK_ALIGN
+            tcg_out_subi(s, TCG_REG_ESP, 12);
+#  endif
             tcg_out_pushi(s, mem_index);
             stack_adjust = 4;
@@ -1564,4 +1576,9 @@
     tcg_out_calli(s, (tcg_target_long)qemu_st_helpers[s_bits]);
 
+#  ifdef VBOX_16_BYTE_STACK_ALIGN
+    if (stack_adjust != 0) {
+        tcg_out_addi(s, TCG_REG_ESP, RT_ALIGN(stack_adjust, 16));
+    }
+#  else
     if (stack_adjust == (TCG_TARGET_REG_BITS / 8)) {
         /* Pop and discard.  This is 2 bytes smaller than the add.  */
@@ -1570,9 +1587,10 @@
         tcg_out_addi(s, TCG_REG_ESP, stack_adjust);
     }
-
-#else  /* VBOX && REM_PHYS_ADDR_IN_TLB */
-# error Borked
+#  endif
+
+# else  /* VBOX && REM_PHYS_ADDR_IN_TLB */
+#  error Borked
     tcg_out_vbox_phys_write(s, opc, r0, data_reg, data_reg2);
-#endif /* VBOX && REM_PHYS_ADDR_IN_TLB */
+# endif /* VBOX && REM_PHYS_ADDR_IN_TLB */
 
     /* label2: */
