diff options
| author | 2016-03-19 15:16:16 -0400 | |
|---|---|---|
| committer | 2016-04-13 23:04:42 -0400 | |
| commit | e5d417213ce67bc23ac644132828d125a59c2455 (patch) | |
| tree | 93c0cc9d8917cc43db9b45e6bdb52e162d1313b5 /src/common/x64/emitter.cpp | |
| parent | Merge pull request #1660 from MerryMage/file_util (diff) | |
| download | yuzu-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.cpp | 16 |
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 | ||
| 534 | void 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. |
| 536 | void XEmitter::INT3() {Write8(0xCC);} | 552 | void XEmitter::INT3() {Write8(0xCC);} |