diff options
author | Zoltan Varga <vargaz@gmail.com> | 2006-03-25 03:00:02 +0300 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2006-03-25 03:00:02 +0300 |
commit | 725e5ee542df021f0fa570506408d8917dff4de6 (patch) | |
tree | 0ce5c66a063c355ed296f713846a05706f02a59f | |
parent | dbda238384e1f69dde87a9e497160423430dba2e (diff) |
Merge from HEAD.
svn path=/branches/mono-1-1-13/mono/; revision=58510
-rw-r--r-- | mono/mini/ChangeLog | 4 | ||||
-rw-r--r-- | mono/mini/exceptions-sparc.c | 61 |
2 files changed, 60 insertions, 5 deletions
diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 8d0dc7af8e9..54de7c290d4 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,7 @@ +2006-03-25 Zoltan Varga <vargaz@gmail.com> + + * exceptions-sparc.c: Applied patch from David S. Miller <davem@sunset.davemloft.net>: Implement correct support for sparc/linux. + 2006-03-19 Zoltan Varga <vargaz@gmail.com> * mini.c (print_method_from_ip): Rename this to diff --git a/mono/mini/exceptions-sparc.c b/mono/mini/exceptions-sparc.c index 5abbab8a24c..184d28bdcc1 100644 --- a/mono/mini/exceptions-sparc.c +++ b/mono/mini/exceptions-sparc.c @@ -425,6 +425,61 @@ mono_arch_has_unwind_info (gconstpointer addr) return FALSE; } +#ifdef __linux__ + +gboolean +mono_arch_handle_exception (void *sigctx, gpointer obj, gboolean test_only) +{ + MonoContext mctx; + struct sigcontext *sc = sigctx; + gpointer *window; + +#ifdef SPARCV9 + mctx.ip = (gpointer) sc->sigc_regs.tpc; + mctx.sp = (gpointer) sc->sigc_regs.u_regs[14]; +#else + mctx.ip = (gpointer) sc->si_regs.pc; + mctx.sp = (gpointer) sc->si_regs.u_regs[14]; +#endif + + window = (gpointer*)(((guint8*)mctx.sp) + MONO_SPARC_STACK_BIAS); + mctx.fp = window [sparc_fp - 16]; + + mono_handle_exception (&mctx, obj, mctx.ip, test_only); + +#ifdef SPARCV9 + sc->sigc_regs.tpc = (unsigned long) mctx.ip; + sc->sigc_regs.tnpc = (unsigned long) (mctx.ip + 4); + sc->sigc_regs.u_regs[14] = (unsigned long) mctx.sp; +#else + sc->si_regs.pc = (unsigned long) mctx.ip; + sc->si_regs.npc = (unsigned long) (mctx.ip + 4); + sc->si_regs.u_regs[14] = (unsigned long) mctx.sp; +#endif + + window = (gpointer*)(((guint8*)mctx.sp) + MONO_SPARC_STACK_BIAS); + window [sparc_fp - 16] = mctx.fp; + + return TRUE; +} + +gpointer +mono_arch_ip_from_context (void *sigctx) +{ + struct sigcontext *sc = sigctx; + gpointer *ret; + +#ifdef SPARCV9 + ret = (gpointer) sc->sigc_regs.tpc; +#else + ret = (gpointer) sc->si_regs.pc; +#endif + + return ret; +} + +#else /* !__linux__ */ + gboolean mono_arch_handle_exception (void *sigctx, gpointer obj, gboolean test_only) { @@ -437,12 +492,7 @@ mono_arch_handle_exception (void *sigctx, gpointer obj, gboolean test_only) * under documented under solaris. The code below seems to work under * Solaris 9. */ -#ifndef __linux__ g_assert (!ctx->uc_mcontext.gwins); -#else - /* better, but doesn't work all the time. need to rethink! */ - g_assert (!ctx->uc_mcontext.gregs); -#endif mctx.ip = ctx->uc_mcontext.gregs [REG_PC]; mctx.sp = ctx->uc_mcontext.gregs [REG_SP]; @@ -468,3 +518,4 @@ mono_arch_ip_from_context (void *sigctx) return (gpointer)ctx->uc_mcontext.gregs [REG_PC]; } +#endif |