Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve page table information from the data cache #12107

Conversation

MikeIsAStar
Copy link
Contributor

Thanks to @mkwcat for identifying the problematic code.

@Pokechu22
Copy link
Contributor

Does this change affect any games? It seems like an accuracy improvement (based on ppc_750cl.pdf, section 5.4.5 Page Table Search Operation/page 207, list entry 2, which says "PTE reads [...] are considered cacheable", though it doesn't explicitly say that they can be read from the cache, just that they are "placed in the cache", which seems a bit odd). Even if it doesn't fix anything it's probably worth merging as such.

I think it'd be easier to change TranslatePageAddress to:

  template <const XCheckTLBFlag flag>
  TranslateAddressResult TranslatePageAddress(const EffectiveAddress address, bool* wi);

than to add ReadFromHardwareRuntime, as TranslatePageAddress is only called from TranslateAddress which already has flag as a template parameter.

@MikeIsAStar
Copy link
Contributor Author

Does this change affect any games?

Despite not being a game, MKW-SP will crash on launch when the Enable Write-Back Cache (slow) option is enabled without this patch.

@Pokechu22
Copy link
Contributor

I see that it does do something with page table entries without data cache flushes so this does seem like a reasonable change for that purpose. (The website's features list mentions adding security features to protect against exploits against custom files or the networking code, which is probably what this is for, though I haven't looked at in detail. So, as long as real hardware doesn't need the data cache flushes, it should be fine. If real hardware does need data cache flushes then I don't think it would work properly as a security feature...)

Thanks to @mkwcat for identifying the problematic code.
@MikeIsAStar
Copy link
Contributor Author

So, as long as real hardware doesn't need the data cache flushes, it should be fine.

I can confirm that this is the case.

@MikeIsAStar MikeIsAStar force-pushed the retrieve-page-table-information-from-data-cache branch from 7568790 to 0bb5c88 Compare August 15, 2023 17:00
Copy link
Contributor

@Pokechu22 Pokechu22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this, but it looks good to me.

@Pokechu22 Pokechu22 merged commit 10c5da6 into dolphin-emu:master Aug 16, 2023
11 checks passed
@MikeIsAStar MikeIsAStar deleted the retrieve-page-table-information-from-data-cache branch August 16, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants