From e41144d8758b77452a97f073612456d40c50a1a0 Mon Sep 17 00:00:00 2001 From: calc84maniac Date: Wed, 29 May 2024 17:11:49 -0400 Subject: [PATCH] Fix flash cache misses by setting the new cache line as most-recently-used --- core/flash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/flash.c b/core/flash.c index 55682a24e..f7692df95 100644 --- a/core/flash.c +++ b/core/flash.c @@ -75,7 +75,8 @@ uint32_t flash_touch_cache(uint32_t addr) { return 3; } else { /* Handle a cache miss by replacing least-recently-used */ - set->lru = tag; + set->lru = set->mru; + set->mru = tag; cpu.flashCacheMisses++; /* Supposedly this takes from 195-201 cycles, but typically seems to be 196-197 */ cpu.flashDelayCycles += 195;