Author: Edd Barrett <vex...@gmail.com>
Branch: w-xor-x
Changeset: r86198:228237a37ee6
Date: 2016-08-15 14:52 +0100
http://bitbucket.org/pypy/pypy/changeset/228237a37ee6/

Log:    Make cpu_info() W^X compliant.

diff --git a/rpython/jit/backend/x86/detect_feature.py 
b/rpython/jit/backend/x86/detect_feature.py
--- a/rpython/jit/backend/x86/detect_feature.py
+++ b/rpython/jit/backend/x86/detect_feature.py
@@ -1,17 +1,20 @@
 import sys
 import struct
 from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.rlib.rmmap import alloc, free
+from rpython.rlib.rmmap import alloc, free, set_pages_executable
+
+CPU_INFO_SZ = 4096
 
 def cpu_info(instr):
-    data = alloc(4096)
+    data = alloc(CPU_INFO_SZ)
     pos = 0
     for c in instr:
         data[pos] = c
         pos += 1
+    set_pages_executable(data, CPU_INFO_SZ)
     fnptr = rffi.cast(lltype.Ptr(lltype.FuncType([], lltype.Signed)), data)
     code = fnptr()
-    free(data, 4096)
+    free(data, CPU_INFO_SZ)
     return code
 
 def detect_sse2():
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to