summaryrefslogtreecommitdiff
path: root/mono/mini/exceptions-arm.c
diff options
context:
space:
mode:
Diffstat (limited to 'mono/mini/exceptions-arm.c')
-rw-r--r--mono/mini/exceptions-arm.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/mono/mini/exceptions-arm.c b/mono/mini/exceptions-arm.c
index 8931dd8467..8228280a9f 100644
--- a/mono/mini/exceptions-arm.c
+++ b/mono/mini/exceptions-arm.c
@@ -60,10 +60,10 @@ mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot)
ctx_reg = ARMREG_R0;
-#if defined(ARM_FPU_VFP)
- ARM_ADD_REG_IMM8 (code, ARMREG_IP, ctx_reg, G_STRUCT_OFFSET (MonoContext, fregs));
- ARM_FLDMD (code, ARM_VFP_D0, 16, ARMREG_IP);
-#endif
+ if (!mono_arch_is_soft_float ()) {
+ ARM_ADD_REG_IMM8 (code, ARMREG_IP, ctx_reg, G_STRUCT_OFFSET (MonoContext, fregs));
+ ARM_FLDMD (code, ARM_VFP_D0, 16, ARMREG_IP);
+ }
/* move pc to PC */
ARM_LDR_IMM (code, ARMREG_IP, ctx_reg, G_STRUCT_OFFSET (MonoContext, pc));
@@ -135,13 +135,9 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
void
mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs)
{
- static void (*restore_context) (MonoContext *);
MonoContext ctx;
gboolean rethrow = pc & 1;
- if (!restore_context)
- restore_context = mono_get_restore_context ();
-
pc &= ~1; /* clear the optional rethrow bit */
/* adjust eip so that it point into the call instruction */
pc -= 4;
@@ -159,7 +155,7 @@ mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_
mono_ex->stack_trace = NULL;
}
mono_handle_exception (&ctx, exc);
- restore_context (&ctx);
+ mono_restore_context (&ctx);
g_assert_not_reached ();
}
@@ -220,12 +216,12 @@ get_throw_trampoline (int size, gboolean corlib, gboolean rethrow, gboolean llvm
mono_add_unwind_op_offset (unwind_ops, code, start, ARMREG_LR, - sizeof (mgreg_t));
/* Save fp regs */
- ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, sizeof (double) * 16);
- cfa_offset += sizeof (double) * 16;
- mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, cfa_offset);
-#if defined(ARM_FPU_VFP)
- ARM_FSTMD (code, ARM_VFP_D0, 16, ARMREG_SP);
-#endif
+ if (!mono_arch_is_soft_float ()) {
+ ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, sizeof (double) * 16);
+ cfa_offset += sizeof (double) * 16;
+ mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, cfa_offset);
+ ARM_FSTMD (code, ARM_VFP_D0, 16, ARMREG_SP);
+ }
/* Param area */
ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 8);
@@ -371,8 +367,7 @@ mono_arch_exceptions_init (void)
MonoTrampInfo *info = l->data;
mono_register_jit_icall (info->code, g_strdup (info->name), NULL, TRUE);
- mono_save_trampoline_xdebug_info (info);
- mono_tramp_info_free (info);
+ mono_tramp_info_register (info);
}
g_slist_free (tramps);
}
@@ -399,7 +394,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
if (ji != NULL) {
int i;
- gssize regs [MONO_MAX_IREGS + 1];
+ gssize regs [MONO_MAX_IREGS + 1 + 8];
guint8 *cfa;
guint32 unwind_info_len;
guint8 *unwind_info;
@@ -411,18 +406,32 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
else
unwind_info = mono_get_cached_unwind_info (ji->used_regs, &unwind_info_len);
+ /*
+ printf ("%s %p %p\n", ji->d.method->name, ji->code_start, ip);
+ mono_print_unwind_info (unwind_info, unwind_info_len);
+ */
+
for (i = 0; i < 16; ++i)
regs [i] = new_ctx->regs [i];
+#ifdef TARGET_IOS
+ /* On IOS, d8..d15 are callee saved. They are mapped to 8..15 in unwind.c */
+ for (i = 0; i < 8; ++i)
+ regs [MONO_MAX_IREGS + i] = new_ctx->fregs [8 + i];
+#endif
mono_unwind_frame (unwind_info, unwind_info_len, ji->code_start,
(guint8*)ji->code_start + ji->code_size,
- ip, regs, MONO_MAX_IREGS,
+ ip, regs, MONO_MAX_IREGS + 8,
save_locations, MONO_MAX_IREGS, &cfa);
for (i = 0; i < 16; ++i)
new_ctx->regs [i] = regs [i];
new_ctx->pc = regs [ARMREG_LR];
new_ctx->regs [ARMREG_SP] = (gsize)cfa;
+#ifdef TARGET_IOS
+ for (i = 0; i < 8; ++i)
+ new_ctx->fregs [8 + i] = regs [MONO_MAX_IREGS + i];
+#endif
if (*lmf && (MONO_CONTEXT_GET_SP (ctx) >= (gpointer)(*lmf)->sp)) {
/* remove any unused lmf */
@@ -517,16 +526,12 @@ handle_signal_exception (gpointer obj)
{
MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
MonoContext ctx;
- static void (*restore_context) (MonoContext *);
-
- if (!restore_context)
- restore_context = mono_get_restore_context ();
memcpy (&ctx, &jit_tls->ex_ctx, sizeof (MonoContext));
mono_handle_exception (&ctx, obj);
- restore_context (&ctx);
+ mono_restore_context (&ctx);
}
/*