summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorbooto <remornicus@gmail.com>2017-01-26 04:57:03 -0500
committerbooto <remornicus@gmail.com>2017-01-28 18:04:44 -0500
commit2fbdf2a3ce9db50cb69c7c671fe1916ed8b20507 (patch)
treead47f817b83bf8ba5bde2e8a3e82c768bc702114 /Source/Core
parent66160c2781842b85b0360c8c2a0ba244bfa21c5d (diff)
Hack to stop dcbz/dcbi over low MEM1 trashing memory.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/BootManager.cpp3
-rw-r--r--Source/Core/Core/ConfigManager.cpp2
-rw-r--r--Source/Core/Core/ConfigManager.h1
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp13
-rw-r--r--Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp1
5 files changed, 17 insertions, 3 deletions
diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp
index 2452eddf1c..0a028e90f3 100644
--- a/Source/Core/Core/BootManager.cpp
+++ b/Source/Core/Core/BootManager.cpp
@@ -73,6 +73,7 @@ private:
bool bAccurateNaNs;
bool bMMU;
bool bDCBZOFF;
+ bool bLowDCBZHack;
bool m_EnableJIT;
bool bSyncGPU;
bool bFastDiscSpeed;
@@ -145,6 +146,7 @@ void ConfigCache::RestoreConfig(SConfig* config)
config->bAccurateNaNs = bAccurateNaNs;
config->bMMU = bMMU;
config->bDCBZOFF = bDCBZOFF;
+ config->bLowDCBZHack = bLowDCBZHack;
config->m_DSPEnableJIT = m_EnableJIT;
config->bSyncGPU = bSyncGPU;
config->bFastDiscSpeed = bFastDiscSpeed;
@@ -248,6 +250,7 @@ bool BootCore(const std::string& _rFilename)
core_section->Get("AccurateNaNs", &StartUp.bAccurateNaNs, StartUp.bAccurateNaNs);
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
+ core_section->Get("LowDCBZHack", &StartUp.bLowDCBZHack, StartUp.bLowDCBZHack);
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
core_section->Get("FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
core_section->Get("DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE);
diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp
index 6365cd3386..edb2386bd4 100644
--- a/Source/Core/Core/ConfigManager.cpp
+++ b/Source/Core/Core/ConfigManager.cpp
@@ -578,6 +578,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
core->Get("DCBZ", &bDCBZOFF, false);
+ core->Get("LowDCBZHack", &bLowDCBZHack, false);
core->Get("FPRF", &bFPRF, false);
core->Get("AccurateNaNs", &bAccurateNaNs, false);
core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
@@ -725,6 +726,7 @@ void SConfig::LoadDefaults()
bAccurateNaNs = false;
bMMU = false;
bDCBZOFF = false;
+ bLowDCBZHack = false;
iBBDumpPort = -1;
bSyncGPU = false;
bFastDiscSpeed = false;
diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h
index 89206742c5..e91bb9b1ff 100644
--- a/Source/Core/Core/ConfigManager.h
+++ b/Source/Core/Core/ConfigManager.h
@@ -106,6 +106,7 @@ struct SConfig : NonCopyable
bool bMMU = false;
bool bDCBZOFF = false;
+ bool bLowDCBZHack = false;
int iBBDumpPort = 0;
bool bFastDiscSpeed = false;
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
index 09ce857b3a..7d16ff2ec4 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
@@ -362,11 +362,18 @@ void Interpreter::dcbtst(UGeckoInstruction inst)
void Interpreter::dcbz(UGeckoInstruction inst)
{
- // TODO: Implement some sort of L2 emulation.
// DCBZOFF is a hack to fix certain games which would otherwise require
// accurate L2 emulation.
- if (!SConfig::GetInstance().bDCBZOFF)
- PowerPC::ClearCacheLine(Helper_Get_EA_X(inst) & (~31));
+ if (SConfig::GetInstance().bDCBZOFF)
+ return;
+
+ u32 dcbz_addr = Helper_Get_EA_X(inst);
+ // Hack to stop dcbz/dcbi over low MEM1 trashing memory.
+ if (SConfig::GetInstance().bLowDCBZHack && (dcbz_addr < 0x80008000) && (dcbz_addr >= 0x80000000))
+ return;
+
+ // TODO: Implement some sort of L2 emulation.
+ PowerPC::ClearCacheLine(dcbz_addr & (~31));
}
// eciwx/ecowx technically should access the specified device
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
index f730ca76dc..0ab42bcd47 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
@@ -330,6 +330,7 @@ void Jit64::dcbz(UGeckoInstruction inst)
JITDISABLE(bJITLoadStoreOff);
if (SConfig::GetInstance().bDCBZOFF)
return;
+ FALLBACK_IF(SConfig::GetInstance().bLowDCBZHack);
int a = inst.RA;
int b = inst.RB;