Pass object code filename instead of actual data
authorKonstantinos Margaritis <konstantinos.margaritis@vectorcamp.gr>
Mon, 20 Mar 2023 09:40:46 +0000 (09:40 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:16 +0000 (19:51 +0100)
This enables compilation on non-Power architectures.

src/openpower/decoder/isa/pypowersim.py

index 4cb32a6b57475fc4bdb1e6f7bd1240a038dd6dcf..fed3091f83ea7c19cbace36f65c02f7751be68d7 100644 (file)
@@ -281,13 +281,13 @@ def help():
     exit(-1)
 
 
-def run_a_simulation(binary, bigendian, prog, 
+def run_a_simulation(binaryname, bigendian, prog,
                      qemu_cosim, initial_regs,
                      initial_sprs, svstate, mmu,
                      initial_cr, initial_mem,
                      initial_fprs, initial_pc):
 
-    log ("binary", binary)
+    log ("binaryname", binaryname)
     log ("bigendian", bigendian)
     log ("prog", prog)
     log ("qemu_cosim", qemu_cosim)
@@ -300,6 +300,9 @@ def run_a_simulation(binary, bigendian, prog,
     log ("initial_fprs", initial_fprs)
     log ("initial_pc", initial_pc)
 
+    with open(binaryname, "rb") as f:
+        binary = f.read()
+
     with Program(binary, bigendian=bigendian, orig_filename=None) as prog:
         simulator, qemu = run_tst(None, prog, qemu_cosim,
                             initial_regs,