diff options
Diffstat (limited to 'src/common')
| -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) | |||
| 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);} |
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: | |||
| 431 | void J_CC(CCFlags conditionCode, const u8* addr, bool force5Bytes = false); | 431 | void J_CC(CCFlags conditionCode, const u8* addr, bool force5Bytes = false); |
| 432 | 432 | ||
| 433 | void SetJumpTarget(const FixupBranch& branch); | 433 | void SetJumpTarget(const FixupBranch& branch); |
| 434 | void SetJumpTarget(const FixupBranch& branch, const u8* target); | ||
| 434 | 435 | ||
| 435 | void SETcc(CCFlags flag, OpArg dest); | 436 | void SETcc(CCFlags flag, OpArg dest); |
| 436 | // Note: CMOV brings small if any benefit on current cpus. | 437 | // Note: CMOV brings small if any benefit on current cpus. |