mirror of https://github.com/mgba-emu/mgba.git
Improved cycle counting for branches
This commit is contained in:
parent
f6592b17b8
commit
013e322c0b
|
@ -68,14 +68,12 @@
|
||||||
#define ARM_WRITE_PC \
|
#define ARM_WRITE_PC \
|
||||||
cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_ARM) + WORD_SIZE_ARM; \
|
cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_ARM) + WORD_SIZE_ARM; \
|
||||||
cpu->memory->setActiveRegion(cpu->memory, cpu->gprs[ARM_PC]); \
|
cpu->memory->setActiveRegion(cpu->memory, cpu->gprs[ARM_PC]); \
|
||||||
cpu->memory->loadU16(cpu->memory, cpu->gprs[ARM_PC], &cpu->cycles); \
|
cpu->cycles += 1 + cpu->memory->activePrefetchCycles32;
|
||||||
cpu->cycles += 2 + cpu->memory->activePrefetchCycles32;
|
|
||||||
|
|
||||||
#define THUMB_WRITE_PC \
|
#define THUMB_WRITE_PC \
|
||||||
cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_THUMB) + WORD_SIZE_THUMB; \
|
cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_THUMB) + WORD_SIZE_THUMB; \
|
||||||
cpu->memory->setActiveRegion(cpu->memory, cpu->gprs[ARM_PC]); \
|
cpu->memory->setActiveRegion(cpu->memory, cpu->gprs[ARM_PC]); \
|
||||||
cpu->memory->load32(cpu->memory, cpu->gprs[ARM_PC], &cpu->cycles); \
|
cpu->cycles += 1 + cpu->memory->activePrefetchCycles16;
|
||||||
cpu->cycles += 2 + cpu->memory->activePrefetchCycles16;
|
|
||||||
|
|
||||||
static inline int _ARMModeHasSPSR(enum PrivilegeMode mode) {
|
static inline int _ARMModeHasSPSR(enum PrivilegeMode mode) {
|
||||||
return mode != MODE_SYSTEM && mode != MODE_USER;
|
return mode != MODE_SYSTEM && mode != MODE_USER;
|
||||||
|
|
|
@ -109,6 +109,7 @@ static void GBASetActiveRegion(struct ARMMemory* memory, uint32_t address) {
|
||||||
memory->activeMask = 0;
|
memory->activeMask = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
gbaMemory->p->cpu.cycles += 1 + (gbaMemory->p->cpu.executionMode == MODE_ARM ? gbaMemory->waitstates32[address >> BASE_OFFSET] : gbaMemory->waitstates16[address >> BASE_OFFSET]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t GBALoad32(struct ARMMemory* memory, uint32_t address, int* cycleCounter) {
|
int32_t GBALoad32(struct ARMMemory* memory, uint32_t address, int* cycleCounter) {
|
||||||
|
|
Loading…
Reference in New Issue