arm7: LDR/LDRM switch to Thumb mode on ARMv5T [David Haywood, MetalliC]

note - why we don't have archflags for cpu architecture versions ? this feature present not on all CPUs with Thumb IA.
master
MetalliC 2017-11-09 22:12:05 +02:00
parent 77d60e5e3d
commit 098687350d
1 changed files with 20 additions and 0 deletions

View File

@ -492,6 +492,12 @@ void arm7_cpu_device::HandleMemSingle(uint32_t insn)
R15 = (R15 & ~0x03FFFFFC) /* N Z C V I F M1 M0 */ | ((data - 4) & 0x03FFFFFC);
// LDR, PC takes 2S + 2N + 1I (5 total cycles)
ARM7_ICOUNT -= 2;
// TODO only ARMv5T and above
if (data & 1)
{
set_cpsr(GET_CPSR | T_MASK);
R15--;
}
}
else
{
@ -1371,6 +1377,13 @@ void arm7_cpu_device::HandleMemBlock(uint32_t insn)
SwitchMode(temp & 3);
}
}
// TODO only ARMv5T and above
else
if (R15 & 1)
{
set_cpsr(GET_CPSR | T_MASK);
R15--;
}
// LDM PC - takes 2 extra cycles
ARM7_ICOUNT -= 2;
}
@ -1428,6 +1441,13 @@ void arm7_cpu_device::HandleMemBlock(uint32_t insn)
SwitchMode(temp & 3);
}
}
// TODO only ARMv5T and above
else
if (R15 & 1)
{
set_cpsr(GET_CPSR | T_MASK);
R15--;
}
// LDM PC - takes 2 extra cycles
ARM7_ICOUNT -= 2;
}