#include "mini.h"
#include "mini-arm.h"
#include "debugger-agent.h"
+#include "jit-icalls.h"
#define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1))
/* Stack size for trampoline function
*/
-#define STACK ALIGN_TO (sizeof (MonoLMF), 8)
+#define STACK ALIGN_TO (sizeof (MonoLMF), MONO_ARCH_FRAME_ALIGNMENT)
/* Method-specific trampoline code fragment size */
#define METHOD_TRAMPOLINE_SIZE 64
#ifdef USE_JUMP_TABLES
gpointer *load_get_lmf_addr = NULL, *load_trampoline = NULL;
#else
- guint8 *load_get_lmf_addr = NULL, *load_trampoline = NULL;
+ guint8 *load_get_lmf_addr = NULL, *load_trampoline = NULL;
gpointer *constants;
#endif
-
- int cfa_offset, regsave_size, lr_offset;
+ int i, cfa_offset, regsave_size, lr_offset;
GSList *unwind_ops = NULL;
MonoJumpInfo *ji = NULL;
int buf_len;
mono_add_unwind_op_def_cfa (unwind_ops, code, buf, ARMREG_SP, cfa_offset);
// PC saved at sp+LR_OFFSET
mono_add_unwind_op_offset (unwind_ops, code, buf, ARMREG_LR, -4);
+ /* Callee saved regs */
+ for (i = 0; i < 8; ++i)
+ mono_add_unwind_op_offset (unwind_ops, code, buf, ARMREG_R4 + i, -regsave_size + ((4 + i) * 4));
if (aot) {
/*
* preceeding the got slot where the value is stored. The offset can be
* found at [lr + 0].
*/
+ /* See if emit_trampolines () in aot-compiler.c for the '2' */
if (aot == 2) {
ARM_MOV_REG_REG (code, ARMREG_V2, ARMREG_R1);
} else {
}
ARM_LDR_IMM (code, ARMREG_V3, ARMREG_SP, lr_offset);
+ /* we build the MonoLMF structure on the stack - see mini-arm.h
+ * The pointer to the struct is put in r1.
+ * the iregs array is already allocated on the stack by push.
+ */
+ code = mono_arm_emit_load_imm (code, ARMREG_R2, STACK - regsave_size);
+ ARM_SUB_REG_REG (code, ARMREG_SP, ARMREG_SP, ARMREG_R2);
+ cfa_offset += STACK - regsave_size;
+ mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
+ /* V1 == lmf */
+ code = mono_arm_emit_load_imm (code, ARMREG_R2, STACK - sizeof (MonoLMF));
+ ARM_ADD_REG_REG (code, ARMREG_V1, ARMREG_SP, ARMREG_R2);
+
/* ok, now we can continue with the MonoLMF setup, mostly untouched
* from emit_prolog in mini-arm.c
* This is a synthetized call to mono_get_lmf_addr ()
ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC);
code = emit_bx (code, ARMREG_R0);
- /* we build the MonoLMF structure on the stack - see mini-arm.h
- * The pointer to the struct is put in r1.
- * the iregs array is already allocated on the stack by push.
- */
- code = mono_arm_emit_load_imm (code, ARMREG_R2, STACK - regsave_size);
- ARM_SUB_REG_REG (code, ARMREG_SP, ARMREG_SP, ARMREG_R2);
- cfa_offset += STACK - regsave_size;
- mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
- /* V1 == lmf */
- code = mono_arm_emit_load_imm (code, ARMREG_R2, STACK - sizeof (MonoLMF));
- ARM_ADD_REG_REG (code, ARMREG_V1, ARMREG_SP, ARMREG_R2);
-
/*
* The stack now looks like:
* <saved regs>
* Have to call the _force_ variant, since there could be a protected wrapper on the top of the stack.
*/
if (aot) {
- ji = mono_patch_info_list_prepend (ji, code - buf, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_thread_force_interruption_checkpoint");
+ ji = mono_patch_info_list_prepend (ji, code - buf, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_interruption_checkpoint_from_trampoline");
ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
ARM_B (code, 0);
*(gpointer*)code = NULL;
#ifdef USE_JUMP_TABLES
gpointer *jte = mono_jumptable_add_entry ();
code = mono_arm_load_jumptable_entry (code, jte, ARMREG_IP);
- jte [0] = mono_thread_force_interruption_checkpoint;
+ jte [0] = mono_interruption_checkpoint_from_trampoline;
#else
ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
ARM_B (code, 0);
- *(gpointer*)code = mono_thread_force_interruption_checkpoint;
+ *(gpointer*)code = mono_interruption_checkpoint_from_trampoline;
code += 4;
#endif
}