#define IS_REX(inst) (((inst) >= 0x40) && ((inst) <= 0x4f))
+#ifndef DISABLE_JIT
/*
* mono_arch_get_unbox_trampoline:
* @m: method pointer
return start;
}
+#endif /* !DISABLE_JIT */
#ifdef _WIN64
// Workaround lack of Valgrind support for 64-bit Windows
}
}
+#ifndef DISABLE_JIT
guint8*
mono_arch_create_llvm_native_thunk (MonoDomain *domain, guint8 *addr)
{
mono_profiler_code_buffer_new (thunk_start, thunk_code - thunk_start, MONO_PROFILER_CODE_BUFFER_HELPER, NULL);
return addr;
}
+#endif /* !DISABLE_JIT */
void
mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr)
InterlockedExchangePointer (plt_jump_table_entry, addr);
}
+#ifndef DISABLE_JIT
static void
stack_unaligned (MonoTrampolineType tramp_type)
{
x86_push_imm (code, (guint64)func_arg);
amd64_call_reg (code, AMD64_R11);
}
+#endif /* !DISABLE_JIT */
gpointer
mono_amd64_handler_block_trampoline_helper (void)
return jit_tls->handler_block_return_address;
}
+#ifndef DISABLE_JIT
gpointer
mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
{
- guint8 *tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
guint8 *code, *buf;
int tramp_size = 64;
MonoJumpInfo *ji = NULL;
unwind_ops = mono_arch_get_cie_program ();
/*
- This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
- */
- if (!aot && mono_get_jit_tls_offset () != -1) {
- code = mono_amd64_emit_tls_get (code, MONO_AMD64_ARG_REG1, mono_get_jit_tls_offset ());
- amd64_mov_reg_membase (code, MONO_AMD64_ARG_REG1, MONO_AMD64_ARG_REG1, MONO_STRUCT_OFFSET (MonoJitTlsData, handler_block_return_address), 8);
- /* Simulate a call */
- amd64_push_reg (code, AMD64_RAX);
- mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, 16);
- amd64_jump_code (code, tramp);
+ * This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
+ * We get here from the ret emitted by CEE_ENDFINALLY.
+ * The stack is misaligned.
+ */
+ /* Align the stack before the call to mono_amd64_handler_block_trampoline_helper() */
+#ifdef TARGET_WIN32
+ /* Also make room for the "register parameter stack area" as specified by the Windows x64 ABI (4 64-bit registers) */
+ amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8 + 4 * 8);
+#else
+ amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8);
+#endif
+ if (aot) {
+ code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_amd64_handler_block_trampoline_helper");
+ amd64_call_reg (code, AMD64_R11);
} else {
- /*
- * We get here from the ret emitted by CEE_ENDFINALLY.
- * The stack is misaligned.
- */
- /* Align the stack before the call */
- amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8);
- if (aot) {
- code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_amd64_handler_block_trampoline_helper");
- amd64_call_reg (code, AMD64_R11);
- } else {
- amd64_call_code (code, mono_amd64_handler_block_trampoline_helper);
- }
- /* Undo stack alignment */
- amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8);
- /* Save the result to the stack */
- amd64_push_reg (code, AMD64_RAX);
- if (aot) {
- char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
- code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
- amd64_mov_reg_reg (code, AMD64_RAX, AMD64_R11, 8);
- } else {
- amd64_mov_reg_imm (code, AMD64_RAX, tramp);
- }
- /* The stack is aligned */
+ amd64_mov_reg_imm (code, AMD64_RAX, mono_amd64_handler_block_trampoline_helper);
amd64_call_reg (code, AMD64_RAX);
- /* Load return address */
- amd64_pop_reg (code, AMD64_RAX);
- /* The stack is misaligned, thats what the code we branch to expects */
- amd64_jump_reg (code, AMD64_RAX);
}
+ /* Undo stack alignment */
+#ifdef TARGET_WIN32
+ amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8 + 4 * 8);
+#else
+ amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8);
+#endif
+ /* Save the result to the stack */
+ amd64_push_reg (code, AMD64_RAX);
+#ifdef TARGET_WIN32
+ /* Make room for the "register parameter stack area" as specified by the Windows x64 ABI (4 64-bit registers) */
+ amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 4 * 8);
+#endif
+ if (aot) {
+ char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
+ code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
+ amd64_mov_reg_reg (code, AMD64_RAX, AMD64_R11, 8);
+ } else {
+ amd64_mov_reg_imm (code, AMD64_RAX, mono_get_trampoline_func (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD));
+ }
+ /* The stack is aligned */
+ amd64_call_reg (code, AMD64_RAX);
+#ifdef TARGET_WIN32
+ amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 4 * 8);
+#endif
+ /* Load return address */
+ amd64_pop_reg (code, AMD64_RAX);
+ /* The stack is misaligned, thats what the code we branch to expects */
+ amd64_jump_reg (code, AMD64_RAX);
mono_arch_flush_icache (buf, code - buf);
mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL);
return buf;
}
+#endif /* !DISABLE_JIT */
/*
* mono_arch_get_call_target:
return *(guint32*)(plt_entry + 6);
}
+#ifndef DISABLE_JIT
/*
* mono_arch_create_sdb_trampoline:
*
return buf;
}
+#endif /* !DISABLE_JIT */
+
+#ifdef DISABLE_JIT
+gpointer
+mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+gpointer
+mono_arch_get_static_rgctx_trampoline (MonoMethod *m, MonoMethodRuntimeGenericContext *mrgctx, gpointer addr)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+gpointer
+mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info, gboolean aot)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+guchar*
+mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+gpointer
+mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+gpointer
+mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboolean aot)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+gpointer
+mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+void
+mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
+{
+ g_assert_not_reached ();
+ return;
+}
+
+guint8*
+mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+#endif /* DISABLE_JIT */