citra-emu
/
citra-canary
Archived
1
0
Fork 0

dyncom: Minor cleanup

Narrow scopes for the instruction variables. Remove unnecessary parentheses.
This commit is contained in:
Lioncash 2015-01-27 08:51:14 -05:00
parent 326c451758
commit 7a3e371141
1 changed files with 137 additions and 126 deletions

View File

@ -4207,8 +4207,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
CDP_INST: CDP_INST:
{ {
cdp_inst *inst_cream = (cdp_inst *)inst_base->component; if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
// Undefined instruction here // Undefined instruction here
cpu->NumInstrsToExecute = 0; cpu->NumInstrsToExecute = 0;
return num_instrs; return num_instrs;
@ -4231,8 +4230,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
CLZ_INST: CLZ_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
clz_inst* inst_cream = (clz_inst*)inst_base->component; clz_inst* inst_cream = (clz_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
RD = clz(RM); RD = clz(RM);
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4316,10 +4315,11 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
CPY_INST: CPY_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
mov_inst* inst_cream = (mov_inst*)inst_base->component; mov_inst* inst_cream = (mov_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
RD = SHIFTER_OPERAND; RD = SHIFTER_OPERAND;
if ((inst_cream->Rd == 15)) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(mov_inst)); INC_PC(sizeof(mov_inst));
goto DISPATCH; goto DISPATCH;
} }
@ -4331,8 +4331,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
EOR_INST: EOR_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
eor_inst* inst_cream = (eor_inst*)inst_base->component; eor_inst* inst_cream = (eor_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
u32 lop = RN; u32 lop = RN;
if (inst_cream->Rn == 15) { if (inst_cream->Rn == 15) {
lop += 2 * GET_INST_SIZE(cpu); lop += 2 * GET_INST_SIZE(cpu);
@ -4371,8 +4372,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDM_INST: LDM_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
unsigned int inst = inst_cream->inst; unsigned int inst = inst_cream->inst;
@ -4441,8 +4442,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
SXTH_INST: SXTH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
sxth_inst* inst_cream = (sxth_inst*)inst_base->component; sxth_inst* inst_cream = (sxth_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate); unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate);
if (BIT(operand2, 15)) { if (BIT(operand2, 15)) {
operand2 |= 0xffff0000; operand2 |= 0xffff0000;
@ -4486,9 +4488,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDRCOND_INST: LDRCOND_INST:
{ {
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if (CondPassed(cpu, inst_base->cond)) { if (CondPassed(cpu, inst_base->cond)) {
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
unsigned int value = Memory::Read32(addr); unsigned int value = Memory::Read32(addr);
if (BIT(CP15_REG(CP15_CONTROL), 22) == 1) if (BIT(CP15_REG(CP15_CONTROL), 22) == 1)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
@ -4512,11 +4515,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
UXTH_INST: UXTH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
uxth_inst* inst_cream = (uxth_inst*)inst_base->component; uxth_inst* inst_cream = (uxth_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { RD = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) & 0xffff;
unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate)
& 0xffff;
RD = operand2;
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(uxth_inst)); INC_PC(sizeof(uxth_inst));
@ -4525,10 +4526,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
UXTAH_INST: UXTAH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
uxtah_inst* inst_cream = (uxtah_inst*)inst_base->component; uxtah_inst* inst_cream = (uxtah_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) & 0xffff;
unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate)
& 0xffff;
RD = RN + operand2; RD = RN + operand2;
if (inst_cream->Rn == 15 || inst_cream->Rm == 15) { if (inst_cream->Rn == 15 || inst_cream->Rm == 15) {
LOG_ERROR(Core_ARM11, "invalid operands for UXTAH"); LOG_ERROR(Core_ARM11, "invalid operands for UXTAH");
@ -4542,9 +4543,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDRB_INST: LDRB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr); cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr);
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
@ -4559,9 +4561,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDRBT_INST: LDRBT_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr); cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr);
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
@ -4576,8 +4579,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDRD_INST: LDRD_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
// Should check if RD is even-numbered, Rd != 14, addr[0:1] == 0, (CP15_reg1_U == 1 || addr[2] == 0) // Should check if RD is even-numbered, Rd != 14, addr[0:1] == 0, (CP15_reg1_U == 1 || addr[2] == 0)
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
@ -4594,8 +4597,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
LDREX_INST: LDREX_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int read_addr = RN; unsigned int read_addr = RN;
add_exclusive_addr(cpu, read_addr); add_exclusive_addr(cpu, read_addr);
@ -4614,8 +4617,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDREXB_INST: LDREXB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int read_addr = RN; unsigned int read_addr = RN;
add_exclusive_addr(cpu, read_addr); add_exclusive_addr(cpu, read_addr);
@ -4634,8 +4637,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDREXH_INST: LDREXH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int read_addr = RN; unsigned int read_addr = RN;
add_exclusive_addr(cpu, read_addr); add_exclusive_addr(cpu, read_addr);
@ -4654,8 +4657,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDREXD_INST: LDREXD_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int read_addr = RN; unsigned int read_addr = RN;
add_exclusive_addr(cpu, read_addr); add_exclusive_addr(cpu, read_addr);
@ -4676,8 +4679,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDRH_INST: LDRH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read16(addr); cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read16(addr);
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
@ -4692,8 +4695,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDRSB_INST: LDRSB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
unsigned int value = Memory::Read8(addr); unsigned int value = Memory::Read8(addr);
if (BIT(value, 7)) { if (BIT(value, 7)) {
@ -4712,8 +4715,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDRSH_INST: LDRSH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
unsigned int value = Memory::Read16(addr); unsigned int value = Memory::Read16(addr);
if (BIT(value, 15)) { if (BIT(value, 15)) {
@ -4732,9 +4735,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
LDRT_INST: LDRT_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 1); inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
unsigned int value = Memory::Read32(addr); unsigned int value = Memory::Read32(addr);
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
@ -4755,8 +4759,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
MCR_INST: MCR_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
mcr_inst* inst_cream = (mcr_inst*)inst_base->component; mcr_inst* inst_cream = (mcr_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int inst = inst_cream->inst; unsigned int inst = inst_cream->inst;
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
DEBUG_MSG; DEBUG_MSG;
@ -4855,8 +4860,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
MCRR_INST: MCRR_INST:
MLA_INST: MLA_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
mla_inst* inst_cream = (mla_inst*)inst_base->component; mla_inst* inst_cream = (mla_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
uint64_t rm = RM; uint64_t rm = RM;
uint64_t rs = RS; uint64_t rs = RS;
uint64_t rn = RN; uint64_t rn = RN;
@ -4881,8 +4887,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
MOV_INST: MOV_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
mov_inst* inst_cream = (mov_inst*)inst_base->component; mov_inst* inst_cream = (mov_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
RD = SHIFTER_OPERAND; RD = SHIFTER_OPERAND;
if (inst_cream->S && (inst_cream->Rd == 15)) { if (inst_cream->S && (inst_cream->Rd == 15)) {
if (CurrentModeHasSPSR) { if (CurrentModeHasSPSR) {
@ -4907,8 +4914,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
MRC_INST: MRC_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
mrc_inst* inst_cream = (mrc_inst*)inst_base->component; mrc_inst* inst_cream = (mrc_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int inst = inst_cream->inst; unsigned int inst = inst_cream->inst;
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
DEBUG_MSG; DEBUG_MSG;
@ -4964,8 +4972,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
MRRC_INST: MRRC_INST:
MRS_INST: MRS_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
mrs_inst* inst_cream = (mrs_inst*)inst_base->component; mrs_inst* inst_cream = (mrs_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
if (inst_cream->R) { if (inst_cream->R) {
RD = cpu->Spsr_copy; RD = cpu->Spsr_copy;
} else { } else {
@ -5024,8 +5033,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
MUL_INST: MUL_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
mul_inst* inst_cream = (mul_inst*)inst_base->component; mul_inst* inst_cream = (mul_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
uint64_t rm = RM; uint64_t rm = RM;
uint64_t rs = RS; uint64_t rs = RS;
RD = static_cast<uint32_t>((rm * rs) & 0xffffffff); RD = static_cast<uint32_t>((rm * rs) & 0xffffffff);
@ -5628,7 +5638,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
SMLA_INST: SMLA_INST:
{ {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
smla_inst* inst_cream = (smla_inst*)inst_base->component; smla_inst* inst_cream = (smla_inst*)inst_base->component;
int32_t operand1, operand2; int32_t operand1, operand2;
if (inst_cream->x == 0) if (inst_cream->x == 0)
@ -5709,7 +5719,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
SMLAL_INST: SMLAL_INST:
{ {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
umlal_inst* inst_cream = (umlal_inst*)inst_base->component; umlal_inst* inst_cream = (umlal_inst*)inst_base->component;
long long int rm = RM; long long int rm = RM;
long long int rs = RS; long long int rs = RS;
@ -5867,7 +5877,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
SMUL_INST: SMUL_INST:
{ {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
smul_inst* inst_cream = (smul_inst*)inst_base->component; smul_inst* inst_cream = (smul_inst*)inst_base->component;
uint32_t operand1, operand2; uint32_t operand1, operand2;
if (inst_cream->x == 0) if (inst_cream->x == 0)
@ -5888,7 +5898,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
SMULL_INST: SMULL_INST:
{ {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
umull_inst* inst_cream = (umull_inst*)inst_base->component; umull_inst* inst_cream = (umull_inst*)inst_base->component;
int64_t rm = RM; int64_t rm = RM;
int64_t rs = RS; int64_t rs = RS;
@ -5997,9 +6007,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STM_INST: STM_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
unsigned int inst = inst_cream->inst; unsigned int inst = inst_cream->inst;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
int i; int i;
unsigned int Rn = BITS(inst, 16, 19); unsigned int Rn = BITS(inst, 16, 19);
unsigned int old_RN = cpu->Reg[Rn]; unsigned int old_RN = cpu->Reg[Rn];
@ -6057,8 +6068,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
SXTB_INST: SXTB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
sxtb_inst* inst_cream = (sxtb_inst*)inst_base->component; sxtb_inst* inst_cream = (sxtb_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
if (inst_cream->Rm == 15) { if (inst_cream->Rm == 15) {
LOG_ERROR(Core_ARM11, "invalid operand for SXTB"); LOG_ERROR(Core_ARM11, "invalid operand for SXTB");
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
@ -6077,9 +6089,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STR_INST: STR_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)];
Memory::Write32(addr, value); Memory::Write32(addr, value);
} }
@ -6090,11 +6103,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
UXTB_INST: UXTB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
uxtb_inst* inst_cream = (uxtb_inst*)inst_base->component; uxtb_inst* inst_cream = (uxtb_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { RD = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) & 0xff;
unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate)
& 0xff;
RD = operand2;
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(uxtb_inst)); INC_PC(sizeof(uxtb_inst));
@ -6103,10 +6114,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
UXTAB_INST: UXTAB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
uxtab_inst* inst_cream = (uxtab_inst*)inst_base->component; uxtab_inst* inst_cream = (uxtab_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate) & 0xff;
& 0xff;
RD = RN + operand2; RD = RN + operand2;
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -6116,8 +6127,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STRB_INST: STRB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff; unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff;
Memory::Write8(addr, value); Memory::Write8(addr, value);
@ -6129,8 +6140,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STRBT_INST: STRBT_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff; unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff;
Memory::Write8(addr, value); Memory::Write8(addr, value);
@ -6142,8 +6153,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STRD_INST: STRD_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)];
@ -6158,9 +6169,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STREX_INST: STREX_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int write_addr = cpu->Reg[inst_cream->Rn]; unsigned int write_addr = cpu->Reg[inst_cream->Rn];
if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) {
@ -6181,9 +6191,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STREXB_INST: STREXB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int write_addr = cpu->Reg[inst_cream->Rn]; unsigned int write_addr = cpu->Reg[inst_cream->Rn];
if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) {
@ -6204,9 +6213,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STREXD_INST: STREXD_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int write_addr = cpu->Reg[inst_cream->Rn]; unsigned int write_addr = cpu->Reg[inst_cream->Rn];
if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) {
@ -6229,9 +6237,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STREXH_INST: STREXH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component; generic_arm_inst* inst_cream = (generic_arm_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
unsigned int write_addr = cpu->Reg[inst_cream->Rn]; unsigned int write_addr = cpu->Reg[inst_cream->Rn];
if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) { if ((exclusive_detect(cpu, write_addr) == 0) && (cpu->exclusive_state == 1)) {
@ -6252,9 +6259,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STRH_INST: STRH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xffff; unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xffff;
Memory::Write16(addr, value); Memory::Write16(addr, value);
} }
@ -6265,9 +6273,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
STRT_INST: STRT_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
ldst_inst* inst_cream = (ldst_inst*)inst_base->component; ldst_inst* inst_cream = (ldst_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
inst_cream->get_addr(cpu, inst_cream->inst, addr, 0); inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)]; unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)];
Memory::Write32(addr, value); Memory::Write32(addr, value);
} }
@ -6313,10 +6322,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
SWI_INST: SWI_INST:
{ {
swi_inst *inst_cream = (swi_inst *)inst_base->component; if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond))
HLE::CallSVC(Memory::Read32(cpu->Reg[15])); HLE::CallSVC(Memory::Read32(cpu->Reg[15]));
}
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(swi_inst)); INC_PC(sizeof(swi_inst));
@ -6325,8 +6333,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
SWP_INST: SWP_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
swp_inst* inst_cream = (swp_inst*)inst_base->component; swp_inst* inst_cream = (swp_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
addr = RN; addr = RN;
unsigned int value; unsigned int value;
value = Memory::Read32(addr); value = Memory::Read32(addr);
@ -6341,8 +6350,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
SWPB_INST: SWPB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
swp_inst* inst_cream = (swp_inst*)inst_base->component; swp_inst* inst_cream = (swp_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
addr = RN; addr = RN;
unsigned int value = Memory::Read8(addr); unsigned int value = Memory::Read8(addr);
Memory::Write8(addr, (RM & 0xFF)); Memory::Write8(addr, (RM & 0xFF));
@ -6355,8 +6364,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
SXTAB_INST: SXTAB_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
sxtab_inst* inst_cream = (sxtab_inst*)inst_base->component; sxtab_inst* inst_cream = (sxtab_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
// R15 should be check // R15 should be check
if(inst_cream->Rn == 15 || inst_cream->Rm == 15 || inst_cream->Rd ==15){ if(inst_cream->Rn == 15 || inst_cream->Rm == 15 || inst_cream->Rd ==15){
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
@ -6408,8 +6418,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
SXTAH_INST: SXTAH_INST:
{ {
if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
sxtah_inst* inst_cream = (sxtah_inst*)inst_base->component; sxtah_inst* inst_cream = (sxtah_inst*)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
// R15 should be check // R15 should be check
if(inst_cream->Rn == 15 || inst_cream->Rm == 15 || inst_cream->Rd ==15) { if(inst_cream->Rn == 15 || inst_cream->Rm == 15 || inst_cream->Rd ==15) {
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
@ -6741,7 +6752,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
UMLAL_INST: UMLAL_INST:
{ {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
umlal_inst* inst_cream = (umlal_inst*)inst_base->component; umlal_inst* inst_cream = (umlal_inst*)inst_base->component;
unsigned long long int rm = RM; unsigned long long int rm = RM;
unsigned long long int rs = RS; unsigned long long int rs = RS;
@ -6764,7 +6775,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
} }
UMULL_INST: UMULL_INST:
{ {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
umull_inst* inst_cream = (umull_inst*)inst_base->component; umull_inst* inst_cream = (umull_inst*)inst_base->component;
unsigned long long int rm = RM; unsigned long long int rm = RM;
unsigned long long int rs = RS; unsigned long long int rs = RS;