From 34992f52c796ae9f62e0abfc9f088138e87bd72a Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Tue, 7 Sep 2021 23:08:47 +0200 Subject: [PATCH] PowerPC/JitCache: Clear valid_block bits for long invalidations. --- Source/Core/Core/PowerPC/JitCommon/JitCache.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp index 1e0e512bd4..febc4373fd 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp @@ -234,6 +234,16 @@ void JitBaseBlockCache::InvalidateICacheInternal(u32 physical_address, u32 addre else valid_block.Clear(physical_address / 32); } + else if (length > 32) + { + // Even if we can't check the set for optimization, we still want to remove all fully covered + // cache lines from the valid_block set so that later calls don't try to invalidate already + // cleared regions. + const u32 covered_block_start = (physical_address + 0x1f) / 32; + const u32 covered_block_end = (physical_address + length) / 32; + for (u32 i = covered_block_start; i < covered_block_end; ++i) + valid_block.Clear(i); + } if (destroy_block) {