diff options
author | bunnei <bunneidev@gmail.com> | 2016-03-19 20:16:16 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2016-04-14 05:04:42 +0200 |
commit | e5d417213ce67bc23ac644132828d125a59c2455 (patch) | |
tree | 93c0cc9d8917cc43db9b45e6bdb52e162d1313b5 /src | |
parent | Merge pull request #1660 from MerryMage/file_util (diff) | |
download | yuzu-e5d417213ce67bc23ac644132828d125a59c2455.tar yuzu-e5d417213ce67bc23ac644132828d125a59c2455.tar.gz yuzu-e5d417213ce67bc23ac644132828d125a59c2455.tar.bz2 yuzu-e5d417213ce67bc23ac644132828d125a59c2455.tar.lz yuzu-e5d417213ce67bc23ac644132828d125a59c2455.tar.xz yuzu-e5d417213ce67bc23ac644132828d125a59c2455.tar.zst yuzu-e5d417213ce67bc23ac644132828d125a59c2455.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/common/x64/emitter.cpp | 16 | ||||
-rw-r--r-- | src/common/x64/emitter.h | 1 |
2 files changed, 17 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) } } +void XEmitter::SetJumpTarget(const FixupBranch& branch, const u8* target) +{ + if (branch.type == 0) + { + s64 distance = (s64)(target - branch.ptr); + ASSERT_MSG(distance >= -0x80 && distance < 0x80, "Jump target too far away, needs force5Bytes = true"); + branch.ptr[-1] = (u8)(s8)distance; + } + else if (branch.type == 1) + { + s64 distance = (s64)(target - branch.ptr); + ASSERT_MSG(distance >= -0x80000000LL && distance < 0x80000000LL, "Jump target too far away, needs indirect register"); + ((s32*)branch.ptr)[-1] = (s32)distance; + } +} + //Single byte opcodes //There is no PUSHAD/POPAD in 64-bit mode. void XEmitter::INT3() {Write8(0xCC);} diff --git a/src/common/x64/emitter.h b/src/common/x64/emitter.h index 7c6548fb5..80dfa96d2 100644 --- a/src/common/x64/emitter.h +++ b/src/common/x64/emitter.h @@ -431,6 +431,7 @@ public: void J_CC(CCFlags conditionCode, const u8* addr, bool force5Bytes = false); void SetJumpTarget(const FixupBranch& branch); + void SetJumpTarget(const FixupBranch& branch, const u8* target); void SETcc(CCFlags flag, OpArg dest); // Note: CMOV brings small if any benefit on current cpus. |