extracting memory for dump must be big-endian ordered
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 25 May 2021 13:32:53 +0000 (14:32 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 25 May 2021 13:32:53 +0000 (14:32 +0100)
src/openpower/decoder/isa/pypowersim.py

index 9377021cc97c0ab47c5ed70588fbd746583fce58..606d5c89c5cb5ea1644156bdfdca82a3f52f5754 100644 (file)
@@ -14,7 +14,8 @@ from openpower.util import log
 
 def read_data(fname, offset=0):
     """reads binary data and returns a dictionary of address: contents,
-    each entry is 8 bytes. input file *must* be 8-byte-aligned
+    each entry is 8 bytes: input file *must* contain a multiple of 8 bytes.
+    data to be considered *binary* (raw)
     """
     res = {}
     with open(fname, "rb") as f:
@@ -33,7 +34,7 @@ def write_data(mem, fname, offset, sz):
         for i in range(0, sz, 8):
             addr = offset + i
             val = mem.ld(addr, 8)
-            f.write(struct.pack('<Q', val)) # unsigned long
+            f.write(struct.pack('>Q', val)) # unsigned long
 
 
 def convert_to_num(num):