summaryrefslogtreecommitdiff
path: root/src/common/x64/emitter.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2016-03-19 15:16:16 -0400
committerGravatar bunnei2016-04-13 23:04:42 -0400
commite5d417213ce67bc23ac644132828d125a59c2455 (patch)
tree93c0cc9d8917cc43db9b45e6bdb52e162d1313b5 /src/common/x64/emitter.cpp
parentMerge pull request #1660 from MerryMage/file_util (diff)
downloadyuzu-e5d417213ce67bc23ac644132828d125a59c2455.tar.gz
yuzu-e5d417213ce67bc23ac644132828d125a59c2455.tar.xz
yuzu-e5d417213ce67bc23ac644132828d125a59c2455.zip
emitter: Support arbitrary FixupBranch targets.
Diffstat (limited to 'src/common/x64/emitter.cpp')
-rw-r--r--src/common/x64/emitter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/x64/emitter.cpp b/src/common/x64/emitter.cpp
index 1dcf2416c..6c8d10ea7 100644
--- a/src/common/x64/emitter.cpp
+++ b/src/common/x64/emitter.cpp
@@ -531,6 +531,22 @@ void XEmitter::SetJumpTarget(const FixupBranch& branch)
531 } 531 }
532} 532}
533 533
534void XEmitter::SetJumpTarget(const FixupBranch& branch, const u8* target)
535{
536 if (branch.type == 0)
537 {
538 s64 distance = (s64)(target - branch.ptr);
539 ASSERT_MSG(distance >= -0x80 && distance < 0x80, "Jump target too far away, needs force5Bytes = true");
540 branch.ptr[-1] = (u8)(s8)distance;
541 }
542 else if (branch.type == 1)
543 {
544 s64 distance = (s64)(target - branch.ptr);
545 ASSERT_MSG(distance >= -0x80000000LL && distance < 0x80000000LL, "Jump target too far away, needs indirect register");
546 ((s32*)branch.ptr)[-1] = (s32)distance;
547 }
548}
549
534//Single byte opcodes 550//Single byte opcodes
535//There is no PUSHAD/POPAD in 64-bit mode. 551//There is no PUSHAD/POPAD in 64-bit mode.
536void XEmitter::INT3() {Write8(0xCC);} 552void XEmitter::INT3() {Write8(0xCC);}