X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fexceptions-ppc.c;h=80a579b05eb87e539e3b1c344edf636991b4c667;hb=3e69ff3ae72acec33c471236da49ed6c78b26dc4;hp=4b8d1642c166986decc197df563fe673ba0bcb1d;hpb=817ae3d1db3c99e060952742870a999a7708a8b9;p=mono.git diff --git a/mono/mini/exceptions-ppc.c b/mono/mini/exceptions-ppc.c index 4b8d1642c16..80a579b05eb 100644 --- a/mono/mini/exceptions-ppc.c +++ b/mono/mini/exceptions-ppc.c @@ -318,6 +318,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) 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 */ @@ -331,11 +332,14 @@ mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, 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); @@ -503,12 +507,12 @@ mono_arch_get_throw_corlib_exception (MonoTrampInfo **info, gboolean aot) } /* - * 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, @@ -530,13 +534,16 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, 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); @@ -651,7 +658,7 @@ mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *s 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"; @@ -781,3 +788,16 @@ mono_arch_handle_exception (void *ctx, gpointer obj) 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); +} +