From b976857cbeed99d4c2b1b497f0766abca45451c4 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 27 May 2021 18:43:43 +0100 Subject: [PATCH] move SPR set to qemu.py --- src/openpower/decoder/isa/pypowersim.py | 2 +- src/openpower/simulator/qemu.py | 26 +++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/openpower/decoder/isa/pypowersim.py b/src/openpower/decoder/isa/pypowersim.py index 159c7c56..92a019ef 100644 --- a/src/openpower/decoder/isa/pypowersim.py +++ b/src/openpower/decoder/isa/pypowersim.py @@ -96,7 +96,7 @@ def qemu_register_compare(sim, q, regs, fprs): sim_lr = sim.spr['LR'].value print("qemu pc", hex(qpc)) print("qemu cr", hex(qcr)) - print("qemu lr", bin(qlr)) + print("qemu lr", hex(qlr)) print("qemu xer", bin(qxer)) print("sim nia", hex(sim.pc.NIA.value)) print("sim pc", hex(sim.pc.CIA.value)) diff --git a/src/openpower/simulator/qemu.py b/src/openpower/simulator/qemu.py index 2f77b9fc..8b8bc22b 100644 --- a/src/openpower/simulator/qemu.py +++ b/src/openpower/simulator/qemu.py @@ -247,14 +247,6 @@ def run_program(program, initial_mem=None, extra_break_addr=None, # delete the previous breakpoint so loops don't screw things up q.delete_breakpoint() - # can't do many of these - lr, ctr, etc. etc. later, just LR for now - if initial_sprs: - lr = initial_sprs.get('lr', None) - if lr is None: - lr = initial_sprs.get('LR', None) - if lr is not None: - q.set_lr(lr) - # allow run to end q.break_address(start_addr + program.size()) # or to trap (not ideal) @@ -262,12 +254,26 @@ def run_program(program, initial_mem=None, extra_break_addr=None, # or to alternative (absolute) address) if extra_break_addr is not None: q.break_address(extra_break_addr) - if continuous_run: - q.gdb_continue() + # set endian before SPR set q.set_endian(bigendian) + + # can't do many of these - lr, ctr, etc. etc. later, just LR for now + if initial_sprs: + lr = initial_sprs.get('lr', None) + if lr is None: + lr = initial_sprs.get('LR', None) + if lr is not None: + q.set_lr(lr) + + # disassemble and dump d = q.disasm(start_addr, start_addr + program.size()) for line in d: print ("qemu disasm", line) + + # start running + if continuous_run: + q.gdb_continue() + return q -- 2.30.2