ARM dynarec: do a block check on the entire block

The check was on the first 4 bytes only.
Fixes Grandia II freezing on Now Loading... screen
This commit is contained in:
Flyinghead 2018-11-29 17:01:31 +01:00
parent 34fafb4442
commit 87a8fcb6f6
1 changed files with 35 additions and 7 deletions

View File

@ -2124,14 +2124,37 @@ void ngen_Compile(RuntimeBlockInfo* block,bool force_checks, bool reset, bool st
//scheduler
if (force_checks)
{
MOV32(r0,block->addr);
u32* ptr=(u32*)GetMemPtr(block->addr,4);
MOV32(r2,(u32)ptr);
LDR(r2,r2,0);
MOV32(r1,*ptr);
CMP(r1,r2);
s32 sz = block->sh4_code_size;
u32 addr = block->addr;
MOV32(r0,addr);
JUMP((u32)ngen_blockcheckfail, CC_NE);
while (sz > 0)
{
if (sz > 2)
{
u32* ptr=(u32*)GetMemPtr(addr,4);
MOV32(r2,(u32)ptr);
LDR(r2,r2,0);
MOV32(r1,*ptr);
CMP(r1,r2);
JUMP((u32)ngen_blockcheckfail, CC_NE);
addr += 4;
sz -= 4;
}
else
{
u16* ptr = (u16 *)GetMemPtr(addr, 2);
MOV32(r2, (u32)ptr);
LDRH(r2, r2, 0, AL);
MOVW(r1, *ptr, AL);
CMP(r1, r2);
JUMP((u32)ngen_blockcheckfail, CC_NE);
addr += 2;
sz -= 2;
}
}
}
u32 cyc=block->guest_cycles;
@ -2339,4 +2362,9 @@ RuntimeBlockInfo* ngen_AllocateBlock()
return new DynaRBI();
};
void CacheFlush()
{
printf("Flushing cache from %08x to %08x\n", &CodeCache[0], &CodeCache[CODE_SIZE - 1]);
//CacheFlush(&CodeCache[0], &CodeCache[CODE_SIZE - 1]);
}
#endif