diff options
| author | 2015-01-27 13:51:22 -0500 | |
|---|---|---|
| committer | 2015-01-27 13:51:22 -0500 | |
| commit | b101e6312fecace119275b47fb5dfb33ad22cfc9 (patch) | |
| tree | 2cac71375006c07368b38d293405c797dd8b04b5 /src | |
| parent | Merge pull request #345 from purpasmart96/apt_stubs (diff) | |
| parent | dyncom: Minor cleanup (diff) | |
| download | yuzu-b101e6312fecace119275b47fb5dfb33ad22cfc9.tar.gz yuzu-b101e6312fecace119275b47fb5dfb33ad22cfc9.tar.xz yuzu-b101e6312fecace119275b47fb5dfb33ad22cfc9.zip | |
Merge pull request #508 from lioncash/dyn
dyncom: Minor cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 263 |
1 files changed, 137 insertions, 126 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 81427720e..4e569fd9a 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -4185,8 +4185,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4185 | // | 4185 | // |
| 4186 | // According to the ARM documentation on BXJ, if setting the J bit in the APSR | 4186 | // According to the ARM documentation on BXJ, if setting the J bit in the APSR |
| 4187 | // fails, then BXJ functions identically like a regular BX instruction. | 4187 | // fails, then BXJ functions identically like a regular BX instruction. |
| 4188 | // | 4188 | // |
| 4189 | // This is sufficient for citra, as the CPU for the 3DS does not implement Jazelle. | 4189 | // This is sufficient for citra, as the CPU for the 3DS does not implement Jazelle. |
| 4190 | 4190 | ||
| 4191 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | 4191 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4192 | bx_inst* const inst_cream = (bx_inst*)inst_base->component; | 4192 | bx_inst* const inst_cream = (bx_inst*)inst_base->component; |
| @@ -4207,8 +4207,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4207 | 4207 | ||
| 4208 | CDP_INST: | 4208 | CDP_INST: |
| 4209 | { | 4209 | { |
| 4210 | cdp_inst *inst_cream = (cdp_inst *)inst_base->component; | 4210 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4211 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | ||
| 4212 | // Undefined instruction here | 4211 | // Undefined instruction here |
| 4213 | cpu->NumInstrsToExecute = 0; | 4212 | cpu->NumInstrsToExecute = 0; |
| 4214 | return num_instrs; | 4213 | return num_instrs; |
| @@ -4231,8 +4230,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4231 | } | 4230 | } |
| 4232 | CLZ_INST: | 4231 | CLZ_INST: |
| 4233 | { | 4232 | { |
| 4234 | clz_inst *inst_cream = (clz_inst *)inst_base->component; | 4233 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4235 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4234 | clz_inst* inst_cream = (clz_inst*)inst_base->component; |
| 4236 | RD = clz(RM); | 4235 | RD = clz(RM); |
| 4237 | } | 4236 | } |
| 4238 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 4237 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| @@ -4316,10 +4315,11 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4316 | } | 4315 | } |
| 4317 | CPY_INST: | 4316 | CPY_INST: |
| 4318 | { | 4317 | { |
| 4319 | mov_inst *inst_cream = (mov_inst *)inst_base->component; | 4318 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4320 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4319 | mov_inst* inst_cream = (mov_inst*)inst_base->component; |
| 4320 | |||
| 4321 | RD = SHIFTER_OPERAND; | 4321 | RD = SHIFTER_OPERAND; |
| 4322 | if ((inst_cream->Rd == 15)) { | 4322 | if (inst_cream->Rd == 15) { |
| 4323 | INC_PC(sizeof(mov_inst)); | 4323 | INC_PC(sizeof(mov_inst)); |
| 4324 | goto DISPATCH; | 4324 | goto DISPATCH; |
| 4325 | } | 4325 | } |
| @@ -4331,8 +4331,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4331 | } | 4331 | } |
| 4332 | EOR_INST: | 4332 | EOR_INST: |
| 4333 | { | 4333 | { |
| 4334 | eor_inst *inst_cream = (eor_inst *)inst_base->component; | 4334 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4335 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4335 | eor_inst* inst_cream = (eor_inst*)inst_base->component; |
| 4336 | |||
| 4336 | u32 lop = RN; | 4337 | u32 lop = RN; |
| 4337 | if (inst_cream->Rn == 15) { | 4338 | if (inst_cream->Rn == 15) { |
| 4338 | lop += 2 * GET_INST_SIZE(cpu); | 4339 | lop += 2 * GET_INST_SIZE(cpu); |
| @@ -4371,8 +4372,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4371 | } | 4372 | } |
| 4372 | LDM_INST: | 4373 | LDM_INST: |
| 4373 | { | 4374 | { |
| 4374 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 4375 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4375 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4376 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 4376 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4377 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4377 | 4378 | ||
| 4378 | unsigned int inst = inst_cream->inst; | 4379 | unsigned int inst = inst_cream->inst; |
| @@ -4441,8 +4442,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4441 | } | 4442 | } |
| 4442 | SXTH_INST: | 4443 | SXTH_INST: |
| 4443 | { | 4444 | { |
| 4444 | sxth_inst *inst_cream = (sxth_inst *)inst_base->component; | 4445 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4445 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4446 | sxth_inst* inst_cream = (sxth_inst*)inst_base->component; |
| 4447 | |||
| 4446 | unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate); | 4448 | unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate); |
| 4447 | if (BIT(operand2, 15)) { | 4449 | if (BIT(operand2, 15)) { |
| 4448 | operand2 |= 0xffff0000; | 4450 | operand2 |= 0xffff0000; |
| @@ -4486,9 +4488,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4486 | } | 4488 | } |
| 4487 | LDRCOND_INST: | 4489 | LDRCOND_INST: |
| 4488 | { | 4490 | { |
| 4489 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | ||
| 4490 | if (CondPassed(cpu, inst_base->cond)) { | 4491 | if (CondPassed(cpu, inst_base->cond)) { |
| 4492 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | ||
| 4491 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4493 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4494 | |||
| 4492 | unsigned int value = Memory::Read32(addr); | 4495 | unsigned int value = Memory::Read32(addr); |
| 4493 | if (BIT(CP15_REG(CP15_CONTROL), 22) == 1) | 4496 | if (BIT(CP15_REG(CP15_CONTROL), 22) == 1) |
| 4494 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; | 4497 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; |
| @@ -4512,11 +4515,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4512 | } | 4515 | } |
| 4513 | UXTH_INST: | 4516 | UXTH_INST: |
| 4514 | { | 4517 | { |
| 4515 | uxth_inst *inst_cream = (uxth_inst *)inst_base->component; | 4518 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4516 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4519 | uxth_inst* inst_cream = (uxth_inst*)inst_base->component; |
| 4517 | unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) | 4520 | RD = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) & 0xffff; |
| 4518 | & 0xffff; | ||
| 4519 | RD = operand2; | ||
| 4520 | } | 4521 | } |
| 4521 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 4522 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| 4522 | INC_PC(sizeof(uxth_inst)); | 4523 | INC_PC(sizeof(uxth_inst)); |
| @@ -4525,10 +4526,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4525 | } | 4526 | } |
| 4526 | UXTAH_INST: | 4527 | UXTAH_INST: |
| 4527 | { | 4528 | { |
| 4528 | uxtah_inst *inst_cream = (uxtah_inst *)inst_base->component; | 4529 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4529 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4530 | uxtah_inst* inst_cream = (uxtah_inst*)inst_base->component; |
| 4530 | unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) | 4531 | unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) & 0xffff; |
| 4531 | & 0xffff; | 4532 | |
| 4532 | RD = RN + operand2; | 4533 | RD = RN + operand2; |
| 4533 | if (inst_cream->Rn == 15 || inst_cream->Rm == 15) { | 4534 | if (inst_cream->Rn == 15 || inst_cream->Rm == 15) { |
| 4534 | LOG_ERROR(Core_ARM11, "invalid operands for UXTAH"); | 4535 | LOG_ERROR(Core_ARM11, "invalid operands for UXTAH"); |
| @@ -4542,9 +4543,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4542 | } | 4543 | } |
| 4543 | LDRB_INST: | 4544 | LDRB_INST: |
| 4544 | { | 4545 | { |
| 4545 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 4546 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4546 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4547 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 4547 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4548 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4549 | |||
| 4548 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr); | 4550 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr); |
| 4549 | 4551 | ||
| 4550 | if (BITS(inst_cream->inst, 12, 15) == 15) { | 4552 | if (BITS(inst_cream->inst, 12, 15) == 15) { |
| @@ -4559,9 +4561,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4559 | } | 4561 | } |
| 4560 | LDRBT_INST: | 4562 | LDRBT_INST: |
| 4561 | { | 4563 | { |
| 4562 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 4564 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4563 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4565 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 4564 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4566 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4567 | |||
| 4565 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr); | 4568 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr); |
| 4566 | 4569 | ||
| 4567 | if (BITS(inst_cream->inst, 12, 15) == 15) { | 4570 | if (BITS(inst_cream->inst, 12, 15) == 15) { |
| @@ -4576,8 +4579,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4576 | } | 4579 | } |
| 4577 | LDRD_INST: | 4580 | LDRD_INST: |
| 4578 | { | 4581 | { |
| 4579 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 4582 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4580 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4583 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 4581 | // Should check if RD is even-numbered, Rd != 14, addr[0:1] == 0, (CP15_reg1_U == 1 || addr[2] == 0) | 4584 | // Should check if RD is even-numbered, Rd != 14, addr[0:1] == 0, (CP15_reg1_U == 1 || addr[2] == 0) |
| 4582 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4585 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4583 | 4586 | ||
| @@ -4594,8 +4597,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4594 | 4597 | ||
| 4595 | LDREX_INST: | 4598 | LDREX_INST: |
| 4596 | { | 4599 | { |
| 4597 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | 4600 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4598 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4601 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; |
| 4599 | unsigned int read_addr = RN; | 4602 | unsigned int read_addr = RN; |
| 4600 | 4603 | ||
| 4601 | add_exclusive_addr(cpu, read_addr); | 4604 | add_exclusive_addr(cpu, read_addr); |
| @@ -4614,8 +4617,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4614 | } | 4617 | } |
| 4615 | LDREXB_INST: | 4618 | LDREXB_INST: |
| 4616 | { | 4619 | { |
| 4617 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | 4620 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4618 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4621 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; |
| 4619 | unsigned int read_addr = RN; | 4622 | unsigned int read_addr = RN; |
| 4620 | 4623 | ||
| 4621 | add_exclusive_addr(cpu, read_addr); | 4624 | add_exclusive_addr(cpu, read_addr); |
| @@ -4634,8 +4637,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4634 | } | 4637 | } |
| 4635 | LDREXH_INST: | 4638 | LDREXH_INST: |
| 4636 | { | 4639 | { |
| 4637 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | 4640 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4638 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4641 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; |
| 4639 | unsigned int read_addr = RN; | 4642 | unsigned int read_addr = RN; |
| 4640 | 4643 | ||
| 4641 | add_exclusive_addr(cpu, read_addr); | 4644 | add_exclusive_addr(cpu, read_addr); |
| @@ -4654,8 +4657,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4654 | } | 4657 | } |
| 4655 | LDREXD_INST: | 4658 | LDREXD_INST: |
| 4656 | { | 4659 | { |
| 4657 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | 4660 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4658 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4661 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; |
| 4659 | unsigned int read_addr = RN; | 4662 | unsigned int read_addr = RN; |
| 4660 | 4663 | ||
| 4661 | add_exclusive_addr(cpu, read_addr); | 4664 | add_exclusive_addr(cpu, read_addr); |
| @@ -4676,8 +4679,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4676 | } | 4679 | } |
| 4677 | LDRH_INST: | 4680 | LDRH_INST: |
| 4678 | { | 4681 | { |
| 4679 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 4682 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4680 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4683 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 4681 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4684 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4682 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read16(addr); | 4685 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read16(addr); |
| 4683 | if (BITS(inst_cream->inst, 12, 15) == 15) { | 4686 | if (BITS(inst_cream->inst, 12, 15) == 15) { |
| @@ -4692,8 +4695,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4692 | } | 4695 | } |
| 4693 | LDRSB_INST: | 4696 | LDRSB_INST: |
| 4694 | { | 4697 | { |
| 4695 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 4698 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4696 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4699 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 4697 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4700 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4698 | unsigned int value = Memory::Read8(addr); | 4701 | unsigned int value = Memory::Read8(addr); |
| 4699 | if (BIT(value, 7)) { | 4702 | if (BIT(value, 7)) { |
| @@ -4712,8 +4715,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4712 | } | 4715 | } |
| 4713 | LDRSH_INST: | 4716 | LDRSH_INST: |
| 4714 | { | 4717 | { |
| 4715 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 4718 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4716 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4719 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 4717 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4720 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4718 | unsigned int value = Memory::Read16(addr); | 4721 | unsigned int value = Memory::Read16(addr); |
| 4719 | if (BIT(value, 15)) { | 4722 | if (BIT(value, 15)) { |
| @@ -4732,9 +4735,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4732 | } | 4735 | } |
| 4733 | LDRT_INST: | 4736 | LDRT_INST: |
| 4734 | { | 4737 | { |
| 4735 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 4738 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4736 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4739 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 4737 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); | 4740 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); |
| 4741 | |||
| 4738 | unsigned int value = Memory::Read32(addr); | 4742 | unsigned int value = Memory::Read32(addr); |
| 4739 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; | 4743 | cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; |
| 4740 | 4744 | ||
| @@ -4755,8 +4759,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4755 | } | 4759 | } |
| 4756 | MCR_INST: | 4760 | MCR_INST: |
| 4757 | { | 4761 | { |
| 4758 | mcr_inst *inst_cream = (mcr_inst *)inst_base->component; | 4762 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4759 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4763 | mcr_inst* inst_cream = (mcr_inst*)inst_base->component; |
| 4764 | |||
| 4760 | unsigned int inst = inst_cream->inst; | 4765 | unsigned int inst = inst_cream->inst; |
| 4761 | if (inst_cream->Rd == 15) { | 4766 | if (inst_cream->Rd == 15) { |
| 4762 | DEBUG_MSG; | 4767 | DEBUG_MSG; |
| @@ -4855,8 +4860,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4855 | MCRR_INST: | 4860 | MCRR_INST: |
| 4856 | MLA_INST: | 4861 | MLA_INST: |
| 4857 | { | 4862 | { |
| 4858 | mla_inst *inst_cream = (mla_inst *)inst_base->component; | 4863 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4859 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4864 | mla_inst* inst_cream = (mla_inst*)inst_base->component; |
| 4865 | |||
| 4860 | uint64_t rm = RM; | 4866 | uint64_t rm = RM; |
| 4861 | uint64_t rs = RS; | 4867 | uint64_t rs = RS; |
| 4862 | uint64_t rn = RN; | 4868 | uint64_t rn = RN; |
| @@ -4881,8 +4887,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4881 | } | 4887 | } |
| 4882 | MOV_INST: | 4888 | MOV_INST: |
| 4883 | { | 4889 | { |
| 4884 | mov_inst *inst_cream = (mov_inst *)inst_base->component; | 4890 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4885 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4891 | mov_inst* inst_cream = (mov_inst*)inst_base->component; |
| 4892 | |||
| 4886 | RD = SHIFTER_OPERAND; | 4893 | RD = SHIFTER_OPERAND; |
| 4887 | if (inst_cream->S && (inst_cream->Rd == 15)) { | 4894 | if (inst_cream->S && (inst_cream->Rd == 15)) { |
| 4888 | if (CurrentModeHasSPSR) { | 4895 | if (CurrentModeHasSPSR) { |
| @@ -4907,8 +4914,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4907 | } | 4914 | } |
| 4908 | MRC_INST: | 4915 | MRC_INST: |
| 4909 | { | 4916 | { |
| 4910 | mrc_inst *inst_cream = (mrc_inst *)inst_base->component; | 4917 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4911 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4918 | mrc_inst* inst_cream = (mrc_inst*)inst_base->component; |
| 4919 | |||
| 4912 | unsigned int inst = inst_cream->inst; | 4920 | unsigned int inst = inst_cream->inst; |
| 4913 | if (inst_cream->Rd == 15) { | 4921 | if (inst_cream->Rd == 15) { |
| 4914 | DEBUG_MSG; | 4922 | DEBUG_MSG; |
| @@ -4964,8 +4972,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4964 | MRRC_INST: | 4972 | MRRC_INST: |
| 4965 | MRS_INST: | 4973 | MRS_INST: |
| 4966 | { | 4974 | { |
| 4967 | mrs_inst *inst_cream = (mrs_inst *)inst_base->component; | 4975 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4968 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4976 | mrs_inst* inst_cream = (mrs_inst*)inst_base->component; |
| 4977 | |||
| 4969 | if (inst_cream->R) { | 4978 | if (inst_cream->R) { |
| 4970 | RD = cpu->Spsr_copy; | 4979 | RD = cpu->Spsr_copy; |
| 4971 | } else { | 4980 | } else { |
| @@ -4981,7 +4990,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4981 | MSR_INST: | 4990 | MSR_INST: |
| 4982 | { | 4991 | { |
| 4983 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | 4992 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 4984 | msr_inst *inst_cream = (msr_inst *)inst_base->component; | 4993 | msr_inst* inst_cream = (msr_inst*)inst_base->component; |
| 4985 | const uint32_t UnallocMask = 0x06f0fc00, UserMask = 0xf80f0200, PrivMask = 0x000001df, StateMask = 0x01000020; | 4994 | const uint32_t UnallocMask = 0x06f0fc00, UserMask = 0xf80f0200, PrivMask = 0x000001df, StateMask = 0x01000020; |
| 4986 | unsigned int inst = inst_cream->inst; | 4995 | unsigned int inst = inst_cream->inst; |
| 4987 | unsigned int operand; | 4996 | unsigned int operand; |
| @@ -5024,8 +5033,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5024 | } | 5033 | } |
| 5025 | MUL_INST: | 5034 | MUL_INST: |
| 5026 | { | 5035 | { |
| 5027 | mul_inst *inst_cream = (mul_inst *)inst_base->component; | 5036 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 5028 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 5037 | mul_inst* inst_cream = (mul_inst*)inst_base->component; |
| 5038 | |||
| 5029 | uint64_t rm = RM; | 5039 | uint64_t rm = RM; |
| 5030 | uint64_t rs = RS; | 5040 | uint64_t rs = RS; |
| 5031 | RD = static_cast<uint32_t>((rm * rs) & 0xffffffff); | 5041 | RD = static_cast<uint32_t>((rm * rs) & 0xffffffff); |
| @@ -5628,8 +5638,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5628 | 5638 | ||
| 5629 | SMLA_INST: | 5639 | SMLA_INST: |
| 5630 | { | 5640 | { |
| 5631 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 5641 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 5632 | smla_inst *inst_cream = (smla_inst *)inst_base->component; | 5642 | smla_inst* inst_cream = (smla_inst*)inst_base->component; |
| 5633 | int32_t operand1, operand2; | 5643 | int32_t operand1, operand2; |
| 5634 | if (inst_cream->x == 0) | 5644 | if (inst_cream->x == 0) |
| 5635 | operand1 = (BIT(RM, 15)) ? (BITS(RM, 0, 15) | 0xffff0000) : BITS(RM, 0, 15); | 5645 | operand1 = (BIT(RM, 15)) ? (BITS(RM, 0, 15) | 0xffff0000) : BITS(RM, 0, 15); |
| @@ -5709,8 +5719,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5709 | 5719 | ||
| 5710 | SMLAL_INST: | 5720 | SMLAL_INST: |
| 5711 | { | 5721 | { |
| 5712 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 5722 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 5713 | umlal_inst *inst_cream = (umlal_inst *)inst_base->component; | 5723 | umlal_inst* inst_cream = (umlal_inst*)inst_base->component; |
| 5714 | long long int rm = RM; | 5724 | long long int rm = RM; |
| 5715 | long long int rs = RS; | 5725 | long long int rs = RS; |
| 5716 | if (BIT(rm, 31)) { | 5726 | if (BIT(rm, 31)) { |
| @@ -5867,8 +5877,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5867 | 5877 | ||
| 5868 | SMUL_INST: | 5878 | SMUL_INST: |
| 5869 | { | 5879 | { |
| 5870 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 5880 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 5871 | smul_inst *inst_cream = (smul_inst *)inst_base->component; | 5881 | smul_inst* inst_cream = (smul_inst*)inst_base->component; |
| 5872 | uint32_t operand1, operand2; | 5882 | uint32_t operand1, operand2; |
| 5873 | if (inst_cream->x == 0) | 5883 | if (inst_cream->x == 0) |
| 5874 | operand1 = (BIT(RM, 15)) ? (BITS(RM, 0, 15) | 0xffff0000) : BITS(RM, 0, 15); | 5884 | operand1 = (BIT(RM, 15)) ? (BITS(RM, 0, 15) | 0xffff0000) : BITS(RM, 0, 15); |
| @@ -5888,8 +5898,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5888 | } | 5898 | } |
| 5889 | SMULL_INST: | 5899 | SMULL_INST: |
| 5890 | { | 5900 | { |
| 5891 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 5901 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 5892 | umull_inst *inst_cream = (umull_inst *)inst_base->component; | 5902 | umull_inst* inst_cream = (umull_inst*)inst_base->component; |
| 5893 | int64_t rm = RM; | 5903 | int64_t rm = RM; |
| 5894 | int64_t rs = RS; | 5904 | int64_t rs = RS; |
| 5895 | if (BIT(rm, 31)) { | 5905 | if (BIT(rm, 31)) { |
| @@ -5997,9 +6007,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5997 | } | 6007 | } |
| 5998 | STM_INST: | 6008 | STM_INST: |
| 5999 | { | 6009 | { |
| 6000 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 6010 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6001 | unsigned int inst = inst_cream->inst; | 6011 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 6002 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6012 | unsigned int inst = inst_cream->inst; |
| 6013 | |||
| 6003 | int i; | 6014 | int i; |
| 6004 | unsigned int Rn = BITS(inst, 16, 19); | 6015 | unsigned int Rn = BITS(inst, 16, 19); |
| 6005 | unsigned int old_RN = cpu->Reg[Rn]; | 6016 | unsigned int old_RN = cpu->Reg[Rn]; |
| @@ -6057,8 +6068,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6057 | } | 6068 | } |
| 6058 | SXTB_INST: | 6069 | SXTB_INST: |
| 6059 | { | 6070 | { |
| 6060 | sxtb_inst *inst_cream = (sxtb_inst *)inst_base->component; | 6071 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6061 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6072 | sxtb_inst* inst_cream = (sxtb_inst*)inst_base->component; |
| 6073 | |||
| 6062 | if (inst_cream->Rm == 15) { | 6074 | if (inst_cream->Rm == 15) { |
| 6063 | LOG_ERROR(Core_ARM11, "invalid operand for SXTB"); | 6075 | LOG_ERROR(Core_ARM11, "invalid operand for SXTB"); |
| 6064 | CITRA_IGNORE_EXIT(-1); | 6076 | CITRA_IGNORE_EXIT(-1); |
| @@ -6077,9 +6089,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6077 | } | 6089 | } |
| 6078 | STR_INST: | 6090 | STR_INST: |
| 6079 | { | 6091 | { |
| 6080 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 6092 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6081 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6093 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 6082 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); | 6094 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); |
| 6095 | |||
| 6083 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; | 6096 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; |
| 6084 | Memory::Write32(addr, value); | 6097 | Memory::Write32(addr, value); |
| 6085 | } | 6098 | } |
| @@ -6090,11 +6103,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6090 | } | 6103 | } |
| 6091 | UXTB_INST: | 6104 | UXTB_INST: |
| 6092 | { | 6105 | { |
| 6093 | uxtb_inst *inst_cream = (uxtb_inst *)inst_base->component; | 6106 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6094 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6107 | uxtb_inst* inst_cream = (uxtb_inst*)inst_base->component; |
| 6095 | unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) | 6108 | RD = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) & 0xff; |
| 6096 | & 0xff; | ||
| 6097 | RD = operand2; | ||
| 6098 | } | 6109 | } |
| 6099 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 6110 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| 6100 | INC_PC(sizeof(uxtb_inst)); | 6111 | INC_PC(sizeof(uxtb_inst)); |
| @@ -6103,10 +6114,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6103 | } | 6114 | } |
| 6104 | UXTAB_INST: | 6115 | UXTAB_INST: |
| 6105 | { | 6116 | { |
| 6106 | uxtab_inst *inst_cream = (uxtab_inst *)inst_base->component; | 6117 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6107 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6118 | uxtab_inst* inst_cream = (uxtab_inst*)inst_base->component; |
| 6108 | unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) | 6119 | |
| 6109 | & 0xff; | 6120 | unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) & 0xff; |
| 6110 | RD = RN + operand2; | 6121 | RD = RN + operand2; |
| 6111 | } | 6122 | } |
| 6112 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 6123 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| @@ -6116,8 +6127,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6116 | } | 6127 | } |
| 6117 | STRB_INST: | 6128 | STRB_INST: |
| 6118 | { | 6129 | { |
| 6119 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 6130 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6120 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6131 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 6121 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); | 6132 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); |
| 6122 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff; | 6133 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff; |
| 6123 | Memory::Write8(addr, value); | 6134 | Memory::Write8(addr, value); |
| @@ -6129,8 +6140,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6129 | } | 6140 | } |
| 6130 | STRBT_INST: | 6141 | STRBT_INST: |
| 6131 | { | 6142 | { |
| 6132 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 6143 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6133 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6144 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 6134 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); | 6145 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); |
| 6135 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff; | 6146 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff; |
| 6136 | Memory::Write8(addr, value); | 6147 | Memory::Write8(addr, value); |
| @@ -6142,8 +6153,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6142 | } | 6153 | } |
| 6143 | STRD_INST: | 6154 | STRD_INST: |
| 6144 | { | 6155 | { |
| 6145 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 6156 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6146 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6157 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 6147 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); | 6158 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); |
| 6148 | 6159 | ||
| 6149 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; | 6160 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; |
| @@ -6158,9 +6169,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6158 | } | 6169 | } |
| 6159 | STREX_INST: | 6170 | STREX_INST: |
| 6160 | { | 6171 | { |
| 6161 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | 6172 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6162 | 6173 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | |
| 6163 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | ||
| 6164 | unsigned int write_addr = cpu->Reg[inst_cream->Rn]; | 6174 | unsigned int write_addr = cpu->Reg[inst_cream->Rn]; |
| 6165 | 6175 | ||
| 6166 | if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { | 6176 | if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { |
| @@ -6181,9 +6191,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6181 | } | 6191 | } |
| 6182 | STREXB_INST: | 6192 | STREXB_INST: |
| 6183 | { | 6193 | { |
| 6184 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | 6194 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6185 | 6195 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | |
| 6186 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | ||
| 6187 | unsigned int write_addr = cpu->Reg[inst_cream->Rn]; | 6196 | unsigned int write_addr = cpu->Reg[inst_cream->Rn]; |
| 6188 | 6197 | ||
| 6189 | if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { | 6198 | if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { |
| @@ -6204,9 +6213,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6204 | } | 6213 | } |
| 6205 | STREXD_INST: | 6214 | STREXD_INST: |
| 6206 | { | 6215 | { |
| 6207 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | 6216 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6208 | 6217 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | |
| 6209 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | ||
| 6210 | unsigned int write_addr = cpu->Reg[inst_cream->Rn]; | 6218 | unsigned int write_addr = cpu->Reg[inst_cream->Rn]; |
| 6211 | 6219 | ||
| 6212 | if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { | 6220 | if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { |
| @@ -6229,9 +6237,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6229 | } | 6237 | } |
| 6230 | STREXH_INST: | 6238 | STREXH_INST: |
| 6231 | { | 6239 | { |
| 6232 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | 6240 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6233 | 6241 | generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; | |
| 6234 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | ||
| 6235 | unsigned int write_addr = cpu->Reg[inst_cream->Rn]; | 6242 | unsigned int write_addr = cpu->Reg[inst_cream->Rn]; |
| 6236 | 6243 | ||
| 6237 | if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { | 6244 | if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { |
| @@ -6252,9 +6259,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6252 | } | 6259 | } |
| 6253 | STRH_INST: | 6260 | STRH_INST: |
| 6254 | { | 6261 | { |
| 6255 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 6262 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6256 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6263 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 6257 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); | 6264 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); |
| 6265 | |||
| 6258 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xffff; | 6266 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xffff; |
| 6259 | Memory::Write16(addr, value); | 6267 | Memory::Write16(addr, value); |
| 6260 | } | 6268 | } |
| @@ -6265,9 +6273,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6265 | } | 6273 | } |
| 6266 | STRT_INST: | 6274 | STRT_INST: |
| 6267 | { | 6275 | { |
| 6268 | ldst_inst *inst_cream = (ldst_inst *)inst_base->component; | 6276 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6269 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6277 | ldst_inst* inst_cream = (ldst_inst*)inst_base->component; |
| 6270 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); | 6278 | inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); |
| 6279 | |||
| 6271 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; | 6280 | unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; |
| 6272 | Memory::Write32(addr, value); | 6281 | Memory::Write32(addr, value); |
| 6273 | } | 6282 | } |
| @@ -6313,10 +6322,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6313 | } | 6322 | } |
| 6314 | SWI_INST: | 6323 | SWI_INST: |
| 6315 | { | 6324 | { |
| 6316 | swi_inst *inst_cream = (swi_inst *)inst_base->component; | 6325 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6317 | |||
| 6318 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) | ||
| 6319 | HLE::CallSVC(Memory::Read32(cpu->Reg[15])); | 6326 | HLE::CallSVC(Memory::Read32(cpu->Reg[15])); |
| 6327 | } | ||
| 6320 | 6328 | ||
| 6321 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 6329 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| 6322 | INC_PC(sizeof(swi_inst)); | 6330 | INC_PC(sizeof(swi_inst)); |
| @@ -6325,8 +6333,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6325 | } | 6333 | } |
| 6326 | SWP_INST: | 6334 | SWP_INST: |
| 6327 | { | 6335 | { |
| 6328 | swp_inst *inst_cream = (swp_inst *)inst_base->component; | 6336 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6329 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6337 | swp_inst* inst_cream = (swp_inst*)inst_base->component; |
| 6338 | |||
| 6330 | addr = RN; | 6339 | addr = RN; |
| 6331 | unsigned int value; | 6340 | unsigned int value; |
| 6332 | value = Memory::Read32(addr); | 6341 | value = Memory::Read32(addr); |
| @@ -6341,8 +6350,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6341 | } | 6350 | } |
| 6342 | SWPB_INST: | 6351 | SWPB_INST: |
| 6343 | { | 6352 | { |
| 6344 | swp_inst *inst_cream = (swp_inst *)inst_base->component; | 6353 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6345 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6354 | swp_inst* inst_cream = (swp_inst*)inst_base->component; |
| 6346 | addr = RN; | 6355 | addr = RN; |
| 6347 | unsigned int value = Memory::Read8(addr); | 6356 | unsigned int value = Memory::Read8(addr); |
| 6348 | Memory::Write8(addr, (RM & 0xFF)); | 6357 | Memory::Write8(addr, (RM & 0xFF)); |
| @@ -6355,8 +6364,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6355 | } | 6364 | } |
| 6356 | SXTAB_INST: | 6365 | SXTAB_INST: |
| 6357 | { | 6366 | { |
| 6358 | sxtab_inst *inst_cream = (sxtab_inst *)inst_base->component; | 6367 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6359 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6368 | sxtab_inst* inst_cream = (sxtab_inst*)inst_base->component; |
| 6369 | |||
| 6360 | // R15 should be check | 6370 | // R15 should be check |
| 6361 | if(inst_cream->Rn == 15 || inst_cream->Rm == 15 || inst_cream->Rd ==15){ | 6371 | if(inst_cream->Rn == 15 || inst_cream->Rm == 15 || inst_cream->Rd ==15){ |
| 6362 | CITRA_IGNORE_EXIT(-1); | 6372 | CITRA_IGNORE_EXIT(-1); |
| @@ -6408,8 +6418,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6408 | 6418 | ||
| 6409 | SXTAH_INST: | 6419 | SXTAH_INST: |
| 6410 | { | 6420 | { |
| 6411 | sxtah_inst *inst_cream = (sxtah_inst *)inst_base->component; | 6421 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6412 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6422 | sxtah_inst* inst_cream = (sxtah_inst*)inst_base->component; |
| 6423 | |||
| 6413 | // R15 should be check | 6424 | // R15 should be check |
| 6414 | if(inst_cream->Rn == 15 || inst_cream->Rm == 15 || inst_cream->Rd ==15) { | 6425 | if(inst_cream->Rn == 15 || inst_cream->Rm == 15 || inst_cream->Rd ==15) { |
| 6415 | CITRA_IGNORE_EXIT(-1); | 6426 | CITRA_IGNORE_EXIT(-1); |
| @@ -6741,8 +6752,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6741 | } | 6752 | } |
| 6742 | UMLAL_INST: | 6753 | UMLAL_INST: |
| 6743 | { | 6754 | { |
| 6744 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6755 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6745 | umlal_inst *inst_cream = (umlal_inst *)inst_base->component; | 6756 | umlal_inst* inst_cream = (umlal_inst*)inst_base->component; |
| 6746 | unsigned long long int rm = RM; | 6757 | unsigned long long int rm = RM; |
| 6747 | unsigned long long int rs = RS; | 6758 | unsigned long long int rs = RS; |
| 6748 | unsigned long long int rst = rm * rs; | 6759 | unsigned long long int rst = rm * rs; |
| @@ -6764,8 +6775,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6764 | } | 6775 | } |
| 6765 | UMULL_INST: | 6776 | UMULL_INST: |
| 6766 | { | 6777 | { |
| 6767 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 6778 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 6768 | umull_inst *inst_cream = (umull_inst *)inst_base->component; | 6779 | umull_inst* inst_cream = (umull_inst*)inst_base->component; |
| 6769 | unsigned long long int rm = RM; | 6780 | unsigned long long int rm = RM; |
| 6770 | unsigned long long int rs = RS; | 6781 | unsigned long long int rs = RS; |
| 6771 | unsigned long long int rst = rm * rs; | 6782 | unsigned long long int rst = rm * rs; |
| @@ -6784,14 +6795,14 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6784 | } | 6795 | } |
| 6785 | B_2_THUMB: | 6796 | B_2_THUMB: |
| 6786 | { | 6797 | { |
| 6787 | b_2_thumb *inst_cream = (b_2_thumb *)inst_base->component; | 6798 | b_2_thumb* inst_cream = (b_2_thumb*)inst_base->component; |
| 6788 | cpu->Reg[15] = cpu->Reg[15] + 4 + inst_cream->imm; | 6799 | cpu->Reg[15] = cpu->Reg[15] + 4 + inst_cream->imm; |
| 6789 | INC_PC(sizeof(b_2_thumb)); | 6800 | INC_PC(sizeof(b_2_thumb)); |
| 6790 | goto DISPATCH; | 6801 | goto DISPATCH; |
| 6791 | } | 6802 | } |
| 6792 | B_COND_THUMB: | 6803 | B_COND_THUMB: |
| 6793 | { | 6804 | { |
| 6794 | b_cond_thumb *inst_cream = (b_cond_thumb *)inst_base->component; | 6805 | b_cond_thumb* inst_cream = (b_cond_thumb*)inst_base->component; |
| 6795 | 6806 | ||
| 6796 | if(CondPassed(cpu, inst_cream->cond)) | 6807 | if(CondPassed(cpu, inst_cream->cond)) |
| 6797 | cpu->Reg[15] = cpu->Reg[15] + 4 + inst_cream->imm; | 6808 | cpu->Reg[15] = cpu->Reg[15] + 4 + inst_cream->imm; |
| @@ -6803,7 +6814,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6803 | } | 6814 | } |
| 6804 | BL_1_THUMB: | 6815 | BL_1_THUMB: |
| 6805 | { | 6816 | { |
| 6806 | bl_1_thumb *inst_cream = (bl_1_thumb *)inst_base->component; | 6817 | bl_1_thumb* inst_cream = (bl_1_thumb*)inst_base->component; |
| 6807 | cpu->Reg[14] = cpu->Reg[15] + 4 + inst_cream->imm; | 6818 | cpu->Reg[14] = cpu->Reg[15] + 4 + inst_cream->imm; |
| 6808 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 6819 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| 6809 | INC_PC(sizeof(bl_1_thumb)); | 6820 | INC_PC(sizeof(bl_1_thumb)); |
| @@ -6812,7 +6823,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6812 | } | 6823 | } |
| 6813 | BL_2_THUMB: | 6824 | BL_2_THUMB: |
| 6814 | { | 6825 | { |
| 6815 | bl_2_thumb *inst_cream = (bl_2_thumb *)inst_base->component; | 6826 | bl_2_thumb* inst_cream = (bl_2_thumb*)inst_base->component; |
| 6816 | int tmp = ((cpu->Reg[15] + 2) | 1); | 6827 | int tmp = ((cpu->Reg[15] + 2) | 1); |
| 6817 | cpu->Reg[15] = (cpu->Reg[14] + inst_cream->imm); | 6828 | cpu->Reg[15] = (cpu->Reg[14] + inst_cream->imm); |
| 6818 | cpu->Reg[14] = tmp; | 6829 | cpu->Reg[14] = tmp; |
| @@ -6823,7 +6834,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6823 | { | 6834 | { |
| 6824 | // BLX 1 for armv5t and above | 6835 | // BLX 1 for armv5t and above |
| 6825 | u32 tmp = cpu->Reg[15]; | 6836 | u32 tmp = cpu->Reg[15]; |
| 6826 | blx_1_thumb *inst_cream = (blx_1_thumb *)inst_base->component; | 6837 | blx_1_thumb* inst_cream = (blx_1_thumb*)inst_base->component; |
| 6827 | cpu->Reg[15] = (cpu->Reg[14] + inst_cream->imm) & 0xFFFFFFFC; | 6838 | cpu->Reg[15] = (cpu->Reg[14] + inst_cream->imm) & 0xFFFFFFFC; |
| 6828 | cpu->Reg[14] = ((tmp + 2) | 1); | 6839 | cpu->Reg[14] = ((tmp + 2) | 1); |
| 6829 | cpu->TFlag = 0; | 6840 | cpu->TFlag = 0; |