Author: spouliot
Date: 2005-03-29 13:25:37 -0500 (Tue, 29 Mar 2005)
New Revision: 42350

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/aot.c
   trunk/mono/mono/mini/mini-exceptions.c
   trunk/mono/mono/mini/mini-x86.c
   trunk/mono/mono/mini/mini-x86.h
   trunk/mono/mono/mini/mini.h
Log:
2005-03-29  Sebastien Pouliot  <[EMAIL PROTECTED]>
        * aot.c, mini.h: Added mono-compiler.h header to allow/ease 
        compilation with non-GCC compilers.
        * mini-exceptions.c, mini-x86.c|h: Patches to make compilation of mono
        possible using VS.NET. Adapted from the work of J Lothian (for VC6).



Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2005-03-29 18:16:10 UTC (rev 42349)
+++ trunk/mono/mono/mini/ChangeLog      2005-03-29 18:25:37 UTC (rev 42350)
@@ -1,4 +1,10 @@
+2005-03-29  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
+       * aot.c, mini.h: Added mono-compiler.h header to allow/ease 
+       compilation with non-GCC compilers.
+       * mini-exceptions.c, mini-x86.c|h: Patches to make compilation of mono
+       possible using VS.NET. Adapted from the work of J Lothian (for VC6).
+
 Tue Mar 29 11:43:01 CEST 2005 Paolo Molaro <[EMAIL PROTECTED]>
 
        * inssel.brg, arrays.cs: fix long stabding 64 bit issue in access to

Modified: trunk/mono/mono/mini/aot.c
===================================================================
--- trunk/mono/mono/mini/aot.c  2005-03-29 18:16:10 UTC (rev 42349)
+++ trunk/mono/mono/mini/aot.c  2005-03-29 18:25:37 UTC (rev 42350)
@@ -16,6 +16,7 @@
 #ifndef PLATFORM_WIN32
 #include <sys/mman.h>
 #else
+#include <winsock2.h>
 #include <windows.h>
 #endif
 
@@ -36,6 +37,7 @@
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/marshal.h>
 #include <mono/utils/mono-logger.h>
+#include "mono/utils/mono-compiler.h"
 
 #include "mini.h"
 

Modified: trunk/mono/mono/mini/mini-exceptions.c
===================================================================
--- trunk/mono/mono/mini/mini-exceptions.c      2005-03-29 18:16:10 UTC (rev 
42349)
+++ trunk/mono/mono/mini/mini-exceptions.c      2005-03-29 18:25:37 UTC (rev 
42350)
@@ -279,11 +279,20 @@
 
        MonoContext ctx, new_ctx;
 
+#ifdef _MSC_VER
+       unsigned int stackptr, retaddr;
+       __asm mov stackptr, ebp;
+       __asm mov eax, DWORD PTR [ebp + 4];
+       __asm mov retaddr, eax;
+       MONO_CONTEXT_SET_IP (&ctx, retaddr);
+       /* FIXME: NOT WORKING -- THIS IS __builtin_frame_address (0) NOT (1) */
+       MONO_CONTEXT_SET_BP (&ctx, stackptr);
+#else
        mono_arch_flush_register_windows ();
 
        MONO_CONTEXT_SET_IP (&ctx, __builtin_return_address (0));
        MONO_CONTEXT_SET_BP (&ctx, __builtin_frame_address (1));
-
+#endif
        while (MONO_CONTEXT_GET_BP (&ctx) < jit_tls->end_of_stack) {
                
                ji = mono_find_jit_info (domain, jit_tls, &rji, NULL, &ctx, 
&new_ctx, NULL, &lmf, &native_offset, &managed);
@@ -312,11 +321,18 @@
        MonoLMF *lmf = jit_tls->lmf;
        MonoJitInfo *ji, rji;
        MonoContext ctx, new_ctx;
+       unsigned int stackptr;
 
        mono_arch_flush_register_windows ();
 
+#ifdef _MSC_VER
+       __asm mov stackptr, ebp;
+#else
+       stackptr = (unsigned int) __builtin_frame_address (0);
+#endif
+
        MONO_CONTEXT_SET_IP (&ctx, ves_icall_get_frame_info);
-       MONO_CONTEXT_SET_BP (&ctx, __builtin_frame_address (0));
+       MONO_CONTEXT_SET_BP (&ctx, stackptr);
 
        skip++;
 
@@ -406,7 +422,16 @@
        MonoFrameSecurityInfo si;
        MonoContext ctx;
 
+#ifdef _MSC_VER
+       /* seems that MSC doesn't like having __asm in macros */
+       unsigned int stackptr;
+       mono_arch_flush_register_windows ();
+       __asm mov stackptr, ebp;
+       MONO_CONTEXT_SET_IP (&ctx, 
ves_icall_System_Security_SecurityFrame_GetSecurityFrame);
+       MONO_CONTEXT_SET_BP (&ctx, stackptr);
+#else
        MONO_INIT_CONTEXT_FROM_FUNC (&ctx, 
ves_icall_System_Security_SecurityFrame_GetSecurityFrame);
+#endif
 
        si.skips = skip;
        si.frame = NULL;
@@ -483,7 +508,16 @@
        MonoContext ctx;
        MonoArray *stack;
 
+#ifdef _MSC_VER
+       /* seems that MSC doesn't like having __asm in macros */
+       unsigned int stackptr;
+       mono_arch_flush_register_windows ();
+       __asm mov stackptr, ebp;
+       MONO_CONTEXT_SET_IP (&ctx, 
ves_icall_System_Security_SecurityFrame_GetSecurityStack);
+       MONO_CONTEXT_SET_BP (&ctx, stackptr);
+#else
        MONO_INIT_CONTEXT_FROM_FUNC (&ctx, 
ves_icall_System_Security_SecurityFrame_GetSecurityStack);
+#endif
 
        ss.skips = skip;
        ss.stack = NULL;

Modified: trunk/mono/mono/mini/mini-x86.c
===================================================================
--- trunk/mono/mono/mini/mini-x86.c     2005-03-29 18:16:10 UTC (rev 42349)
+++ trunk/mono/mono/mini/mini-x86.c     2005-03-29 18:25:37 UTC (rev 42350)
@@ -91,7 +91,7 @@
 
 #define FLOAT_PARAM_REGS 0
 
-static X86_Reg_No param_regs [] = { };
+static X86_Reg_No param_regs [] = { 0 };
 
 #ifdef PLATFORM_WIN32
 static X86_Reg_No return_regs [] = { X86_EAX, X86_EDX };
@@ -469,6 +469,7 @@
 cpuid (int id, int* p_eax, int* p_ebx, int* p_ecx, int* p_edx)
 {
        int have_cpuid = 0;
+#ifndef _MSC_VER
        __asm__  __volatile__ (
                "pushfl\n"
                "popl %%eax\n"
@@ -485,7 +486,21 @@
                :
                : "%eax", "%edx"
        );
-
+#else
+       __asm {
+               pushfd
+               pop eax
+               mov edx, eax
+               xor eax, 0x200000
+               push eax
+               popfd
+               pushfd
+               pop eax
+               xor eax, edx
+               and eax, 0x200000
+               mov have_cpuid, eax
+       }
+#endif
        if (have_cpuid) {
                /* Have to use the code manager to get around WinXP DEP */
                MonoCodeManager *codeman = mono_code_manager_new_dynamic ();
@@ -516,14 +531,18 @@
 void
 mono_arch_cpu_init (void)
 {
+       /* spec compliance requires running with double precision */
+#ifndef _MSC_VER
        guint16 fpcw;
 
-       /* spec compliance requires running with double precision */
        __asm__  __volatile__ ("fnstcw %0\n": "=m" (fpcw));
        fpcw &= ~X86_FPCW_PRECC_MASK;
        fpcw |= X86_FPCW_PREC_DOUBLE;
        __asm__  __volatile__ ("fldcw %0\n": : "m" (fpcw));
        __asm__  __volatile__ ("fnstcw %0\n": "=m" (fpcw));
+#else
+       _control87 (_PC_64, MCW_PC);
+#endif
 }
 
 /*

Modified: trunk/mono/mono/mini/mini-x86.h
===================================================================
--- trunk/mono/mono/mini/mini-x86.h     2005-03-29 18:16:10 UTC (rev 42349)
+++ trunk/mono/mono/mini/mini-x86.h     2005-03-29 18:25:37 UTC (rev 42350)
@@ -107,8 +107,7 @@
        guint32     eip;
 };
 
-typedef struct MonoCompileArch {
-} MonoCompileArch;
+typedef void* MonoCompileArch;
 
 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
 # define SC_EAX sc_eax

Modified: trunk/mono/mono/mini/mini.h
===================================================================
--- trunk/mono/mono/mini/mini.h 2005-03-29 18:16:10 UTC (rev 42349)
+++ trunk/mono/mono/mini/mini.h 2005-03-29 18:25:37 UTC (rev 42350)
@@ -15,6 +15,7 @@
 #include "mono/metadata/class-internals.h"
 #include "mono/metadata/object-internals.h"
 #include <mono/metadata/profiler-private.h>
+#include <mono/utils/mono-compiler.h>
 
 #include "mini-arch.h"
 #include "regalloc.h"

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to