Author: zoltan
Date: 2005-04-11 10:16:27 -0400 (Mon, 11 Apr 2005)
New Revision: 42789
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/exceptions-x86.c
trunk/mono/mono/mini/mini-x86.c
trunk/mono/mono/mini/mini-x86.h
Log:
2005-04-11 Zoltan Varga <[EMAIL PROTECTED]>
* exceptions-x86.c mini-x86.h mini-x86.c: Applied some freebsd patches
from Bill Middleton <[EMAIL PROTECTED]>.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2005-04-11 14:14:47 UTC (rev 42788)
+++ trunk/mono/mono/mini/ChangeLog 2005-04-11 14:16:27 UTC (rev 42789)
@@ -1,3 +1,8 @@
+2005-04-11 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * exceptions-x86.c mini-x86.h mini-x86.c: Applied some freebsd patches
+ from Bill Middleton <[EMAIL PROTECTED]>.
+
2005-04-10 Zoltan Varga <[EMAIL PROTECTED]>
* arrays.cs: Add new regression test. Fix warnings.
Modified: trunk/mono/mono/mini/exceptions-x86.c
===================================================================
--- trunk/mono/mono/mini/exceptions-x86.c 2005-04-11 14:14:47 UTC (rev
42788)
+++ trunk/mono/mono/mini/exceptions-x86.c 2005-04-11 14:16:27 UTC (rev
42789)
@@ -25,6 +25,10 @@
#include "mini.h"
#include "mini-x86.h"
+#if defined(__FreeBSD__)
+#include <ucontext.h>
+#endif
+
#ifdef PLATFORM_WIN32
static MonoW32ExceptionHandler fpe_handler;
static MonoW32ExceptionHandler ill_handler;
@@ -549,6 +553,17 @@
#ifdef MONO_ARCH_USE_SIGACTION
ucontext_t *ctx = (ucontext_t*)sigctx;
+#if defined(__FreeBSD__)
+ mctx->eax = ctx->uc_mcontext.mc_eax;
+ mctx->ebx = ctx->uc_mcontext.mc_ebx;
+ mctx->ecx = ctx->uc_mcontext.mc_ecx;
+ mctx->edx = ctx->uc_mcontext.mc_edx;
+ mctx->ebp = ctx->uc_mcontext.mc_ebp;
+ mctx->esp = ctx->uc_mcontext.mc_esp;
+ mctx->esi = ctx->uc_mcontext.mc_esi;
+ mctx->edi = ctx->uc_mcontext.mc_edi;
+ mctx->eip = ctx->uc_mcontext.mc_eip;
+#else
mctx->eax = ctx->uc_mcontext.gregs [REG_EAX];
mctx->ebx = ctx->uc_mcontext.gregs [REG_EBX];
mctx->ecx = ctx->uc_mcontext.gregs [REG_ECX];
@@ -558,6 +573,7 @@
mctx->esi = ctx->uc_mcontext.gregs [REG_ESI];
mctx->edi = ctx->uc_mcontext.gregs [REG_EDI];
mctx->eip = ctx->uc_mcontext.gregs [REG_EIP];
+#endif
#else
struct sigcontext *ctx = (struct sigcontext *)sigctx;
@@ -579,6 +595,18 @@
#ifdef MONO_ARCH_USE_SIGACTION
ucontext_t *ctx = (ucontext_t*)sigctx;
+#if defined(__FreeBSD__)
+ ctx->uc_mcontext.mc_eax = mctx->eax;
+ ctx->uc_mcontext.mc_ebx = mctx->ebx;
+ ctx->uc_mcontext.mc_ecx = mctx->ecx;
+ ctx->uc_mcontext.mc_edx = mctx->edx;
+ ctx->uc_mcontext.mc_ebp = mctx->ebp;
+ ctx->uc_mcontext.mc_esp = mctx->esp;
+ ctx->uc_mcontext.mc_esi = mctx->esi;
+ ctx->uc_mcontext.mc_edi = mctx->edi;
+ ctx->uc_mcontext.mc_eip = mctx->eip;
+
+#else
ctx->uc_mcontext.gregs [REG_EAX] = mctx->eax;
ctx->uc_mcontext.gregs [REG_EBX] = mctx->ebx;
ctx->uc_mcontext.gregs [REG_ECX] = mctx->ecx;
@@ -588,6 +616,7 @@
ctx->uc_mcontext.gregs [REG_ESI] = mctx->esi;
ctx->uc_mcontext.gregs [REG_EDI] = mctx->edi;
ctx->uc_mcontext.gregs [REG_EIP] = mctx->eip;
+#endif
#else
struct sigcontext *ctx = (struct sigcontext *)sigctx;
@@ -608,7 +637,11 @@
{
#ifdef MONO_ARCH_USE_SIGACTION
ucontext_t *ctx = (ucontext_t*)sigctx;
+#if defined(__FreeBSD__)
+ return (gpointer)ctx->uc_mcontext.mc_eip;
+#else
return (gpointer)ctx->uc_mcontext.gregs [REG_EIP];
+#endif
#else
struct sigcontext *ctx = sigctx;
return (gpointer)ctx->SC_EIP;
Modified: trunk/mono/mono/mini/mini-x86.c
===================================================================
--- trunk/mono/mono/mini/mini-x86.c 2005-04-11 14:14:47 UTC (rev 42788)
+++ trunk/mono/mono/mini/mini-x86.c 2005-04-11 14:16:27 UTC (rev 42789)
@@ -4691,6 +4691,9 @@
pthread_getattr_np( self, &attr );
#else
#ifdef HAVE_PTHREAD_ATTR_GET_NP
+#if defined(__FreeBSD__)
+ pthread_attr_init( &attr );
+#endif
pthread_attr_get_np( self, &attr );
#elif defined(sun)
pthread_attr_init( &attr );
Modified: trunk/mono/mono/mini/mini-x86.h
===================================================================
--- trunk/mono/mono/mini/mini-x86.h 2005-04-11 14:14:47 UTC (rev 42788)
+++ trunk/mono/mono/mini/mini-x86.h 2005-04-11 14:16:27 UTC (rev 42789)
@@ -77,17 +77,21 @@
#ifndef PLATFORM_WIN32
#ifdef HAVE_WORKING_SIGALTSTACK
-
#define MONO_ARCH_SIGSEGV_ON_ALTSTACK
#define MONO_ARCH_USE_SIGACTION
-/* NetBSD doesn't define SA_STACK */
-#ifndef SA_STACK
-#define SA_STACK SA_ONSTACK
-#endif
-#endif
+/* FreeBSD and NetBSD need SA_STACK and MAP_ANON re-definitions */
+# if defined(__FreeBSD__) || defined(__NetBSD__)
+# ifndef SA_STACK
+# define SA_STACK SA_ONSTACK
+# endif
+# ifndef MAP_ANONYMOUS
+# define MAP_ANONYMOUS MAP_ANON
+# endif
+# endif /* BSDs */
-#endif
+#endif /* HAVE_WORKING_SIGALTSTACK */
+#endif /* !PLATFORM_WIN32 */
/* Enables OP_LSHL, OP_LSHL_IMM, OP_LSHR, OP_LSHR_IMM, OP_LSHR_UN,
OP_LSHR_UN_IMM */
#define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches