pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

EE Cache: Fix cache masking and support caching invalid physical addresses

Open F0bes opened this issue 1 year ago • 1 comments

Description of Changes

You are able to make TLB entries that point to invalid physical addresses. Because the cache is accessed before the physical write (obviously), the cache will still store data for these physical addresses. Once the cache data is evicted, curiously there is no bus error for addresses such as 0x70004000, so the data is silently discarded. Find my Own Way uses this method to create a "virtual scratchpad" of higher speed, temporary memory.

This implements correct behaviour (I have hardware tested an ELF), however, this sadly does not make Find My Own Way work without patching. Find My Own Way is one of those games that tend to deadlock the EE with cache enabled (for some other, unknown reason).

Rationale behind Changes

This is proper cache behaviour.

Suggested Testing Steps

Test games that require EE Cache (I'm sorry, I know it's slow :( ), make sure they still work. Also, if any game causes bus errors please try and test it with this PR and EE Cache enabled. This might be the fix required.

F0bes avatar Jun 24 '24 16:06 F0bes

Going to look into properly locking cache lines.

F0bes avatar Jun 25 '24 15:06 F0bes

@MrCK1 If you're going to accidentally mark the PR as ready, you could've put it back as a draft lol.

I've updated the PR, it's ready on my end. I'm confident I fixed find my own way. It's hard to know though, it's been running for 20 minutes at 1-3 FPS 🫠.

F0bes avatar Jul 01 '24 23:07 F0bes

LGTM, maybe needs testing on linux to make sure the popcount thing doesn't explode :D

Tested on windows with find my own way + dead or alive with patches disabled

refractionpcsx2 avatar Jul 02 '24 09:07 refractionpcsx2

Did somebody say Linux? 👀

kamfretoz avatar Jul 02 '24 09:07 kamfretoz