Is it possible to perform a mmap.read() (or equivalent) in Python without advancing the pointer?
I need to read the same address in a volatile memory over and over, and to optimise performance I don't want to have to seek to the same address each time.
file = os.open("/dev/mem", os.O_RDWR | os.O_SYNC)
memory = mmap.mmap(f, 0x50000000, mmap.MAP_SHARED)
for index in range(1000000):
memory.seek(address)
# Unpack the bytes little-endian (least significant byte in first byte address etc.)
data = struct.unpack("<L", memory.read(4))[0]
I hope someone can help.