summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2020-11-29 13:55:52 +0100
committerJosJuice <josjuice@gmail.com>2020-11-29 14:01:14 +0100
commit2863b3ff5b54388a94d26520d2ed19afd1a9c898 (patch)
treead5063e502cf3f591683de0ebcce282c6e4517e7 /Source/Core/InputCommon/ControllerInterface
parent361bf25cf88026c384dc43ac8ee0cdd04b6e359c (diff)
JitArm64: Do downcount immediately before jumping to dispatcher
Fixes https://bugs.dolphin-emu.org/issues/12327. When we started using fmt in CheckExternalExceptions, JitArm64 mysteriously stopped working even though the code path where fmt was used never was reached. This is because the compiler added a function prologue and epilogue to set up the stack, since the code path that used fmt required the use of the stack. However, the breakage didn't actually have anything to do with the usage of the stack in itself, but rather with the compiler's insertion of a stack canary. In the function epilogue, a cmp instruction was inserted to check that the stack canary had not been overwritten during the execution of the function. This cmp instruction overwriting the status flags ended up having a disastrous side effect once execution returned to code emitted by JitArm64::WriteExceptionExit. JitArm64's dispatcher contains a branch to the "do_timing" code which is intended to be taken if the PPC downcount is negative. However, the dispatcher doesn't update the status flags on its own before this conditional branch, but rather expects the calling code to have set them as a side effect of DoDownCount. The root cause of our bug was that JitArm64::WriteExceptionExit was calling DoDownCount before Check(External)Exceptions instead of after.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
0 files changed, 0 insertions, 0 deletions