Skip to content
Permalink
Browse files
Merge pull request #6596 from lioncash/dcbz
Interpreter_LoadStore: Generate alignment exceptions if dcbz or dcbz_l are executed with the data cache disabled
  • Loading branch information
degasus committed Apr 5, 2018
2 parents 9be505f + 980f164 commit a882183
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
@@ -421,6 +421,13 @@ void Interpreter::dcbz(UGeckoInstruction inst)
return;

const u32 dcbz_addr = Helper_Get_EA_X(inst);

if (!HID0.DCE)
{
GenerateAlignmentException(dcbz_addr);
return;
}

// Hack to stop dcbz/dcbi over low MEM1 trashing memory.
if (SConfig::GetInstance().bLowDCBZHack && (dcbz_addr < 0x80008000) && (dcbz_addr >= 0x80000000))
return;
@@ -429,6 +436,20 @@ void Interpreter::dcbz(UGeckoInstruction inst)
PowerPC::ClearCacheLine(dcbz_addr & (~31));
}

void Interpreter::dcbz_l(UGeckoInstruction inst)
{
const u32 address = Helper_Get_EA_X(inst);

if (!HID0.DCE)
{
GenerateAlignmentException(address);
return;
}

// FAKE: clear memory instead of clearing the cache block
PowerPC::ClearCacheLine(address & (~31));
}

// eciwx/ecowx technically should access the specified device
// We just do it instantly from ppc...and hey, it works! :D
void Interpreter::eciwx(UGeckoInstruction inst)
@@ -331,12 +331,3 @@ void Interpreter::ps_cmpo1(UGeckoInstruction inst)
{
Helper_FloatCompareOrdered(inst, rPS1(inst.FA), rPS1(inst.FB));
}

// __________________________________________________________________________________________________
// dcbz_l
// TODO(ector) check docs
void Interpreter::dcbz_l(UGeckoInstruction inst)
{
// FAKE: clear memory instead of clearing the cache block
PowerPC::ClearCacheLine(Helper_Get_EA_X(inst) & (~31));
}

0 comments on commit a882183

Please sign in to comment.