From 589cf551a001eac935d25d5e3e67ba344a5664cb Mon Sep 17 00:00:00 2001 From: sum2012 Date: Wed, 20 Aug 2014 06:52:35 +0800 Subject: [PATCH] Revert "Fixed an issue when MipsCall executed on any random thread instead of it's own thread causing some registers to be corrupted and leading to invalid address access" This reverts commit 8a65d73ad25ad0f35b02f0e3af84de37625550b0. --- Core/HLE/sceKernelThread.cpp | 17 ----------------- Core/HLE/sceKernelThread.h | 3 --- 2 files changed, 20 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index cca8e9718d..102f9a1adb 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -966,10 +966,6 @@ void MipsCall::DoState(PointerWrap &p) doAfter = __KernelCreateAction(actionTypeID); doAfter->DoState(p); } - - IsOldSaveState = true; // just a workaround to prevent using the variable below when it's loading from an old savestate - //p.Do(savedAt); - //p.DoArray(savedAregs, ARRAY_SIZE(savedAregs)); // This could cause incompatibility with old savestate right? } void MipsCall::setReturnValue(u32 value) @@ -3407,12 +3403,6 @@ void __KernelExecuteMipsCallOnCurrentThread(u32 callId, bool reschedAfter) call->savedV1 = currentMIPS->r[MIPS_REG_V1]; call->savedId = cur->currentMipscallId; call->reschedAfter = reschedAfter; - // Also need to backup other regs which might be used by the called mips function, needed when mipscall executed on any random thread to prevent corrupting the original regs - call->IsOldSaveState = false; - call->savedAt = currentMIPS->r[MIPS_REG_COMPILER_SCRATCH]; - for (int i = 0; i < 27; i++) { - call->savedAregs[i] = currentMIPS->r[MIPS_REG_A0 + i]; - } // Set up the new state currentMIPS->pc = call->entryPoint; @@ -3457,13 +3447,6 @@ void __KernelReturnFromMipsCall() currentMIPS->r[MIPS_REG_V0] = call->savedV0; currentMIPS->r[MIPS_REG_V1] = call->savedV1; cur->currentMipscallId = call->savedId; - // Also need to restore regs which might be changed during the call to prevent mipscall corrupting the original regs when mipscall executed on any random thread - if (!call->IsOldSaveState) { // Don't restore these regs if MipsCall was loaded from an old savestate - currentMIPS->r[MIPS_REG_COMPILER_SCRATCH] = call->savedAt; - for (int i = 0; i < 27; i++) { - currentMIPS->r[MIPS_REG_A0 + i] = call->savedAregs[i]; - } - } // If the thread called ExitDelete, we might've already decreased g_inCbCount. if (call->cbId != 0 && g_inCbCount > 0) { diff --git a/Core/HLE/sceKernelThread.h b/Core/HLE/sceKernelThread.h index 8b1f6d8f1a..acb5eeeb96 100644 --- a/Core/HLE/sceKernelThread.h +++ b/Core/HLE/sceKernelThread.h @@ -261,9 +261,6 @@ struct MipsCall { std::string tag; u32 savedId; bool reschedAfter; - u32 savedAt; - u32 savedAregs[27]; - bool IsOldSaveState; void DoState(PointerWrap &p); void setReturnValue(u32 value);