Author: Matti Picus <[email protected]>
Branch: safe-win-mmap
Changeset: r66967:5daf95147eb8
Date: 2013-09-16 04:00 +0300
http://bitbucket.org/pypy/pypy/changeset/5daf95147eb8/

Log:    revert to fix translation

diff --git a/rpython/rlib/rmmap.py b/rpython/rlib/rmmap.py
--- a/rpython/rlib/rmmap.py
+++ b/rpython/rlib/rmmap.py
@@ -207,9 +207,15 @@
     VirtualAlloc, VirtualAlloc_safe = winexternal('VirtualAlloc',
                                [rffi.VOIDP, rffi.SIZE_T, DWORD, DWORD],
                                rffi.VOIDP)
-    _, VirtualProtect_safe = winexternal('VirtualProtect',
+    _, _VirtualProtect_safe = winexternal('VirtualProtect',
                                   [rffi.VOIDP, rffi.SIZE_T, DWORD, LPDWORD],
                                   BOOL)
+    def VirtualProtect(addr, size, mode, oldmode_ptr):
+        return _VirtualProtect_safe(addr,
+                               rffi.cast(rffi.SIZE_T, size),
+                               rffi.cast(DWORD, mode),
+                               oldmode_ptr)
+    VirtualProtect._annspecialcase_ = 'specialize:ll'
     VirtualFree, VirtualFree_safe = winexternal('VirtualFree',
                               [rffi.VOIDP, rffi.SIZE_T, DWORD], BOOL)
 
@@ -849,7 +855,7 @@
         if not res:
             raise MemoryError
         arg = lltype.malloc(LPDWORD.TO, 1, zero=True, flavor='raw')
-        VirtualProtect_safe(res, map_size, PAGE_EXECUTE_READWRITE, arg)
+        VirtualProtect(res, map_size, PAGE_EXECUTE_READWRITE, arg)
         lltype.free(arg, flavor='raw')
         # ignore errors, just try
         return res
diff --git a/rpython/rtyper/lltypesystem/llarena.py 
b/rpython/rtyper/lltypesystem/llarena.py
--- a/rpython/rtyper/lltypesystem/llarena.py
+++ b/rpython/rtyper/lltypesystem/llarena.py
@@ -529,14 +529,14 @@
 
 elif os.name == 'nt':
     def llimpl_protect(addr, size, inaccessible):
-        from rpython.rlib.rmmap import VirtualProtect_safe, LPDWORD
+        from rpython.rlib.rmmap import VirtualProtect, LPDWORD
         if inaccessible:
             from rpython.rlib.rmmap import PAGE_NOACCESS as newprotect
         else:
             from rpython.rlib.rmmap import PAGE_READWRITE as newprotect
         arg = lltype.malloc(LPDWORD.TO, 1, zero=True, flavor='raw')
         #does not release the GIL
-        VirtualProtect_safe(rffi.cast(rffi.VOIDP, addr),
+        VirtualProtect(rffi.cast(rffi.VOIDP, addr),
                        size, newprotect, arg)
         # ignore potential errors
         lltype.free(arg, flavor='raw')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to