summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2015-03-09 11:07:52 -0400
committerGravatar bunnei2015-03-09 11:07:52 -0400
commitf2a7c2b3b74df6b1977392a5ad7e91bae4a8a5b6 (patch)
tree3e8bb1ed9188022b72fa9b83d34de95ff39bcc4f /src
parentUpdate README.md (diff)
parentdyncom: Fix an indexing bug in STM (diff)
downloadyuzu-f2a7c2b3b74df6b1977392a5ad7e91bae4a8a5b6.tar.gz
yuzu-f2a7c2b3b74df6b1977392a5ad7e91bae4a8a5b6.tar.xz
yuzu-f2a7c2b3b74df6b1977392a5ad7e91bae4a8a5b6.zip
Merge pull request #645 from lioncash/ldm
Minor bugfixes to LDM/STM.
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index c3dba8882..2f72f5077 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) {
4362 cpu->Reg[14] = Memory::Read32(addr); 4362 cpu->Reg[14] = Memory::Read32(addr);
4363 else 4363 else
4364 cpu->Reg_usr[1] = Memory::Read32(addr); 4364 cpu->Reg_usr[1] = Memory::Read32(addr);
4365
4366 addr += 4;
4365 } 4367 }
4366 } else if (!BIT(inst, 22)) { 4368 } else if (!BIT(inst, 22)) {
4367 for(int i = 0; i < 16; i++ ){ 4369 for(int i = 0; i < 16; i++ ){
@@ -5974,54 +5976,51 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
5974 ldst_inst* inst_cream = (ldst_inst*)inst_base->component; 5976 ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
5975 unsigned int inst = inst_cream->inst; 5977 unsigned int inst = inst_cream->inst;
5976 5978
5977 int i;
5978 unsigned int Rn = BITS(inst, 16, 19); 5979 unsigned int Rn = BITS(inst, 16, 19);
5979 unsigned int old_RN = cpu->Reg[Rn]; 5980 unsigned int old_RN = cpu->Reg[Rn];
5980 5981
5981 inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); 5982 inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
5982 if (BIT(inst_cream->inst, 22) == 1) { 5983 if (BIT(inst_cream->inst, 22) == 1) {
5983 for (i = 0; i < 13; i++) { 5984 for (int i = 0; i < 13; i++) {
5984 if(BIT(inst_cream->inst, i)) { 5985 if (BIT(inst_cream->inst, i)) {
5985 Memory::Write32(addr, cpu->Reg[i]); 5986 Memory::Write32(addr, cpu->Reg[i]);
5986 addr += 4; 5987 addr += 4;
5987 } 5988 }
5988 } 5989 }
5989 if (BIT(inst_cream->inst, 13)) { 5990 if (BIT(inst_cream->inst, 13)) {
5990 if (cpu->Mode == USER32MODE) { 5991 if (cpu->Mode == USER32MODE)
5991 Memory::Write32(addr, cpu->Reg[i]); 5992 Memory::Write32(addr, cpu->Reg[13]);
5992 addr += 4; 5993 else
5993 } else {
5994 Memory::Write32(addr, cpu->Reg_usr[0]); 5994 Memory::Write32(addr, cpu->Reg_usr[0]);
5995 addr += 4; 5995
5996 } 5996 addr += 4;
5997 } 5997 }
5998 if (BIT(inst_cream->inst, 14)) { 5998 if (BIT(inst_cream->inst, 14)) {
5999 if (cpu->Mode == USER32MODE) { 5999 if (cpu->Mode == USER32MODE)
6000 Memory::Write32(addr, cpu->Reg[i]); 6000 Memory::Write32(addr, cpu->Reg[14]);
6001 addr += 4; 6001 else
6002 } else {
6003 Memory::Write32(addr, cpu->Reg_usr[1]); 6002 Memory::Write32(addr, cpu->Reg_usr[1]);
6004 addr += 4; 6003
6005 } 6004 addr += 4;
6006 } 6005 }
6007 if (BIT(inst_cream->inst, 15)) { 6006 if (BIT(inst_cream->inst, 15)) {
6008 Memory::Write32(addr, cpu->Reg_usr[1] + 8); 6007 Memory::Write32(addr, cpu->Reg_usr[1] + 8);
6009 } 6008 }
6010 } else { 6009 } else {
6011 for( i = 0; i < 15; i++ ) { 6010 for (int i = 0; i < 15; i++) {
6012 if(BIT(inst_cream->inst, i)) { 6011 if (BIT(inst_cream->inst, i)) {
6013 if(i == Rn) 6012 if (i == Rn)
6014 Memory::Write32(addr, old_RN); 6013 Memory::Write32(addr, old_RN);
6015 else 6014 else
6016 Memory::Write32(addr, cpu->Reg[i]); 6015 Memory::Write32(addr, cpu->Reg[i]);
6016
6017 addr += 4; 6017 addr += 4;
6018 } 6018 }
6019 } 6019 }
6020 6020
6021 // Check PC reg 6021 // Check PC reg
6022 if(BIT(inst_cream->inst, i)) { 6022 if (BIT(inst_cream->inst, 15))
6023 Memory::Write32(addr, cpu->Reg_usr[1] + 8); 6023 Memory::Write32(addr, cpu->Reg_usr[1] + 8);
6024 }
6025 } 6024 }
6026 } 6025 }
6027 cpu->Reg[15] += GET_INST_SIZE(cpu); 6026 cpu->Reg[15] += GET_INST_SIZE(cpu);