From cda99ff0701b2d9e07662fc7f552c72d558618a4 Mon Sep 17 00:00:00 2001 From: Sandro Ronco Date: Fri, 23 Dec 2016 19:40:38 +0100 Subject: arm: fixed STR! with rd == rn. (nw) --- src/devices/cpu/arm/arm.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/devices/cpu/arm/arm.cpp b/src/devices/cpu/arm/arm.cpp index eb4de54e86d..884b22896cd 100644 --- a/src/devices/cpu/arm/arm.cpp +++ b/src/devices/cpu/arm/arm.cpp @@ -635,13 +635,7 @@ void arm_cpu_device::HandleMemSingle( uint32_t insn ) rnv = (R15 & ADDRESS_MASK) - off; } - if (insn & INSN_SDT_W) - { - SetRegister(rn,rnv); - if (ARM_DEBUG_CORE && rn == eR15) - logerror("writeback R15 %08x\n", R15); - } - else if (rn == eR15) + if (rn == eR15) { rnv = rnv + 8; } @@ -685,7 +679,7 @@ void arm_cpu_device::HandleMemSingle( uint32_t insn ) In other cases, 4 is subracted from R15 here to account for pipelining. */ - if ((cpu_read32(rnv)&3)==0) + if (m_copro_type == ARM_COPRO_TYPE_VL86C020 || (cpu_read32(rnv)&3)==0) R15 -= 4; m_icount -= S_CYCLE + N_CYCLE; @@ -716,6 +710,18 @@ void arm_cpu_device::HandleMemSingle( uint32_t insn ) } } + /* Do pre-indexing writeback */ + if ((insn & INSN_SDT_P) && (insn & INSN_SDT_W)) + { + if ((insn & INSN_SDT_L) && rd == rn) + SetRegister(rn, GetRegister(rd)); + else + SetRegister(rn, rnv); + + if (ARM_DEBUG_CORE && rn == eR15) + logerror("writeback R15 %08x\n", R15); + } + /* Do post-indexing writeback */ if (!(insn & INSN_SDT_P)/* && (insn&INSN_SDT_W)*/) { -- cgit v1.2.3