fix r3643 regression which broke arm7 on certain bios configurations due to bug in the bios protection check

This commit is contained in:
zeromus 2010-05-17 19:22:34 +00:00
parent 40d58e14fc
commit 37453c7af9
2 changed files with 9 additions and 2 deletions

View File

@ -4106,6 +4106,9 @@ u8 FASTCALL _MMU_ARM7_read08(u32 adr)
{
//u32 prot = T1ReadLong_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x04000308 & MMU.MMU_MASK[ARMCPU_ARM7][0x40]);
//if (prot) INFO("MMU7 read 08 at 0x%08X (PC 0x%08X) BIOSPROT address 0x%08X\n", adr, NDS_ARM7.R[15], prot);
//How accurate is this? our R[15] may not be exactly what the hardware uses (may use something less by up to 0x08)
//This may be inaccurate at the very edge cases.
if (NDS_ARM7.R[15] > 0x3FFF)
return 0xFF;
}

View File

@ -395,10 +395,12 @@ FORCEINLINE static u32 armcpu_prefetch()
// }
//#else
curInstruction &= 0xFFFFFFFC; //please don't change this to 0x0FFFFFFC -- the NDS will happily run on 0xF******* addresses all day long
armcpu->instruction = _MMU_read32<PROCNUM, MMU_AT_CODE>(curInstruction);
//please note that we must setup R[15] before reading the instruction since there is a protection
//which prevents PC > 0x3FFF from reading the bios region
armcpu->instruct_adr = curInstruction;
armcpu->next_instruction = curInstruction + 4;
armcpu->R[15] = curInstruction + 8;
armcpu->instruction = _MMU_read32<PROCNUM, MMU_AT_CODE>(curInstruction);
//#endif
return MMU_codeFetchCycles<PROCNUM,32>(curInstruction);
@ -417,10 +419,12 @@ FORCEINLINE static u32 armcpu_prefetch()
// }
//#else
curInstruction &= 0xFFFFFFFE; //please don't change this to 0x0FFFFFFE -- the NDS will happily run on 0xF******* addresses all day long
armcpu->instruction = _MMU_read16<PROCNUM, MMU_AT_CODE>(curInstruction);
//please note that we must setup R[15] before reading the instruction since there is a protection
//which prevents PC > 0x3FFF from reading the bios region
armcpu->instruct_adr = curInstruction;
armcpu->next_instruction = curInstruction + 2;
armcpu->R[15] = curInstruction + 4;
armcpu->instruction = _MMU_read16<PROCNUM, MMU_AT_CODE>(curInstruction);
//#endif
if(PROCNUM==0)