Mesa (master): mapi: Avoid Data Execution Prevention on windows.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri May 7 05:57:33 UTC 2010


Module: Mesa
Branch: master
Commit: 5569faf05abd550b81649f3961c743448e708825
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5569faf05abd550b81649f3961c743448e708825

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri May  7 06:57:11 2010 +0100

mapi: Avoid Data Execution Prevention on windows.

---

 src/mapi/glapi/glapitemp.h |    2 +-
 src/mapi/mapi/u_execmem.c  |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/mapi/glapi/glapitemp.h b/src/mapi/glapi/glapitemp.h
index 3ed337f..92835b9 100644
--- a/src/mapi/glapi/glapitemp.h
+++ b/src/mapi/glapi/glapitemp.h
@@ -27,7 +27,7 @@
  */
 
 
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__)
+#  if (defined(__GNUC__) && !defined(__MINGW32__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__)
 #    define HIDDEN  __attribute__((visibility("hidden")))
 #  else
 #    define HIDDEN
diff --git a/src/mapi/mapi/u_execmem.c b/src/mapi/mapi/u_execmem.c
index 0e0f8aa..fae2c75 100644
--- a/src/mapi/mapi/u_execmem.c
+++ b/src/mapi/mapi/u_execmem.c
@@ -110,6 +110,22 @@ bail:
 }
 
 
+#elif defined(_WIN32)
+
+#include <windows.h>
+
+
+/*
+ * Avoid Data Execution Prevention.
+ */
+
+void *
+u_execmem_alloc(unsigned int size)
+{
+   return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+}
+
+
 #else
 
 void *




More information about the mesa-commit mailing list