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
Jit64: Properly handle backpatching overflowed address calculations #11445
Jit64: Properly handle backpatching overflowed address calculations #11445
Conversation
|
This looks pretty correct to me. The only thing I'm wondering is whether there's a chance that the current Oh, and you probably have to rebase this because |
e44d6dc
to
007650a
Compare
|
Rebased. Yes, the JIT seems to be making some assumptions about MSR.DR. For instance, take a look at this piece of code: dolphin/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.cpp Lines 434 to 439 in 2a2ee5d
If MSR.DR is 1 at compile time, the address is known at compile time, and the address is valid at compile time, the memory access is implemented using But if you use |
|
Actually nevermind, on Jit64 specifically the backpatched code doesn't work correctly with a changed MSR.DR due to this part: dolphin/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.cpp Lines 369 to 381 in 2a2ee5d
But either way, the problems with MSR.DR handling are in existing JIT code and not in the backpatching handler. |
Previously we would only backpatch overflowed address calculations if the overflow was 0x1000 or less. Now we can handle the full 2 GiB of overflow in both directions. I'm also making equivalent changes to JitArm64's code. This isn't because it needs it – JitArm64 address calculations should never overflow – but because I wanted to get rid of the 0x100001000 inherited from Jit64 that makes even less sense for JitArm64 than for Jit64.
007650a
to
611e721
Compare
|
Also, just to make it explicit since it's important context for what I wrote above: JitAsm.cpp ensures that RMEM/MEM_REG is updated to match MSR.DR before entering a JIT block. |
|
Just for reference, I figured out how MSR.DR is handled now. JitCache.cpp ensures that if MSR.DR or MSR.IR has been changed since the block was compiled, the existing block won't run. So there is no problem. |
Previously we would only backpatch overflowed address calculations if the overflow was 0x1000 or less. Now we can handle the full 2 GiB of overflow in both directions.
I'm also making equivalent changes to JitArm64's code. This isn't because it needs it – JitArm64 address calculations should never overflow – but because I wanted to get rid of the 0x100001000 inherited from Jit64 that makes even less sense for JitArm64 than for Jit64.