More changes

This commit is contained in:
Nekotekina 2014-09-23 03:07:40 +04:00
parent 449e7c1049
commit e5a485e50b
8 changed files with 250 additions and 188 deletions

View file

@ -20,6 +20,7 @@ SPURecompilerCore::SPURecompilerCore(SPUThread& cpu)
, inter(new SPUInterpreter(cpu))
, CPU(cpu)
, first(true)
, need_check(false)
{
memset(entry, 0, sizeof(entry));
X86CpuInfo inf;
@ -192,20 +193,26 @@ u8 SPURecompilerCore::DecodeMemory(const u32 address)
{
// check data (hard way)
bool is_valid = true;
//for (u32 i = pos; i < (u32)(entry[pos].count + pos); i++)
//{
// if (entry[i].valid != ls[i])
// {
// is_valid = false;
// break;
// }
//}
if (need_check)
{
for (u32 i = 0; i < 0x10000; i++)
{
if (entry[i].valid && entry[i].valid != ls[i])
{
is_valid = false;
break;
}
}
need_check = false;
}
// invalidate if necessary
if (!is_valid)
{
for (u32 i = 0; i < 0x10000; i++)
{
if (entry[i].pointer &&
if (!entry[i].pointer) continue;
if (!entry[i].valid || entry[i].valid != ls[i] ||
i + (u32)entry[i].count > (u32)pos &&
i < (u32)pos + (u32)entry[pos].count)
{
@ -214,6 +221,11 @@ u8 SPURecompilerCore::DecodeMemory(const u32 address)
//RtlDeleteFunctionTable(&entry[i].info);
#endif
entry[i].pointer = nullptr;
for (u32 j = i; j < i + (u32)entry[i].count; j++)
{
entry[j].valid = 0;
}
//need_check = true;
}
}
//LOG_ERROR(Log::SPU, "SPURecompilerCore::DecodeMemory(ls_addr=0x%x): code has changed", pos * sizeof(u32));
@ -254,11 +266,17 @@ u8 SPURecompilerCore::DecodeMemory(const u32 address)
u32 res = pos;
res = func(cpu, vm::get_ptr<void>(m_offset), imm_table.data(), &g_imm_table);
if (res > 0xffff)
if (res & 0x1000000)
{
CPU.SPU.Status.SetValue(SPU_STATUS_STOPPED_BY_HALT);
CPU.Stop();
res = ~res;
res &= ~0x1000000;
}
if (res & 0x2000000)
{
need_check = true;
res &= ~0x2000000;
}
if (did_compile)