Revision: 8793
Author:   [email protected]
Date:     Tue Aug  2 09:16:32 2011
Log: Don't use mprotect on Cygwin as virtual memory is managed directly via WinAPI calls.

Patch by Bert Belder.

Review URL: http://codereview.chromium.org/7549009
http://code.google.com/p/v8/source/detail?r=8793

Modified:
 /branches/bleeding_edge/src/platform-cygwin.cc
 /branches/bleeding_edge/src/platform-posix.cc

=======================================
--- /branches/bleeding_edge/src/platform-cygwin.cc      Wed Jul 13 02:09:04 2011
+++ /branches/bleeding_edge/src/platform-cygwin.cc      Tue Aug  2 09:16:32 2011
@@ -164,6 +164,18 @@
   USE(result);
   ASSERT(result == 0);
 }
+
+
+void OS::ProtectCode(void* address, const size_t size) {
+  DWORD old_protect;
+  VirtualProtect(address, size, PAGE_EXECUTE_READ, &old_protect);
+}
+
+
+void OS::Guard(void* address, const size_t size) {
+  DWORD oldprotect;
+  VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect);
+}


 void OS::Sleep(int milliseconds) {
=======================================
--- /branches/bleeding_edge/src/platform-posix.cc       Tue Aug  2 06:34:52 2011
+++ /branches/bleeding_edge/src/platform-posix.cc       Tue Aug  2 09:16:32 2011
@@ -70,6 +70,7 @@
 }


+#ifndef __CYGWIN__
 // Get rid of writable permission on code allocations.
 void OS::ProtectCode(void* address, const size_t size) {
   mprotect(address, size, PROT_READ | PROT_EXEC);
@@ -80,6 +81,7 @@
 void OS::Guard(void* address, const size_t size) {
   mprotect(address, size, PROT_NONE);
 }
+#endif  // __CYGWIN__


// ----------------------------------------------------------------------------

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to