From 4fbee01e1fb0bd39c28af0c6e2357ae6250f8d43 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 11 Jul 2020 17:38:14 +0100 Subject: [PATCH] sort out big/little endian startup on qemu --- src/soc/config/endian.py | 2 +- src/soc/simulator/qemu.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/soc/config/endian.py b/src/soc/config/endian.py index eb6e0c3f..0aaa61c2 100644 --- a/src/soc/config/endian.py +++ b/src/soc/config/endian.py @@ -1,5 +1,5 @@ global bigendian -bigendian = 0 +bigendian = 1 def set_endian_mode(mode): bigendian = mode diff --git a/src/soc/simulator/qemu.py b/src/soc/simulator/qemu.py index 89386ea1..747e4a94 100644 --- a/src/soc/simulator/qemu.py +++ b/src/soc/simulator/qemu.py @@ -115,7 +115,7 @@ def run_program(program, initial_mem=None, extra_break_addr=None, bigendian=False): q = QemuController(program.binfile.name, bigendian) q.connect() - q.set_endian(True) # how qemu gets/sets data, NOT sets arch + q.set_endian(True) # easier to set variables this way # Run to the start of the program if initial_mem: @@ -131,6 +131,7 @@ def run_program(program, initial_mem=None, extra_break_addr=None, print ("msr", bigendian, hex(msr)) if bigendian: msr &= ~(1<<0) + msr = msr & ((1<<64)-1) else: msr |= (1<<0) q.gdb_eval('$msr=%d' % msr) @@ -147,7 +148,7 @@ def run_program(program, initial_mem=None, extra_break_addr=None, if extra_break_addr: q.break_address(extra_break_addr) q.gdb_continue() - q.set_endian(False) # how qemu gets/sets data, NOT sets arch + q.set_endian(bigendian) return q -- 2.30.2