-/*
- * tramp-arm.c: JIT trampoline code for ARM
+/**
+ * \file
+ * JIT trampoline code for ARM
*
* Authors:
* Paolo Molaro (lupus@ximian.com)
*(guint8**)jump_entry = addr;
}
+gpointer
+mono_arm_handler_block_trampoline_helper (gpointer *ptr)
+{
+ MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
+ return jit_tls->handler_block_return_address;
+}
+
#ifndef DISABLE_JIT
#define arm_is_imm12(v) ((int)(v) > -4096 && (int)(v) < 4096)
return buf;
}
-static gpointer
-handler_block_trampoline_helper (gpointer *ptr)
-{
- MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
- return jit_tls->handler_block_return_address;
-}
-
gpointer
mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
{
MonoJumpInfo *ji = NULL;
GSList *unwind_ops = NULL;
- g_assert (!aot);
-
code = buf = mono_global_codeman_reserve (tramp_size);
unwind_ops = mono_arch_get_cie_program ();
* We are in a method frame after the call emitted by OP_CALL_HANDLER.
*/
/* Obtain jit_tls->handler_block_return_address */
- ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
- ARM_B (code, 0);
- *(gpointer*)code = handler_block_trampoline_helper;
- code += 4;
+ if (aot) {
+ code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_R0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_arm_handler_block_trampoline_helper");
+ ARM_B (code, 0);
+ } else {
+ ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
+ ARM_B (code, 0);
+ *(gpointer*)code = mono_arm_handler_block_trampoline_helper;
+ code += 4;
+ }
/* Set it as the return address so the trampoline will return to it */
ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_R0);
/* Call the trampoline */
- ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
- code = emit_bx (code, ARMREG_R0);
- *(gpointer*)code = tramp;
- code += 4;
+ if (aot) {
+ char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
+ code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_R0, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
+ code = emit_bx (code, ARMREG_R0);
+ } else {
+ ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
+ code = emit_bx (code, ARMREG_R0);
+ *(gpointer*)code = tramp;
+ code += 4;
+ }
mono_arch_flush_icache (buf, code - buf);
mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL);