2009-04-22 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Wed, 22 Apr 2009 23:33:57 +0000 (23:33 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Wed, 22 Apr 2009 23:33:57 +0000 (23:33 -0000)
* aot-runtime.c (make_writable): Use mono_mprotect to simplify
some porting work.

svn path=/trunk/mono/; revision=132425

mono/mini/ChangeLog
mono/mini/aot-runtime.c

index 92ca7b4c883039fcda1434e34afe1d7983e7ed1a..1b5e0c543d38bc1559a2593bb4607e8b19b5a025 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-22  Miguel de Icaza  <miguel@novell.com>
+
+       * aot-runtime.c (make_writable): Use mono_mprotect to simplify
+       some porting work.
+
 2009-04-22  Zoltan Varga  <vargaz@gmail.com>
 
        * method-to-ir.c (mono_method_to_ir): Force init_locals to be TRUE
index 451f4d0c98b9f7ec12394131d35dcbbacbf7734e..4aa6097f17c75a4e15f4bf6d98ee57ae8bd61966 100644 (file)
@@ -52,6 +52,7 @@
 #include <mono/metadata/monitor.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/utils/mono-logger.h>
+#include <mono/utils/mono-mmap.h>
 #include "mono/utils/mono-compiler.h"
 
 #include "mini.h"
@@ -707,7 +708,6 @@ G_GNUC_UNUSED
 static void
 make_writable (guint8* addr, guint32 len)
 {
-#ifndef PLATFORM_WIN32
        guint8 *page_start;
        int pages, err;
 
@@ -716,14 +716,9 @@ make_writable (guint8* addr, guint32 len)
 
        page_start = (guint8 *) (((gssize) (addr)) & ~ (PAGESIZE - 1));
        pages = (addr + len - page_start + PAGESIZE - 1) / PAGESIZE;
-       err = mprotect (page_start, pages * PAGESIZE, PROT_READ | PROT_WRITE | PROT_EXEC);
+
+       err = mono_mprotect (page_start, pages * PAGESIZE, MONO_MMAP_READ | MONO_MMAP_WRITE | MONO_MMAP_EXEC);
        g_assert (err == 0);
-#else
-       {
-               DWORD oldp;
-               g_assert (VirtualProtect (addr, len, PAGE_EXECUTE_READWRITE, &oldp) != 0);
-       }
-#endif
 }
 
 static void