Author: zoltan
Date: 2007-12-21 15:00:42 -0500 (Fri, 21 Dec 2007)
New Revision: 91786
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/exceptions-amd64.c
Log:
2007-12-21 Zoltan Varga <[EMAIL PROTECTED]>
* exceptions-amd64.c (mono_arch_find_jit_info): Fix the detection of
whenever
the top LMF entry belongs to the current method.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2007-12-21 19:26:37 UTC (rev 91785)
+++ trunk/mono/mono/mini/ChangeLog 2007-12-21 20:00:42 UTC (rev 91786)
@@ -1,5 +1,8 @@
2007-12-21 Zoltan Varga <[EMAIL PROTECTED]>
+ * exceptions-amd64.c (mono_arch_find_jit_info): Fix the detection of
whenever
+ the top LMF entry belongs to the current method.
+
* mini.c: Update after renaming of mono_thread_get_pending_exception ().
2007-12-20 Zoltan Varga <[EMAIL PROTECTED]>
Modified: trunk/mono/mono/mini/exceptions-amd64.c
===================================================================
--- trunk/mono/mono/mini/exceptions-amd64.c 2007-12-21 19:26:37 UTC (rev
91785)
+++ trunk/mono/mono/mini/exceptions-amd64.c 2007-12-21 20:00:42 UTC (rev
91786)
@@ -542,11 +542,23 @@
* JIT, so we have to restore callee saved registers from the
lmf.
*/
if (ji->method->save_lmf) {
- /*
- * We only need to do this if the exception was raised
in managed
- * code, since otherwise the lmf was already popped of
the stack.
+ gboolean lmf_match;
+
+ /*
+ * If the exception was raised in unmanaged code, then
the LMF was already
+ * popped off the stack. We detect that case by
comparing the sp (or bp)
+ * value in the LMF with the one in the context. This
works because these
+ * registers are saved to the LMF at the start of the
method.
*/
- if (*lmf && ((*lmf) != jit_tls->first_lmf) &&
(MONO_CONTEXT_GET_SP (ctx) >= (gpointer)(*lmf)->rsp)) {
+ if (omit_fp)
+ lmf_match = (*lmf) && (*lmf)->rsp == ctx->rsp;
+ else
+ lmf_match = (*lmf) && (*lmf)->ebp == ctx->rbp;
+
+ if (*lmf && ((*lmf) != jit_tls->first_lmf) &&
lmf_match) {
+ /* Make sure the LMF belongs to this method */
+ g_assert ((*lmf)->rip >=
(guint64)ji->code_start && (*lmf)->rip <= ((guint64)((guint8*)ji->code_start +
ji->code_size)));
+
new_ctx->rbp = (*lmf)->ebp;
new_ctx->rbx = (*lmf)->rbx;
new_ctx->rsp = (*lmf)->rsp;
@@ -554,6 +566,8 @@
new_ctx->r13 = (*lmf)->r13;
new_ctx->r14 = (*lmf)->r14;
new_ctx->r15 = (*lmf)->r15;
+
+ *lmf = (*lmf)->previous_lmf;
}
}
else {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches