-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Dynamic bat #4146
Dynamic bat #4146
Conversation
@magumagu Are you fine with my additional patches? |
On top of all of the fixes mentions in the other pull request, We Love Golf! and Summer Athletics 2009 are now booting. They were dcbz sensitive games, so, make up your own conclusion on what fixed them. |
// Slow path: mask the address, then call the general-case code. | ||
SwitchToFarCode(); | ||
SetJumpTarget(slow); | ||
AND(32, R(RSCRATCH2), Imm32(~31)); | ||
MOV(32, M(&PC), Imm32(jit->js.compilerPC)); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Tested a bunch of games using Dynamic BATs as my main Dolphin build today and everything seems to be fine. |
Review status: 0 of 19 files reviewed at latest revision, 8 unresolved discussions. Source/Core/Core/HW/Memmap.cpp, line 229 [r2] (raw file):
This parameter can be a const pointer. Source/Core/Core/HW/Memmap.cpp, line 236 [r2] (raw file):
These can just be Source/Core/Core/HW/Memmap.cpp, line 244 [r2] (raw file):
This can be a const reference as far as I can tell. Source/Core/Core/PowerPC/MMU.cpp, line 103 [r2] (raw file):
This can be a const member function. Source/Core/Core/PowerPC/MMU.cpp, line 158 [r2] (raw file):
std::array Source/Core/Core/PowerPC/MMU.cpp, line 159 [r2] (raw file):
same here. Source/Core/Core/PowerPC/MMU.cpp, line 395 [r2] (raw file):
This should likely explain why it should be refactored, to provide context for anyone willing to do it. Source/Core/Core/PowerPC/MMU.cpp, line 1186 [r2] (raw file):
Comments from Reviewable |
Review status: 0 of 19 files reviewed at latest revision, 8 unresolved discussions. Source/Core/Core/HW/Memmap.cpp, line 229 [r2] (raw file):
|
Because Twilight Princess doesn't suffer any kind of performance penalty from MMU being enabled (at least on my PC,) I've marked the dropped sign bug crash as fixed here. |
This PR has the same .elf loading issue as PR #1882 I just downloaded a build of this PR from https://dl.dolphin-emu.org/prs/pr-4146-dolphin-latest-x64.7z When attempting to load Gecko OS's .elf Dolphin will crash (attached below). This problem does not occur for me on other builds of Dolphin (tested up to 5.0-443). Win 10 Pro x64 |
Reviewed 6 of 20 files at r1, 3 of 6 files at r3. Source/Core/Core/HW/Memmap.cpp, line 103 [r3] (raw file):
MV Prefix (Memory View) is now incorrect as they are now used as flags for Physical Memory Regions. Make this a named enum instead? Move it inside the PhysicalMemoryRegion struct? Comments from Reviewable |
Reviewed 7 of 20 files at r1, 3 of 6 files at r3. Source/Core/Core/HW/Memmap.cpp, line 233 [r3] (raw file):
Should be be destroying and recreating the all the mappings for every single BAT change? Would it make sense to scan for entries which have changed? mmaping isn't the cheapest of operations. Source/Core/Core/PowerPC/PowerPC.h, line 288 [r3] (raw file):
Could I request a "// 128KB" comment, so I don't have to pull out my calculator next time. Assuming I even did the math correctly Comments from Reviewable |
Review status: 17 of 19 files reviewed at latest revision, 11 unresolved discussions. Source/Core/Core/HW/Memmap.cpp, line 103 [r3] (raw file):
|
The last commit should fix ELF booting, but I haven't verified if our default mapping matches well. Review status: 17 of 20 files reviewed at latest revision, 3 unresolved discussions. Comments from Reviewable |
Elf booting is not fully fixed. The DOL version of Gecko OS works, but the HBC version does not, unless I've already booted the dol version then it does for some reason. |
Review status: 17 of 20 files reviewed at latest revision, 5 unresolved discussions. Source/Core/Core/PowerPC/MMU.cpp, line 756 [r5] (raw file):
Note that this'll look pretty unusual to anyone new to the code (or anyone who has a grasp for on it, I guess), considering we have a Source/Core/Core/PowerPC/MMU.cpp, line 778 [r5] (raw file):
Same here Comments from Reviewable |
@Ebola16 Can you try Gecko OS? I'm having inconsistencies getting it to work. |
SORRY! I compiled it myself and it works fine now. Whatever. LGTM |
.elf files now load again! |
Reviewed 2 of 2 files at r4, 1 of 1 files at r5. Source/Core/Core/HW/Memmap.cpp, line 233 [r3] (raw file):
|
Actually, now that I think about it... Are |
As you can probably guess from my lack of activity, I'm not going to be able to work on this in the near future. The additional changes look fine.
Yes.
DBatUpdated() calls JitInterface::ClearSafe(). Maybe worth a comment in the code, since this point has come up more than once. |
Review status: all files reviewed at latest revision, 3 unresolved discussions. Source/Core/Core/PowerPC/MMU.cpp, line 756 [r5] (raw file):
|
Review status: 15 of 20 files reviewed at latest revision, 4 unresolved discussions. Source/Core/Core/PowerPC/MMU.cpp, line 1168 [r7] (raw file):
By the way, I dislike this 0x2 bit generation here a lot. I'd like to move it to IsOptimizableRAMAddress with physical_regions in mind. Do you think this shall be done now, or in a cleanup PR? Comments from Reviewable |
Reviewed 3 of 3 files at r6, 2 of 2 files at r7. Source/Core/Core/PowerPC/MMU.cpp, line 756 [r5] (raw file):
|
Review status: all files reviewed at latest revision, 2 unresolved discussions. Source/Core/Core/PowerPC/MMU.cpp, line 1168 [r7] (raw file):
|
b3c3781
to
a4d72ac
Compare
Fundamentally, all this does is enforce the invariant that we always translate effective addresses based on the current BAT registers and page table before we do anything else with them. This change can be logically divided into three parts. The first part is creating a table to represent the current BAT state, and keeping it up to date (PowerPC::IBATUpdated, PowerPC::DBATUpdated, etc.). This does nothing by itself, but it's necessary for the other parts. The second part (mostly in MMU.cpp) is simply removing all the hardcoded checks for specific untranslated addresses, and consistently translating addresses using the current BAT configuration. Very straightforward, but a lot of code changes because we hardcoded assumptions all over the place. The third part (mostly in Memmap.cpp) is making the fastmem arena reflect the current BAT configuration. We do this by redoing the mapping (calling memmap()) based on the BAT table whenever it changes. One additional minor change is that translation can fail in two ways: either the segment is a direct store segment, or page table lookup failed. The difference doesn't usually matter, but the difference affects cache instructions, like dcbz.
This is a fork of PR #1882, with a few small fixup commits.
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)