From 1d9ff169dee8c27c18e832f11ace7931b5e42754 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 6 Dec 2023 01:08:25 -0800 Subject: [PATCH] MemMMap: raise error for bad load/fetch addresses when emulating mmap --- src/openpower/decoder/isa/mem.py | 6 ++++++ 1 file changed, 6 insertions(+) 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): -- 2.30.2