On Thu, 2002-04-18 at 09:29, Miguel de Icaza wrote:

> Very nice!  You might want to look into compiling and running the
> compiler test suite and the mono engine test suite (mcs/tests and
> mono/mono/tests). 

I'll do that ASAP...

> Yeah, we expected something like that would be needed.  Could you post
> the diff, so we can discuss how to best split the code?

Patches attached. I've also attached the configure line I had to use
(looks like pthread support in autoconf has to be reworked, sorry I'm
not an autoconf guru).

> Sounds like a problem in the port.  That can mean all sorts of things,
> it is just the behavior when something is going badly on the binding to
> the OS. 

Maybe that the test suite can pinpoint us to the bug location.

Cheers,
  Sandro Tolaini.
env CPPFLAGS="-pthread -I/usr/local/include" LDFLAGS="-pthread -L/usr/local/lib" 
./configure
diff -r --unified mono-0.10.orig/mono/io-layer/io.c mono-0.10/mono/io-layer/io.c
--- mono-0.10.orig/mono/io-layer/io.c	Wed Mar 27 06:05:39 2002
+++ mono-0.10/mono/io-layer/io.c	Sat Apr 13 10:42:10 2002
@@ -1635,9 +1635,11 @@
 		g_free (handle);
 
 		switch (result) {
+#ifdef GLOB_NOMATCH
 		case GLOB_NOMATCH:
 			SetLastError (ERROR_NO_MORE_FILES);
 			break;
+#endif
 
 		default:
 #ifdef DEBUG
diff -r --unified mono-0.10.orig/mono/io-layer/sockets.c mono-0.10/mono/io-layer/sockets.c
--- mono-0.10.orig/mono/io-layer/sockets.c	Tue Mar 19 20:08:12 2002
+++ mono-0.10/mono/io-layer/sockets.c	Sat Apr 13 10:42:23 2002
@@ -233,7 +233,9 @@
 		case EINVAL:
 			WSASetLastError(WSAEINVAL);
 			break;
+#ifdef ENOSR
 		case ENOSR:
+#endif
 		case ECONNABORTED:
 		case ESOCKTNOSUPPORT:
 		case EPROTONOSUPPORT:
diff -r --unified mono-0.10.orig/mono/io-layer/unicode.c mono-0.10/mono/io-layer/unicode.c
--- mono-0.10.orig/mono/io-layer/unicode.c	Wed Mar 27 06:05:39 2002
+++ mono-0.10/mono/io-layer/unicode.c	Sat Apr 13 10:42:45 2002
@@ -1,7 +1,7 @@
 #include <config.h>
 #include <glib.h>
 #include <pthread.h>
-#include <iconv.h>
+#include <giconv.h>
 #include <errno.h>
 
 #include "mono/io-layer/wapi.h"
diff -r --unified mono-0.10.orig/mono/jit/exception.c mono-0.10/mono/jit/exception.c
--- mono-0.10.orig/mono/jit/exception.c	Thu Mar 21 23:02:16 2002
+++ mono-0.10/mono/jit/exception.c	Sat Apr 13 10:49:11 2002
@@ -40,19 +40,19 @@
 	x86_mov_reg_membase (code, X86_EAX, X86_ESP, 4, 4);
 
 	/* get return address, stored in EDX */
-	x86_mov_reg_membase (code, X86_EDX, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, eip), 4);
+	x86_mov_reg_membase (code, X86_EDX, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, sc_eip), 4);
 	/* restore EBX */
-	x86_mov_reg_membase (code, X86_EBX, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, ebx), 4);
+	x86_mov_reg_membase (code, X86_EBX, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, sc_ebx), 4);
 	/* restore EDI */
-	x86_mov_reg_membase (code, X86_EDI, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, edi), 4);
+	x86_mov_reg_membase (code, X86_EDI, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, sc_edi), 4);
 	/* restore ESI */
-	x86_mov_reg_membase (code, X86_ESI, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, esi), 4);
+	x86_mov_reg_membase (code, X86_ESI, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, sc_esi), 4);
 	/* restore ESP */
-	x86_mov_reg_membase (code, X86_ESP, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, esp), 4);
+	x86_mov_reg_membase (code, X86_ESP, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, sc_esp), 4);
 	/* restore EBP */
-	x86_mov_reg_membase (code, X86_EBP, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, ebp), 4);
+	x86_mov_reg_membase (code, X86_EBP, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, sc_ebp), 4);
 	/* restore ECX. the exception object is passed here to the catch handler */
-	x86_mov_reg_membase (code, X86_ECX, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, ecx), 4);
+	x86_mov_reg_membase (code, X86_ECX, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, sc_ecx), 4);
 
 	/* jump to the saved IP */
 	x86_jump_reg (code, X86_EDX);
@@ -92,7 +92,7 @@
 	/* save EBP */
 	x86_push_reg (code, X86_EBP);
 	/* set new EBP */
-	x86_mov_reg_membase (code, X86_EBP, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, ebp), 4);
+	x86_mov_reg_membase (code, X86_EBP, X86_EAX,  G_STRUCT_OFFSET (struct sigcontext, sc_ebp), 4);
 	/* call the handler */
 	x86_call_reg (code, X86_ECX);
 	/* restore EBP */
@@ -119,7 +119,7 @@
 {
 	MonoDomain *domain = mono_domain_get ();
 	MonoJitInfo *ji;
-	gpointer ip = (gpointer)ctx->eip;
+	gpointer ip = (gpointer)ctx->sc_eip;
 	static void (*restore_context) (struct sigcontext *);
 	static void (*call_finally) (struct sigcontext *, unsigned long);
 	void (*cleanup) (MonoObject *exc);
@@ -155,8 +155,8 @@
 					if (ei->flags == 0 && mono_object_isinst (obj, 
 					        mono_class_get (m->klass->image, ei->token_or_filter))) {
 					
-						ctx->eip = (unsigned long)ei->handler_start;
-						ctx->ecx = (unsigned long)obj;
+						ctx->sc_eip = (unsigned long)ei->handler_start;
+						ctx->sc_ecx = (unsigned long)obj;
 						restore_context (ctx);
 						g_assert_not_reached ();
 					}
@@ -196,22 +196,22 @@
 
 		/* restore caller saved registers */
 		if (ji->used_regs & X86_ESI_MASK) {
-			ctx->esi = *((int *)ctx->ebp + offset);
+			ctx->sc_esi = *((int *)ctx->sc_ebp + offset);
 			offset++;
 		}
 		if (ji->used_regs & X86_EDI_MASK) {
-			ctx->edi = *((int *)ctx->ebp + offset);
+			ctx->sc_edi = *((int *)ctx->sc_ebp + offset);
 			offset++;
 		}
 		if (ji->used_regs & X86_EBX_MASK) {
-			ctx->ebx = *((int *)ctx->ebp + offset);
+			ctx->sc_ebx = *((int *)ctx->sc_ebp + offset);
 		}
 
-		ctx->esp = ctx->ebp;
-		ctx->eip = *((int *)ctx->ebp + 1);
-		ctx->ebp = *((int *)ctx->ebp);
+		ctx->sc_esp = ctx->sc_ebp;
+		ctx->sc_eip = *((int *)ctx->sc_ebp + 1);
+		ctx->sc_ebp = *((int *)ctx->sc_ebp);
 		
-		if (ctx->ebp < (unsigned)mono_end_of_stack)
+		if (ctx->sc_ebp < (unsigned)mono_end_of_stack)
 			arch_handle_exception (ctx, obj);
 		else
 			cleanup (obj);
@@ -231,12 +231,12 @@
 
 		*lmf_addr = lmf->previous_lmf;
 
-		ctx->esi = lmf->esi;
-		ctx->edi = lmf->edi;
-		ctx->ebx = lmf->ebx;
-		ctx->ebp = lmf->ebp;
-		ctx->eip = lmf->eip;
-		ctx->esp = (unsigned long)&lmf->eip;
+		ctx->sc_esi = lmf->esi;
+		ctx->sc_edi = lmf->edi;
+		ctx->sc_ebx = lmf->ebx;
+		ctx->sc_ebp = lmf->ebp;
+		ctx->sc_eip = lmf->eip;
+		ctx->sc_esp = (unsigned long)&lmf->eip;
 
 		if (mono_object_isinst (obj, mono_defaults.exception_class)) {
 			char  *strace = mono_string_to_utf8 (((MonoException*)obj)->stack_trace);
@@ -254,7 +254,7 @@
 			g_free (tmp);
 		}
 
-		if (ctx->eip < (unsigned)mono_end_of_stack)
+		if (ctx->sc_eip < (unsigned)mono_end_of_stack)
 			arch_handle_exception (ctx, obj);
 		else 
 			cleanup (obj);
@@ -270,15 +270,15 @@
 {
 	struct sigcontext ctx;
 
-	ctx.esp = esp;
-	ctx.eip = eip;
-	ctx.ebp = ebp;
-	ctx.edi = edi;
-	ctx.esi = esi;
-	ctx.ebx = ebx;
-	ctx.edx = edx;
-	ctx.ecx = ecx;
-	ctx.eax = eax;
+	ctx.sc_esp = esp;
+	ctx.sc_eip = eip;
+	ctx.sc_ebp = ebp;
+	ctx.sc_edi = edi;
+	ctx.sc_esi = esi;
+	ctx.sc_ebx = ebx;
+	ctx.sc_edx = edx;
+	ctx.sc_ecx = ecx;
+	ctx.sc_eax = eax;
 	
 	arch_handle_exception (&ctx, exc);
 
diff -r --unified mono-0.10.orig/mono/metadata/debug-symfile.c mono-0.10/mono/metadata/debug-symfile.c
--- mono-0.10.orig/mono/metadata/debug-symfile.c	Wed Mar 27 00:10:11 2002
+++ mono-0.10/mono/metadata/debug-symfile.c	Sat Apr 13 10:44:13 2002
@@ -128,6 +128,9 @@
 get_sections (MonoDebugSymbolFile *symfile, gboolean emit_warnings)
 {
 #ifdef HAVE_ELF_H
+#ifdef __FreeBSD__
+	static const char ELFMAG[] = { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, 0 };
+#endif
 	if (!strncmp (symfile->raw_contents, ELFMAG, strlen (ELFMAG)))
 		return get_sections_elf32 (symfile, emit_warnings);
 #endif
diff -r --unified mono-0.10.orig/mono/metadata/icall.c mono-0.10/mono/metadata/icall.c
--- mono-0.10.orig/mono/metadata/icall.c	Wed Mar 27 06:05:39 2002
+++ mono-0.10/mono/metadata/icall.c	Sat Apr 13 10:43:27 2002
@@ -36,6 +36,9 @@
 #include <mono/io-layer/io-layer.h>
 #include "decimal.h"
 
+#ifdef __FreeBSD__
+extern char **environ;
+#endif
 
 static MonoObject *
 ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
diff -r --unified mono-0.10.orig/mono/metadata/unicode.c mono-0.10/mono/metadata/unicode.c
--- mono-0.10.orig/mono/metadata/unicode.c	Sun Mar 24 22:11:31 2002
+++ mono-0.10/mono/metadata/unicode.c	Sat Apr 13 10:43:42 2002
@@ -14,7 +14,7 @@
 #include <mono/metadata/object.h>
 #include <mono/metadata/unicode.h>
 
-#include <iconv.h>
+#include <giconv.h>
 
 static MonoUnicodeCategory catmap[] = {
 	/* G_UNICODE_CONTROL = */              Control,

Reply via email to