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

[RFC] MMU: Allow specifying whether to translate an address via the BAT when calling the Host functions. #8682

wants to merge 2 commits into
base: master


Copy link

AdmiralCurtiss commented Mar 21, 2020

So after the code debugger is now in a pretty good state I figured I'd check out the other debugging facilities, starting with the Memory viewer. This made me run across this issue again so I figured I'd bring it up once more -- see also #8310, #6913. This is also relevant for the Cheat Search functionality which is currently a bit broken, see #8311.

In short, we have a bunch of HostRead/Write() functions that allow the emulator to look at and modify the emulated game RAM. These are currently written to always respect the MSR.DR processor flag on whether to translate an address using the BAT or not before using it to access memory. However, there are situations where you'd rather specify whether to translate or not (otherwise it feels random when you pause the game at an arbitrary point in time), and this PR would make that pretty flexible.

An alternative to forcing the translation would be to let the caller say whether they expect the address to be translated or not, and then bounce with an std::nullopt or similar when the actual CPU state mismatches what the caller wants. That might be a bit cleaner, but makes the calling code and potentially the GUI itself more complex -- thinking specifically of the Cheat Search here. It would prevent the case of the caller saying AlwaysTranslate while the CPU state has translation off and the BAT is in an invalid state, which sounds like a rare and hard to debug issue... hmm. Y'know, now that I've written this up, I actually like that better I think, I think I'll put up an alternate PR for that.

Still, in case we end up preferring this method, here's this PR.

…a the BAT when calling the Host functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.