Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Properly align the stack in the arm generic trampoline.

  • Loading branch information...
commit c46e5f9eceb21761f2bceca0f6771fb97f2d239d 1 parent c188c7a
@vargaz vargaz authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 mono/mini/tramp-arm.c
View
13 mono/mini/tramp-arm.c
@@ -269,8 +269,21 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
code += 4;
}
+ /* Align stack to 8 */
+ /* FIXME: Do this properly at the beginning */
+ g_assert (STACK % 8 == 4);
+ ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 4);
+ cfa_offset += 4;
+ mono_add_unwind_op_def_cfa (unwind_ops, code, buf, ARMREG_SP, cfa_offset);
+
ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC);
code = emit_bx (code, ARMREG_IP);
+
+ /* Restore stack */
+ ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 4);
+ cfa_offset -= 4;
+ mono_add_unwind_op_def_cfa (unwind_ops, code, buf, ARMREG_SP, cfa_offset);
+
/* OK, code address is now on r0. Move it to the place on the stack
* where IP was saved (it is now no more useful to us and it can be
Please sign in to comment.
Something went wrong with that request. Please try again.