- if (native_offset)
- *native_offset = address;
-
- if (managed)
- if (!ji->method->wrapper_type)
- *managed = TRUE;
-
- sframe = (MonoS390StackFrame *) MONO_CONTEXT_GET_SP (ctx);
- MONO_CONTEXT_SET_BP (new_ctx, sframe->prev);
- sframe = (MonoS390StackFrame *) sframe->prev;
- MONO_CONTEXT_SET_IP (new_ctx, sframe->return_address);
- memcpy (&new_ctx->uc_mcontext.gregs[6], sframe->regs, (8*sizeof(gint64)));
- return ji;
-
+ memcpy(®s, &ctx->uc_mcontext.gregs, sizeof(regs));
+ mono_unwind_frame (unwind_info, unwind_info_len, ji->code_start,
+ (guint8 *) ji->code_start + ji->code_size,
+ ip, regs, 16, save_locations,
+ MONO_MAX_IREGS, &cfa);
+ memcpy (&new_ctx->uc_mcontext.gregs, ®s, sizeof(regs));
+ MONO_CONTEXT_SET_IP(new_ctx, regs[14] - 2);
+ MONO_CONTEXT_SET_BP(new_ctx, cfa);
+
+ if (*lmf && (MONO_CONTEXT_GET_SP (ctx) >= (gpointer)(*lmf)->ebp)) {
+ /* remove any unused lmf */
+ *lmf = (*lmf)->previous_lmf;
+ }
+ return TRUE;