From 07faaaa0fd997c352cf9b22bebf83809ad8f2c87 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 25 Dec 2019 23:14:58 -0800 Subject: [PATCH] Make sure to not do pops at function end if from within custom dispatch for x86 --- Source/Interface/Core/JIT/x86_64/JIT.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/Interface/Core/JIT/x86_64/JIT.cpp b/Source/Interface/Core/JIT/x86_64/JIT.cpp index b9c8bc23c..6a40301b7 100644 --- a/Source/Interface/Core/JIT/x86_64/JIT.cpp +++ b/Source/Interface/Core/JIT/x86_64/JIT.cpp @@ -279,12 +279,15 @@ void *JITCore::CompileCode([[maybe_unused]] FEXCore::IR::IRListView const if (SpillSlots) { add(rsp, SpillSlots * 16); } - pop(r15); - pop(r14); - pop(r13); - pop(r12); - pop(rbp); - pop(rbx); + + if (!CustomDispatchGenerated) { + pop(r15); + pop(r14); + pop(r13); + pop(r12); + pop(rbp); + pop(rbx); + } #ifdef BLOCKSTATS ExitBlock(); #endif @@ -1436,6 +1439,7 @@ void *JITCore::CompileCode([[maybe_unused]] FEXCore::IR::IRListView const case IR::OP_CPUID: { auto Op = IROp->C(); + using ClassPtrType = FEXCore::CPUIDEmu::FunctionResults (FEXCore::CPUIDEmu::*)(uint32_t Function); union { ClassPtrType ClassPtr;