From 06578592de791992c1bcad37eacbac759aac5500 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 25 Sep 2023 15:29:25 -0700 Subject: [PATCH] skip zero words when iterating words in MemMMap --- src/openpower/decoder/isa/mem.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 -- 2.30.2