Commit 28baeeb9 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

mmap has improved

parent 6764fda5
...@@ -38,8 +38,9 @@ if (writeMode): ...@@ -38,8 +38,9 @@ if (writeMode):
with open("/dev/mem", "r+b") as f: with open("/dev/mem", "r+b") as f:
page_addr=addr & (~(PAGE_SIZE-1)) page_addr=addr & (~(PAGE_SIZE-1))
page_offs=addr-page_addr page_offs=addr-page_addr
if (page_addr>=0x80000000): #in python 2.7.11 works w/o negation
page_addr-= (1<<32) #if (page_addr>=0x80000000):
# page_addr-= (1<<32)
mm = mmap.mmap(f.fileno(), PAGE_SIZE, offset=page_addr) mm = mmap.mmap(f.fileno(), PAGE_SIZE, offset=page_addr)
if writeMode: if writeMode:
packedData=struct.pack(endian+"L",data) packedData=struct.pack(endian+"L",data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment