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

JitArm64: Don't hardcode exception constants #9866

Merged

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Jul 5, 2021

Split out from PR #9865, since I don't think that PR is going to be merged any time soon.

Unlike most constants we emit in JitArm64, these constants are not inherent to the CPU we're emulating, and can have whatever values we want, so let's handle them in a more robust way. I was rather confused when I found out that a previous iteration of PR #9865 broke JitArm64, because I hadn't thought that making some simple changes to the values of an enum would do it!

Unlike most constants we emit in JitArm64, these constants are
*not* inherent to the CPU we're emulating, and can have whatever
values we want. Let's handle them more robustly, in case we
decide to change their values in the future.
@dolphin-emu-bot
Copy link
Contributor

FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:

automated-fifoci-reporter

@@ -218,7 +218,7 @@ void JitArm64::twx(UGeckoInstruction inst)
fpr.Flush(FlushMode::MaintainState);

LDR(IndexType::Unsigned, WA, PPC_REG, PPCSTATE_OFF(Exceptions));
ORR(WA, WA, 24, 0); // Same as WA | EXCEPTION_PROGRAM
ORRI2R(WA, WA, EXCEPTION_PROGRAM);
Copy link
Member

Choose a reason for hiding this comment

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

Worth noting that there was a bug in the previous code, which actually OR'd with EXCEPTION_PERFORMANCE_MONITOR (0x100), not EXCEPTION_PROGRAM (0x80).

@leoetlino leoetlino merged commit 21d7509 into dolphin-emu:master Jul 6, 2021
@JosJuice JosJuice deleted the jitarm64-hardcoded-exceptions branch July 6, 2021 13:30
@@ -774,7 +774,7 @@ void JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
ARM64Reg WA = gpr.GetReg();
ARM64Reg XA = EncodeRegTo64(WA);
LDR(IndexType::Unsigned, WA, PPC_REG, PPCSTATE_OFF(Exceptions));
FixupBranch NoExtException = TBZ(WA, 3); // EXCEPTION_EXTERNAL_INT
FixupBranch NoExtException = TBZ(WA, IntLog2(EXCEPTION_EXTERNAL_INT));
Copy link
Member Author

Choose a reason for hiding this comment

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

This change specifically seems to have broken Pokémon XD (and presumably other games as well). Will investigate.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in PR #9872.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants