print out memory exception details, on unaligned
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 29 Dec 2022 21:28:06 +0000 (21:28 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 29 Dec 2022 21:28:06 +0000 (21:28 +0000)
src/openpower/decoder/isa/caller.py
src/openpower/decoder/isa/mem.py

index 885510f4a039b8b861e7c191a32ce2fe553a7b81..0d93f05ec6a0138516442832e6be292b70556d07 100644 (file)
@@ -1565,7 +1565,7 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop):
         except MemException as e:                # check for memory errors
             if e.args[0] == 'unaligned':         # alignment error
                 # run a Trap but set DAR first
-                print("memory unaligned exception, DAR", e.dar)
+                print("memory unaligned exception, DAR", e.dar, repr(e))
                 self.spr['DAR'] = SelectableInt(e.dar, 64)
                 self.call_trap(0x600, PIb.PRIV)    # 0x600, privileged
                 return
index 87453ceb46d025a9bdbd8ccabfc2a7e91e5990d8..483f74e479f5faf2e08a9693bb4bf653e4f8aa59 100644 (file)
@@ -85,7 +85,9 @@ class Mem:
         remainder = address & (self.bytes_per_word - 1)
         address = address >> self.word_log2
         if remainder & (width - 1) != 0:
-            exc = MemException("unaligned", "Unaligned access Error")
+            exc = MemException("unaligned",
+                  "Unaligned access: remainder %x width %d" % \
+                  (remainder, width))
             exc.dar = ldaddr
             raise exc
         if address in self.mem:
@@ -114,7 +116,9 @@ class Mem:
         log("Writing 0x%x to ST 0x%x memaddr 0x%x/%x swap %s" % \
             (v, staddr, addr, remainder, str(swap)))
         if remainder & (width - 1) != 0:
-            exc = MemException("unaligned", "Unaligned access Error")
+            exc = MemException("unaligned",
+                  "Unaligned access: remainder %x width %d" % \
+                  (remainder, width))
             exc.dar = staddr
             raise exc
         if swap: