diff options
| author | 2015-05-11 18:27:49 -0400 | |
|---|---|---|
| committer | 2015-05-11 18:31:45 -0400 | |
| commit | dc7ac751f2fb0eb816ee600d84b711b11a9582d7 (patch) | |
| tree | 37751b4f484bc4264058af7a39a3840f4cb865ca /src | |
| parent | Merge pull request #749 from yuriks/stack-top (diff) | |
| download | yuzu-dc7ac751f2fb0eb816ee600d84b711b11a9582d7.tar.gz yuzu-dc7ac751f2fb0eb816ee600d84b711b11a9582d7.tar.xz yuzu-dc7ac751f2fb0eb816ee600d84b711b11a9582d7.zip | |
dyncom: Stub MCRR and MRRC
There's no other coprocessor outside the VFP (which has its own VMOV variants) in which the MPCore can send/retrieve data from.
Stubbed so citra won't crash and burn on the odd chance someone actually tries to use these.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 75 |
1 files changed, 68 insertions, 7 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index c2973fb39..315b4cc91 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -992,6 +992,14 @@ typedef struct _mcr_inst { | |||
| 992 | unsigned int inst; | 992 | unsigned int inst; |
| 993 | } mcr_inst; | 993 | } mcr_inst; |
| 994 | 994 | ||
| 995 | typedef struct mcrr_inst { | ||
| 996 | unsigned int opcode_1; | ||
| 997 | unsigned int cp_num; | ||
| 998 | unsigned int crm; | ||
| 999 | unsigned int rt; | ||
| 1000 | unsigned int rt2; | ||
| 1001 | } mcrr_inst; | ||
| 1002 | |||
| 995 | typedef struct _mrs_inst { | 1003 | typedef struct _mrs_inst { |
| 996 | unsigned int R; | 1004 | unsigned int R; |
| 997 | unsigned int Rd; | 1005 | unsigned int Rd; |
| @@ -1261,11 +1269,6 @@ static get_addr_fp_t get_calc_addr_op(unsigned int inst) { | |||
| 1261 | #define CHECK_RM (inst_cream->Rm == 15) | 1269 | #define CHECK_RM (inst_cream->Rm == 15) |
| 1262 | #define CHECK_RS (inst_cream->Rs == 15) | 1270 | #define CHECK_RS (inst_cream->Rs == 15) |
| 1263 | 1271 | ||
| 1264 | #define UNIMPLEMENTED_INSTRUCTION(mnemonic) \ | ||
| 1265 | LOG_ERROR(Core_ARM11, "unimplemented instruction: %s", mnemonic); \ | ||
| 1266 | CITRA_IGNORE_EXIT(-1); \ | ||
| 1267 | return nullptr; | ||
| 1268 | |||
| 1269 | static ARM_INST_PTR INTERPRETER_TRANSLATE(adc)(unsigned int inst, int index) | 1272 | static ARM_INST_PTR INTERPRETER_TRANSLATE(adc)(unsigned int inst, int index) |
| 1270 | { | 1273 | { |
| 1271 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(adc_inst)); | 1274 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(adc_inst)); |
| @@ -1871,7 +1874,26 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(mcr)(unsigned int inst, int index) | |||
| 1871 | inst_cream->inst = inst; | 1874 | inst_cream->inst = inst; |
| 1872 | return inst_base; | 1875 | return inst_base; |
| 1873 | } | 1876 | } |
| 1874 | static ARM_INST_PTR INTERPRETER_TRANSLATE(mcrr)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("MCRR"); } | 1877 | |
| 1878 | static ARM_INST_PTR INTERPRETER_TRANSLATE(mcrr)(unsigned int inst, int index) | ||
| 1879 | { | ||
| 1880 | arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(mcrr_inst)); | ||
| 1881 | mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component; | ||
| 1882 | |||
| 1883 | inst_base->cond = BITS(inst, 28, 31); | ||
| 1884 | inst_base->idx = index; | ||
| 1885 | inst_base->br = NON_BRANCH; | ||
| 1886 | inst_base->load_r15 = 0; | ||
| 1887 | |||
| 1888 | inst_cream->crm = BITS(inst, 0, 3); | ||
| 1889 | inst_cream->opcode_1 = BITS(inst, 4, 7); | ||
| 1890 | inst_cream->cp_num = BITS(inst, 8, 11); | ||
| 1891 | inst_cream->rt = BITS(inst, 12, 15); | ||
| 1892 | inst_cream->rt2 = BITS(inst, 16, 19); | ||
| 1893 | |||
| 1894 | return inst_base; | ||
| 1895 | } | ||
| 1896 | |||
| 1875 | static ARM_INST_PTR INTERPRETER_TRANSLATE(mla)(unsigned int inst, int index) | 1897 | static ARM_INST_PTR INTERPRETER_TRANSLATE(mla)(unsigned int inst, int index) |
| 1876 | { | 1898 | { |
| 1877 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mla_inst)); | 1899 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mla_inst)); |
| @@ -1930,7 +1952,12 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(mrc)(unsigned int inst, int index) | |||
| 1930 | inst_cream->inst = inst; | 1952 | inst_cream->inst = inst; |
| 1931 | return inst_base; | 1953 | return inst_base; |
| 1932 | } | 1954 | } |
| 1933 | static ARM_INST_PTR INTERPRETER_TRANSLATE(mrrc)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("MRRC"); } | 1955 | |
| 1956 | static ARM_INST_PTR INTERPRETER_TRANSLATE(mrrc)(unsigned int inst, int index) | ||
| 1957 | { | ||
| 1958 | return INTERPRETER_TRANSLATE(mcrr)(inst, index); | ||
| 1959 | } | ||
| 1960 | |||
| 1934 | static ARM_INST_PTR INTERPRETER_TRANSLATE(mrs)(unsigned int inst, int index) | 1961 | static ARM_INST_PTR INTERPRETER_TRANSLATE(mrs)(unsigned int inst, int index) |
| 1935 | { | 1962 | { |
| 1936 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mrs_inst)); | 1963 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mrs_inst)); |
| @@ -4754,7 +4781,24 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) { | |||
| 4754 | FETCH_INST; | 4781 | FETCH_INST; |
| 4755 | GOTO_NEXT_INST; | 4782 | GOTO_NEXT_INST; |
| 4756 | } | 4783 | } |
| 4784 | |||
| 4757 | MCRR_INST: | 4785 | MCRR_INST: |
| 4786 | { | ||
| 4787 | // Stubbed, as the MPCore doesn't have any registers that are accessible | ||
| 4788 | // through this instruction. | ||
| 4789 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | ||
| 4790 | mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component; | ||
| 4791 | |||
| 4792 | LOG_ERROR(Core_ARM11, "MCRR executed | Coprocessor: %u, CRm %u, opc1: %u, Rt: %u, Rt2: %u", | ||
| 4793 | inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt, inst_cream->rt2); | ||
| 4794 | } | ||
| 4795 | |||
| 4796 | cpu->Reg[15] += GET_INST_SIZE(cpu); | ||
| 4797 | INC_PC(sizeof(mcrr_inst)); | ||
| 4798 | FETCH_INST; | ||
| 4799 | GOTO_NEXT_INST; | ||
| 4800 | } | ||
| 4801 | |||
| 4758 | MLA_INST: | 4802 | MLA_INST: |
| 4759 | { | 4803 | { |
| 4760 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | 4804 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |
| @@ -4830,7 +4874,24 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) { | |||
| 4830 | FETCH_INST; | 4874 | FETCH_INST; |
| 4831 | GOTO_NEXT_INST; | 4875 | GOTO_NEXT_INST; |
| 4832 | } | 4876 | } |
| 4877 | |||
| 4833 | MRRC_INST: | 4878 | MRRC_INST: |
| 4879 | { | ||
| 4880 | // Stubbed, as the MPCore doesn't have any registers that are accessible | ||
| 4881 | // through this instruction. | ||
| 4882 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | ||
| 4883 | mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component; | ||
| 4884 | |||
| 4885 | LOG_ERROR(Core_ARM11, "MRRC executed | Coprocessor: %u, CRm %u, opc1: %u, Rt: %u, Rt2: %u", | ||
| 4886 | inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt, inst_cream->rt2); | ||
| 4887 | } | ||
| 4888 | |||
| 4889 | cpu->Reg[15] += GET_INST_SIZE(cpu); | ||
| 4890 | INC_PC(sizeof(mcrr_inst)); | ||
| 4891 | FETCH_INST; | ||
| 4892 | GOTO_NEXT_INST; | ||
| 4893 | } | ||
| 4894 | |||
| 4834 | MRS_INST: | 4895 | MRS_INST: |
| 4835 | { | 4896 | { |
| 4836 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | 4897 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { |