diff options
-rw-r--r-- | src/ARM.h | 16 | ||||
-rw-r--r-- | src/ARMJIT_A64/ARMJIT_Compiler.cpp | 4 | ||||
-rw-r--r-- | src/ARMJIT_Internal.h | 7 | ||||
-rw-r--r-- | src/ARMJIT_x64/ARMJIT_Compiler.cpp | 4 | ||||
-rw-r--r-- | src/CP15.cpp | 12 |
5 files changed, 29 insertions, 14 deletions
@@ -308,7 +308,7 @@ public: void DataRead8(u32 addr, u32* val) { *val = NDS::ARM7Read8(addr); - DataRegion = addr >> 24; + DataRegion = addr >> 20; DataCycles = NDS::ARM7MemTimings[addr >> 15][0]; } @@ -317,7 +317,7 @@ public: addr &= ~1; *val = NDS::ARM7Read16(addr); - DataRegion = addr >> 24; + DataRegion = addr >> 20; DataCycles = NDS::ARM7MemTimings[addr >> 15][0]; } @@ -326,7 +326,7 @@ public: addr &= ~3; *val = NDS::ARM7Read32(addr); - DataRegion = addr >> 24; + DataRegion = addr >> 20; DataCycles = NDS::ARM7MemTimings[addr >> 15][2]; } @@ -341,7 +341,7 @@ public: void DataWrite8(u32 addr, u8 val) { NDS::ARM7Write8(addr, val); - DataRegion = addr >> 24; + DataRegion = addr >> 20; DataCycles = NDS::ARM7MemTimings[addr >> 15][0]; } @@ -350,7 +350,7 @@ public: addr &= ~1; NDS::ARM7Write16(addr, val); - DataRegion = addr >> 24; + DataRegion = addr >> 20; DataCycles = NDS::ARM7MemTimings[addr >> 15][0]; } @@ -359,7 +359,7 @@ public: addr &= ~3; NDS::ARM7Write32(addr, val); - DataRegion = addr >> 24; + DataRegion = addr >> 20; DataCycles = NDS::ARM7MemTimings[addr >> 15][2]; } @@ -390,7 +390,7 @@ public: s32 numC = NDS::ARM7MemTimings[CodeCycles][(CPSR&0x20)?0:2]; s32 numD = DataCycles; - if (DataRegion == 0x02) // mainRAM + if ((DataRegion >> 4) == 0x02) // mainRAM { if (CodeRegion == 0x02) Cycles += numC + numD; @@ -417,7 +417,7 @@ public: s32 numC = NDS::ARM7MemTimings[CodeCycles][(CPSR&0x20)?0:2]; s32 numD = DataCycles; - if (DataRegion == 0x02) + if ((DataRegion >> 4) == 0x02) { if (CodeRegion == 0x02) Cycles += numC + numD; diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.cpp b/src/ARMJIT_A64/ARMJIT_Compiler.cpp index 513c117..00fa436 100644 --- a/src/ARMJIT_A64/ARMJIT_Compiler.cpp +++ b/src/ARMJIT_A64/ARMJIT_Compiler.cpp @@ -650,7 +650,7 @@ void Compiler::Comp_AddCycles_CDI() s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2]; s32 numD = CurInstr.DataCycles; - if (CurInstr.DataRegion == 0x02) // mainRAM + if ((CurInstr.DataRegion >> 4) == 0x02) // mainRAM { if (CodeRegion == 0x02) cycles = numC + numD; @@ -695,7 +695,7 @@ void Compiler::Comp_AddCycles_CD() s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2]; s32 numD = CurInstr.DataCycles; - if (CurInstr.DataRegion == 0x02) + if ((CurInstr.DataRegion >> 4) == 0x02) { if (CodeRegion == 0x02) cycles += numC + numD; diff --git a/src/ARMJIT_Internal.h b/src/ARMJIT_Internal.h index b968dcb..0d6add9 100644 --- a/src/ARMJIT_Internal.h +++ b/src/ARMJIT_Internal.h @@ -40,9 +40,9 @@ struct FetchedInstr u32 Instr; u32 Addr; - u8 CodeCycles; u8 DataCycles; - u8 DataRegion; + u16 CodeCycles; + u32 DataRegion; ARMInstrInfo::Info Info; }; @@ -195,6 +195,9 @@ typedef void (*InterpreterFunc)(ARM* cpu); extern InterpreterFunc InterpretARM[]; extern InterpreterFunc InterpretTHUMB[]; +extern u8 MemRegion9[0x80000]; +extern u8 MemRegion7[0x80000]; + void* GetFuncForAddr(ARM* cpu, u32 addr, bool store, int size); } diff --git a/src/ARMJIT_x64/ARMJIT_Compiler.cpp b/src/ARMJIT_x64/ARMJIT_Compiler.cpp index 5afe842..d69bdff 100644 --- a/src/ARMJIT_x64/ARMJIT_Compiler.cpp +++ b/src/ARMJIT_x64/ARMJIT_Compiler.cpp @@ -578,7 +578,7 @@ void Compiler::Comp_AddCycles_CDI() s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2]; s32 numD = CurInstr.DataCycles; - if (CurInstr.DataRegion == 0x02) // mainRAM + if ((CurInstr.DataRegion >> 4) == 0x02) // mainRAM { if (CodeRegion == 0x02) cycles = numC + numD; @@ -623,7 +623,7 @@ void Compiler::Comp_AddCycles_CD() s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2]; s32 numD = CurInstr.DataCycles; - if (CurInstr.DataRegion == 0x02) + if ((CurInstr.DataRegion >> 4) == 0x02) { if (CodeRegion == 0x02) cycles += numC + numD; diff --git a/src/CP15.cpp b/src/CP15.cpp index 10c3b1b..8bb4f6b 100644 --- a/src/CP15.cpp +++ b/src/CP15.cpp @@ -728,6 +728,8 @@ u32 ARMv5::CodeRead32(u32 addr, bool branch) void ARMv5::DataRead8(u32 addr, u32* val) { + DataRegion = addr >> 12; + if (addr < ITCMSize) { DataCycles = 1; @@ -747,6 +749,8 @@ void ARMv5::DataRead8(u32 addr, u32* val) void ARMv5::DataRead16(u32 addr, u32* val) { + DataRegion = addr >> 12; + addr &= ~1; if (addr < ITCMSize) @@ -768,6 +772,8 @@ void ARMv5::DataRead16(u32 addr, u32* val) void ARMv5::DataRead32(u32 addr, u32* val) { + DataRegion = addr >> 12; + addr &= ~3; if (addr < ITCMSize) @@ -810,6 +816,8 @@ void ARMv5::DataRead32S(u32 addr, u32* val) void ARMv5::DataWrite8(u32 addr, u8 val) { + DataRegion = addr >> 12; + if (addr < ITCMSize) { DataCycles = 1; @@ -832,6 +840,8 @@ void ARMv5::DataWrite8(u32 addr, u8 val) void ARMv5::DataWrite16(u32 addr, u16 val) { + DataRegion = addr >> 12; + addr &= ~1; if (addr < ITCMSize) @@ -856,6 +866,8 @@ void ARMv5::DataWrite16(u32 addr, u16 val) void ARMv5::DataWrite32(u32 addr, u32 val) { + DataRegion = addr >> 12; + addr &= ~3; if (addr < ITCMSize) |