void
mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow)
{
+ MonoError error;
MonoContext ctx;
/* adjust eip so that it point into the call instruction */
memcpy (&ctx.regs, int_regs, sizeof (mgreg_t) * MONO_SAVED_GREGS);
memcpy (&ctx.fregs, fp_regs, sizeof (double) * MONO_SAVED_FREGS);
- if (mono_object_isinst (exc, mono_defaults.exception_class)) {
+ if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) {
MonoException *mono_ex = (MonoException*)exc;
- if (!rethrow)
+ if (!rethrow) {
mono_ex->stack_trace = NULL;
+ mono_ex->trace_ips = NULL;
+ }
}
+ mono_error_assert_ok (&error);
mono_handle_exception (&ctx, exc);
mono_restore_context (&ctx);
}
/*
- * mono_arch_find_jit_info:
+ * mono_arch_unwind_frame:
*
* See exceptions-amd64.c for docs.
*/
gboolean
-mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
+mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls,
MonoJitInfo *ji, MonoContext *ctx,
MonoContext *new_ctx, MonoLMF **lmf,
mgreg_t **save_locations,
guint32 unwind_info_len;
guint8 *unwind_info;
- frame->type = FRAME_TYPE_MANAGED;
+ if (ji->is_trampoline)
+ frame->type = FRAME_TYPE_TRAMPOLINE;
+ else
+ frame->type = FRAME_TYPE_MANAGED;
unwind_info = mono_jinfo_get_unwind_info (ji, &unwind_info_len);
sframe = (MonoPPCStackFrame*)MONO_CONTEXT_GET_SP (ctx);
MONO_CONTEXT_SET_BP (new_ctx, sframe->sp);
- if (jinfo_get_method (ji)->save_lmf) {
+ if (!ji->is_trampoline && jinfo_get_method (ji)->save_lmf) {
/* sframe->sp points just past the end of the LMF */
guint8 *lmf_addr = (guint8*)sframe->sp - sizeof (MonoLMF);
memcpy (&new_ctx->fregs, lmf_addr + G_STRUCT_OFFSET (MonoLMF, fregs), sizeof (double) * MONO_SAVED_FREGS);
const char *method;
/* we don't do much now, but we can warn the user with a useful message */
fprintf (stderr, "Stack overflow: IP: %p, SP: %p\n", mono_arch_ip_from_context (sigctx), (gpointer)UCONTEXT_REG_Rn(uc, 1));
- if (ji && jinfo_get_method (ji))
+ if (ji && !ji->is_trampoline && jinfo_get_method (ji))
method = mono_method_full_name (jinfo_get_method (ji), TRUE);
else
method = "Unmanaged";
abort ();
}
if (!ji)
- mono_handle_native_sigsegv (SIGSEGV, sigctx, siginfo);
+ mono_handle_native_sigsegv ("SIGSEGV", sigctx, siginfo);
/* setup a call frame on the real stack so that control is returned there
* and exception handling can continue.
* The frame looks like:
}
#else
UCONTEXT_REG_NIP(uc) = (unsigned long)altstack_handle_and_restore;
+#if _CALL_ELF == 2
+ /* ELF v2 ABI calling convention requires to put the target address into
+ * r12 if we use the global entry point of a function. */
+ UCONTEXT_REG_Rn(uc, 12) = (unsigned long) altstack_handle_and_restore;
+#endif
#endif
UCONTEXT_REG_Rn(uc, 1) = (unsigned long)sp;
UCONTEXT_REG_Rn(uc, PPC_FIRST_ARG_REG) = (unsigned long)(sp + 16);
}
#else
UCONTEXT_REG_NIP(uc) = (unsigned long)func;
+#if _CALL_ELF == 2
+ /* ELF v2 ABI calling convention requires to put the target address into
+ * r12 if we use the global entry point of a function. */
+ UCONTEXT_REG_Rn(uc, 12) = (unsigned long) func;
+#endif
#endif
#endif
}
return result;
#endif
}
+
+
+// FIX ME: This is not complete
+void
+mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data)
+{
+ uintptr_t sp = (uintptr_t) MONO_CONTEXT_GET_SP(ctx);
+ sp -= PPC_MINIMAL_STACK_SIZE;
+ *(unsigned long *)sp = MONO_CONTEXT_GET_SP(ctx);
+ MONO_CONTEXT_SET_BP(ctx, sp);
+ MONO_CONTEXT_SET_IP(ctx, (unsigned long) async_cb);
+}
+