From e37425b380fbc84ec40fab3ff13b7b212b588e72 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 8 Mar 2015 21:46:54 -0400 Subject: dyncom: Increment addr when accessing LR in LDM --- src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index c3dba8882..81ab5cd21 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -4362,6 +4362,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { cpu->Reg[14] = Memory::Read32(addr); else cpu->Reg_usr[1] = Memory::Read32(addr); + + addr += 4; } } else if (!BIT(inst, 22)) { for(int i = 0; i < 16; i++ ){ -- cgit v1.2.3 From 36dab56c31e05f4b01a9fec5052ef8154c34a93c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 8 Mar 2015 21:48:35 -0400 Subject: dyncom: General cleanup of STM --- src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 30 ++++++++++++-------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 81ab5cd21..ba09c58b7 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -5983,47 +5983,45 @@ unsigned InterpreterMainLoop(ARMul_State* state) { inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); if (BIT(inst_cream->inst, 22) == 1) { for (i = 0; i < 13; i++) { - if(BIT(inst_cream->inst, i)) { + if (BIT(inst_cream->inst, i)) { Memory::Write32(addr, cpu->Reg[i]); addr += 4; } } if (BIT(inst_cream->inst, 13)) { - if (cpu->Mode == USER32MODE) { + if (cpu->Mode == USER32MODE) Memory::Write32(addr, cpu->Reg[i]); - addr += 4; - } else { + else Memory::Write32(addr, cpu->Reg_usr[0]); - addr += 4; - } + + addr += 4; } if (BIT(inst_cream->inst, 14)) { - if (cpu->Mode == USER32MODE) { + if (cpu->Mode == USER32MODE) Memory::Write32(addr, cpu->Reg[i]); - addr += 4; - } else { + else Memory::Write32(addr, cpu->Reg_usr[1]); - addr += 4; - } + + addr += 4; } if (BIT(inst_cream->inst, 15)) { Memory::Write32(addr, cpu->Reg_usr[1] + 8); } } else { - for( i = 0; i < 15; i++ ) { - if(BIT(inst_cream->inst, i)) { - if(i == Rn) + for (i = 0; i < 15; i++) { + if (BIT(inst_cream->inst, i)) { + if (i == Rn) Memory::Write32(addr, old_RN); else Memory::Write32(addr, cpu->Reg[i]); + addr += 4; } } // Check PC reg - if(BIT(inst_cream->inst, i)) { + if (BIT(inst_cream->inst, 15)) Memory::Write32(addr, cpu->Reg_usr[1] + 8); - } } } cpu->Reg[15] += GET_INST_SIZE(cpu); -- cgit v1.2.3 From 386dbab5ea5bd8503471dc010346a9c1b715df23 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 8 Mar 2015 21:53:03 -0400 Subject: dyncom: Fix an indexing bug in STM Previously it would write the contents of register 13 for the case where the link register (r14) is supposed to be written. --- src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index ba09c58b7..2f72f5077 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -5976,13 +5976,12 @@ unsigned InterpreterMainLoop(ARMul_State* state) { ldst_inst* inst_cream = (ldst_inst*)inst_base->component; unsigned int inst = inst_cream->inst; - int i; unsigned int Rn = BITS(inst, 16, 19); unsigned int old_RN = cpu->Reg[Rn]; inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); if (BIT(inst_cream->inst, 22) == 1) { - for (i = 0; i < 13; i++) { + for (int i = 0; i < 13; i++) { if (BIT(inst_cream->inst, i)) { Memory::Write32(addr, cpu->Reg[i]); addr += 4; @@ -5990,7 +5989,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { } if (BIT(inst_cream->inst, 13)) { if (cpu->Mode == USER32MODE) - Memory::Write32(addr, cpu->Reg[i]); + Memory::Write32(addr, cpu->Reg[13]); else Memory::Write32(addr, cpu->Reg_usr[0]); @@ -5998,7 +5997,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { } if (BIT(inst_cream->inst, 14)) { if (cpu->Mode == USER32MODE) - Memory::Write32(addr, cpu->Reg[i]); + Memory::Write32(addr, cpu->Reg[14]); else Memory::Write32(addr, cpu->Reg_usr[1]); @@ -6008,7 +6007,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { Memory::Write32(addr, cpu->Reg_usr[1] + 8); } } else { - for (i = 0; i < 15; i++) { + for (int i = 0; i < 15; i++) { if (BIT(inst_cream->inst, i)) { if (i == Rn) Memory::Write32(addr, old_RN); -- cgit v1.2.3