From: Jacob Lifshay Date: Wed, 6 Dec 2023 09:08:25 +0000 (-0800) Subject: MemMMap: raise error for bad load/fetch addresses when emulating mmap X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1625d8139e69d8ef61a1fc4c2379010294f31660;p=openpower-isa.git MemMMap: raise error for bad load/fetch addresses when emulating mmap --- diff --git a/src/openpower/decoder/isa/mem.py b/src/openpower/decoder/isa/mem.py index 4947e9b1..2b8c5279 100644 --- a/src/openpower/decoder/isa/mem.py +++ b/src/openpower/decoder/isa/mem.py @@ -991,6 +991,12 @@ class MemMMap(MemCommon): def __access_addr_range_err(self, start_addr, size, needed_flag): assert needed_flag != MMapPageFlags.W, \ "can't write to address 0x%X size 0x%X" % (start_addr, size) + if self.emulating_mmap: + exc = MemException("access not allowed", + "memory access not allowed: addr=0x%X: %s" + % (start_addr, needed_flag)) + exc.dar = start_addr + raise exc return None, 0 def __access_addr_range(self, start_addr, size, needed_flag):