diff options
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 6ef270d71..64335b9c2 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -871,6 +871,8 @@ typedef struct _mvn_inst { | |||
| 871 | typedef struct _rev_inst { | 871 | typedef struct _rev_inst { |
| 872 | unsigned int Rd; | 872 | unsigned int Rd; |
| 873 | unsigned int Rm; | 873 | unsigned int Rm; |
| 874 | unsigned int op1; | ||
| 875 | unsigned int op2; | ||
| 874 | } rev_inst; | 876 | } rev_inst; |
| 875 | 877 | ||
| 876 | typedef struct _rsb_inst { | 878 | typedef struct _rsb_inst { |
| @@ -2093,36 +2095,33 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(qsubaddx)(unsigned int inst, int index) | |||
| 2093 | { | 2095 | { |
| 2094 | return INTERPRETER_TRANSLATE(qadd8)(inst, index); | 2096 | return INTERPRETER_TRANSLATE(qadd8)(inst, index); |
| 2095 | } | 2097 | } |
| 2098 | |||
| 2096 | ARM_INST_PTR INTERPRETER_TRANSLATE(rev)(unsigned int inst, int index) | 2099 | ARM_INST_PTR INTERPRETER_TRANSLATE(rev)(unsigned int inst, int index) |
| 2097 | { | 2100 | { |
| 2098 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rev_inst)); | 2101 | arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(rev_inst)); |
| 2099 | rev_inst *inst_cream = (rev_inst *)inst_base->component; | 2102 | rev_inst* const inst_cream = (rev_inst*)inst_base->component; |
| 2100 | 2103 | ||
| 2101 | inst_base->cond = BITS(inst, 28, 31); | 2104 | inst_base->cond = BITS(inst, 28, 31); |
| 2102 | inst_base->idx = index; | 2105 | inst_base->idx = index; |
| 2103 | inst_base->br = NON_BRANCH; | 2106 | inst_base->br = NON_BRANCH; |
| 2104 | inst_base->load_r15 = 0; | 2107 | inst_base->load_r15 = 0; |
| 2105 | 2108 | ||
| 2106 | inst_cream->Rm = BITS(inst, 0, 3); | 2109 | inst_cream->Rm = BITS(inst, 0, 3); |
| 2107 | inst_cream->Rd = BITS(inst, 12, 15); | 2110 | inst_cream->Rd = BITS(inst, 12, 15); |
| 2111 | inst_cream->op1 = BITS(inst, 20, 22); | ||
| 2112 | inst_cream->op2 = BITS(inst, 5, 7); | ||
| 2108 | 2113 | ||
| 2109 | return inst_base; | 2114 | return inst_base; |
| 2110 | } | 2115 | } |
| 2111 | ARM_INST_PTR INTERPRETER_TRANSLATE(rev16)(unsigned int inst, int index){ | 2116 | ARM_INST_PTR INTERPRETER_TRANSLATE(rev16)(unsigned int inst, int index) |
| 2112 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rev_inst)); | 2117 | { |
| 2113 | rev_inst *inst_cream = (rev_inst *)inst_base->component; | 2118 | return INTERPRETER_TRANSLATE(rev)(inst, index); |
| 2114 | |||
| 2115 | inst_base->cond = BITS(inst, 28, 31); | ||
| 2116 | inst_base->idx = index; | ||
| 2117 | inst_base->br = NON_BRANCH; | ||
| 2118 | inst_base->load_r15 = 0; | ||
| 2119 | |||
| 2120 | inst_cream->Rm = BITS(inst, 0, 3); | ||
| 2121 | inst_cream->Rd = BITS(inst, 12, 15); | ||
| 2122 | |||
| 2123 | return inst_base; | ||
| 2124 | } | 2119 | } |
| 2125 | ARM_INST_PTR INTERPRETER_TRANSLATE(revsh)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("REVSH"); } | 2120 | ARM_INST_PTR INTERPRETER_TRANSLATE(revsh)(unsigned int inst, int index) |
| 2121 | { | ||
| 2122 | return INTERPRETER_TRANSLATE(rev)(inst, index); | ||
| 2123 | } | ||
| 2124 | |||
| 2126 | ARM_INST_PTR INTERPRETER_TRANSLATE(rfe)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("RFE"); } | 2125 | ARM_INST_PTR INTERPRETER_TRANSLATE(rfe)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("RFE"); } |
| 2127 | ARM_INST_PTR INTERPRETER_TRANSLATE(rsb)(unsigned int inst, int index) | 2126 | ARM_INST_PTR INTERPRETER_TRANSLATE(rsb)(unsigned int inst, int index) |
| 2128 | { | 2127 | { |
| @@ -5090,39 +5089,40 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5090 | QDADD_INST: | 5089 | QDADD_INST: |
| 5091 | QDSUB_INST: | 5090 | QDSUB_INST: |
| 5092 | QSUB_INST: | 5091 | QSUB_INST: |
| 5092 | |||
| 5093 | REV_INST: | 5093 | REV_INST: |
| 5094 | { | ||
| 5095 | rev_inst *inst_cream = (rev_inst *)inst_base->component; | ||
| 5096 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | ||
| 5097 | RD = ((RM & 0xff) << 24) | | ||
| 5098 | (((RM >> 8) & 0xff) << 16) | | ||
| 5099 | (((RM >> 16) & 0xff) << 8) | | ||
| 5100 | ((RM >> 24) & 0xff); | ||
| 5101 | if (inst_cream->Rm == 15) { | ||
| 5102 | LOG_ERROR(Core_ARM11, "invalid operand for REV"); | ||
| 5103 | CITRA_IGNORE_EXIT(-1); | ||
| 5104 | } | ||
| 5105 | } | ||
| 5106 | cpu->Reg[15] += GET_INST_SIZE(cpu); | ||
| 5107 | INC_PC(sizeof(rev_inst)); | ||
| 5108 | FETCH_INST; | ||
| 5109 | GOTO_NEXT_INST; | ||
| 5110 | } | ||
| 5111 | REV16_INST: | 5094 | REV16_INST: |
| 5095 | REVSH_INST: | ||
| 5112 | { | 5096 | { |
| 5113 | rev_inst *inst_cream = (rev_inst *)inst_base->component; | 5097 | |
| 5114 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 5098 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| 5115 | RD = (BITS(RM, 0, 7) << 8) | | 5099 | rev_inst* const inst_cream = (rev_inst*)inst_base->component; |
| 5116 | BITS(RM, 8, 15) | | 5100 | |
| 5117 | (BITS(RM, 16, 23) << 24) | | 5101 | const u8 op1 = inst_cream->op1; |
| 5118 | (BITS(RM, 24, 31) << 16); | 5102 | const u8 op2 = inst_cream->op2; |
| 5103 | |||
| 5104 | // REV | ||
| 5105 | if (op1 == 0x03 && op2 == 0x01) { | ||
| 5106 | RD = ((RM & 0xFF) << 24) | (((RM >> 8) & 0xFF) << 16) | (((RM >> 16) & 0xFF) << 8) | ((RM >> 24) & 0xFF); | ||
| 5107 | } | ||
| 5108 | // REV16 | ||
| 5109 | else if (op1 == 0x03 && op2 == 0x05) { | ||
| 5110 | RD = ((RM & 0xFF) << 8) | ((RM & 0xFF00) >> 8) | ((RM & 0xFF0000) << 8) | ((RM & 0xFF000000) >> 8); | ||
| 5111 | } | ||
| 5112 | // REVSH | ||
| 5113 | else if (op1 == 0x07 && op2 == 0x05) { | ||
| 5114 | RD = ((RM & 0xFF) << 8) | ((RM & 0xFF00) >> 8); | ||
| 5115 | if (RD & 0x8000) | ||
| 5116 | RD |= 0xffff0000; | ||
| 5117 | } | ||
| 5119 | } | 5118 | } |
| 5119 | |||
| 5120 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 5120 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| 5121 | INC_PC(sizeof(rev_inst)); | 5121 | INC_PC(sizeof(rev_inst)); |
| 5122 | FETCH_INST; | 5122 | FETCH_INST; |
| 5123 | GOTO_NEXT_INST; | 5123 | GOTO_NEXT_INST; |
| 5124 | } | 5124 | } |
| 5125 | REVSH_INST: | 5125 | |
| 5126 | RFE_INST: | 5126 | RFE_INST: |
| 5127 | RSB_INST: | 5127 | RSB_INST: |
| 5128 | { | 5128 | { |