From: Jacob Lifshay Date: Mon, 25 Sep 2023 22:29:25 +0000 (-0700) Subject: skip zero words when iterating words in MemMMap X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b78028b19cf039014f55285ee2ff801a4222bb94;p=openpower-isa.git skip zero words when iterating words in MemMMap --- diff --git a/src/openpower/decoder/isa/mem.py b/src/openpower/decoder/isa/mem.py index fccd9c1b..a32f47fb 100644 --- a/src/openpower/decoder/isa/mem.py +++ b/src/openpower/decoder/isa/mem.py @@ -403,8 +403,16 @@ class MemMMap(MemCommon): block[block_addr:block_addr + self.bytes_per_word] = bytes_ def word_idxs(self): + zeros = bytes(self.bytes_per_word) for page_idx in self.modified_pages: start = self.mmap_page_idx_to_addr(page_idx) + block, block_addr = self.__access_addr_range( + start, _MMAP_PAGE_SIZE, _MMapPageFlags.R) end = start + _MMAP_PAGE_SIZE - yield from range(start // self.bytes_per_word, - end // self.bytes_per_word) + for word_idx in range(start // self.bytes_per_word, + end // self.bytes_per_word): + next_block_addr = block_addr + self.bytes_per_word + bytes_ = block[block_addr:next_block_addr] + block_addr = next_block_addr + if bytes_ != zeros: + yield word_idx