mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-15 04:05:36 +02:00
OpcodeDispatcher: Simplify convoluted logic for computing call offsets
This commit is contained in:
1 parent
427b235eb5
commit
439c6bb3c0
1 file changed
+5
-6
@@ -514,18 +514,17 @@ void OpDispatchBuilder::CALLOp(OpcodeArgs) {
|
||||
BlockSetRIP = true;
|
||||
|
||||
// Call instruction only uses up to 32-bit signed displacement
|
||||
int64_t TargetOffset = Op->Src[0].Literal();
|
||||
const int64_t TargetOffset = Op->Src[0].Literal();
|
||||
|
||||
auto ConstantPC = GetRelocatedPC(Op);
|
||||
const auto ConstantPC = GetRelocatedPC(Op);
|
||||
|
||||
// Push the return address.
|
||||
Push(GPRSize, ConstantPC);
|
||||
|
||||
const uint64_t NextRIP = Op->PC + Op->InstSize;
|
||||
uint64_t TargetRIP = NextRIP + TargetOffset;
|
||||
|
||||
if (NextRIP != TargetRIP) {
|
||||
if (TargetOffset != 0) {
|
||||
// Store the RIP
|
||||
const uint64_t NextRIP = Op->PC + Op->InstSize;
|
||||
|
||||
ExitRelocatedPC(Op, TargetOffset, BranchHint::Call, ConstantPC, [&]() {
|
||||
auto CallReturnJumpTarget = JumpTargets.find(NextRIP);
|
||||
if (CallReturnJumpTarget != JumpTargets.end() && CallReturnJumpTarget->second.IsEntryPoint) {
|
||||
|
||||
Reference in new issue
Block a user