summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/arm/skyeye_common/arm_regformat.h2
-rw-r--r--src/core/arm/skyeye_common/vfp/vfp.cpp16
-rw-r--r--src/core/arm/skyeye_common/vfp/vfp.h2
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpinstr.cpp75
4 files changed, 53 insertions, 42 deletions
diff --git a/src/core/arm/skyeye_common/arm_regformat.h b/src/core/arm/skyeye_common/arm_regformat.h
index a92effbb4..d1c721809 100644
--- a/src/core/arm/skyeye_common/arm_regformat.h
+++ b/src/core/arm/skyeye_common/arm_regformat.h
@@ -59,6 +59,8 @@ enum {
59 VFP_FPSID, 59 VFP_FPSID,
60 VFP_FPSCR, 60 VFP_FPSCR,
61 VFP_FPEXC, 61 VFP_FPEXC,
62 VFP_FPINST,
63 VFP_FPINST2,
62 VFP_MVFR0, 64 VFP_MVFR0,
63 VFP_MVFR1, 65 VFP_MVFR1,
64 66
diff --git a/src/core/arm/skyeye_common/vfp/vfp.cpp b/src/core/arm/skyeye_common/vfp/vfp.cpp
index 571d6c2f2..f40cf5955 100644
--- a/src/core/arm/skyeye_common/vfp/vfp.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfp.cpp
@@ -33,6 +33,10 @@ unsigned VFPInit(ARMul_State* state)
33 state->VFP[VFP_FPEXC] = 0; 33 state->VFP[VFP_FPEXC] = 0;
34 state->VFP[VFP_FPSCR] = 0; 34 state->VFP[VFP_FPSCR] = 0;
35 35
36 // ARM11 MPCore instruction register reset values.
37 state->VFP[VFP_FPINST] = 0xEE000A00;
38 state->VFP[VFP_FPINST2] = 0;
39
36 // ARM11 MPCore feature register values. 40 // ARM11 MPCore feature register values.
37 state->VFP[VFP_MVFR0] = 0x11111111; 41 state->VFP[VFP_MVFR0] = 0x11111111;
38 state->VFP[VFP_MVFR1] = 0; 42 state->VFP[VFP_MVFR1] = 0;
@@ -40,18 +44,6 @@ unsigned VFPInit(ARMul_State* state)
40 return 0; 44 return 0;
41} 45}
42 46
43void VMSR(ARMul_State* state, ARMword reg, ARMword Rt)
44{
45 if (reg == 1)
46 {
47 state->VFP[VFP_FPSCR] = state->Reg[Rt];
48 }
49 else if (reg == 8)
50 {
51 state->VFP[VFP_FPEXC] = state->Reg[Rt];
52 }
53}
54
55void VMOVBRS(ARMul_State* state, ARMword to_arm, ARMword t, ARMword n, ARMword* value) 47void VMOVBRS(ARMul_State* state, ARMword to_arm, ARMword t, ARMword n, ARMword* value)
56{ 48{
57 if (to_arm) 49 if (to_arm)
diff --git a/src/core/arm/skyeye_common/vfp/vfp.h b/src/core/arm/skyeye_common/vfp/vfp.h
index acefae9bb..eb376561a 100644
--- a/src/core/arm/skyeye_common/vfp/vfp.h
+++ b/src/core/arm/skyeye_common/vfp/vfp.h
@@ -36,10 +36,8 @@ void vfp_raise_exceptions(ARMul_State* state, u32 exceptions, u32 inst, u32 fpsc
36u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr); 36u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr);
37u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr); 37u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr);
38 38
39void VMSR(ARMul_State* state, ARMword reg, ARMword Rt);
40void VMOVBRS(ARMul_State* state, ARMword to_arm, ARMword t, ARMword n, ARMword* value); 39void VMOVBRS(ARMul_State* state, ARMword to_arm, ARMword t, ARMword n, ARMword* value);
41void VMOVBRRD(ARMul_State* state, ARMword to_arm, ARMword t, ARMword t2, ARMword n, ARMword* value1, ARMword* value2); 40void VMOVBRRD(ARMul_State* state, ARMword to_arm, ARMword t, ARMword t2, ARMword n, ARMword* value1, ARMword* value2);
42void VMOVBRRSS(ARMul_State* state, ARMword to_arm, ARMword t, ARMword t2, ARMword n, ARMword* value1, ARMword* value2); 41void VMOVBRRSS(ARMul_State* state, ARMword to_arm, ARMword t, ARMword t2, ARMword n, ARMword* value1, ARMword* value2);
43void VMOVI(ARMul_State* state, ARMword single, ARMword d, ARMword imm); 42void VMOVI(ARMul_State* state, ARMword single, ARMword d, ARMword imm);
44void VMOVR(ARMul_State* state, ARMword single, ARMword d, ARMword imm); 43void VMOVR(ARMul_State* state, ARMword single, ARMword d, ARMword imm);
45
diff --git a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
index 67fe63aa4..8efcbab1c 100644
--- a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
@@ -995,7 +995,7 @@ VMOVBRS_INST:
995#ifdef VFP_INTERPRETER_STRUCT 995#ifdef VFP_INTERPRETER_STRUCT
996struct vmsr_inst { 996struct vmsr_inst {
997 unsigned int reg; 997 unsigned int reg;
998 unsigned int Rd; 998 unsigned int Rt;
999}; 999};
1000#endif 1000#endif
1001#ifdef VFP_INTERPRETER_TRANS 1001#ifdef VFP_INTERPRETER_TRANS
@@ -1009,7 +1009,7 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(vmsr)(unsigned int inst, int index)
1009 inst_base->br = NON_BRANCH; 1009 inst_base->br = NON_BRANCH;
1010 1010
1011 inst_cream->reg = BITS(inst, 16, 19); 1011 inst_cream->reg = BITS(inst, 16, 19);
1012 inst_cream->Rd = BITS(inst, 12, 15); 1012 inst_cream->Rt = BITS(inst, 12, 15);
1013 1013
1014 return inst_base; 1014 return inst_base;
1015} 1015}
@@ -1017,15 +1017,30 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(vmsr)(unsigned int inst, int index)
1017#ifdef VFP_INTERPRETER_IMPL 1017#ifdef VFP_INTERPRETER_IMPL
1018VMSR_INST: 1018VMSR_INST:
1019{ 1019{
1020 if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { 1020 if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
1021 /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled , 1021 /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled ,
1022 and in privileged mode */ 1022 and in privileged mode */
1023 /* Exceptions must be checked, according to v7 ref manual */ 1023 /* Exceptions must be checked, according to v7 ref manual */
1024 CHECK_VFP_ENABLED; 1024 CHECK_VFP_ENABLED;
1025 1025
1026 vmsr_inst *inst_cream = (vmsr_inst *)inst_base->component; 1026 vmsr_inst* const inst_cream = (vmsr_inst*)inst_base->component;
1027
1028 unsigned int reg = inst_cream->reg;
1029 unsigned int rt = inst_cream->Rt;
1027 1030
1028 VMSR(cpu, inst_cream->reg, inst_cream->Rd); 1031 if (reg == 1)
1032 {
1033 cpu->VFP[VFP_FPSCR] = cpu->Reg[rt];
1034 }
1035 else if (InAPrivilegedMode(cpu))
1036 {
1037 if (reg == 8)
1038 cpu->VFP[VFP_FPEXC] = cpu->Reg[rt];
1039 else if (reg == 9)
1040 cpu->VFP[VFP_FPINST] = cpu->Reg[rt];
1041 else if (reg == 10)
1042 cpu->VFP[VFP_FPINST2] = cpu->Reg[rt];
1043 }
1029 } 1044 }
1030 cpu->Reg[15] += GET_INST_SIZE(cpu); 1045 cpu->Reg[15] += GET_INST_SIZE(cpu);
1031 INC_PC(sizeof(vmsr_inst)); 1046 INC_PC(sizeof(vmsr_inst));
@@ -1111,19 +1126,22 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(vmrs)(unsigned int inst, int index)
1111#ifdef VFP_INTERPRETER_IMPL 1126#ifdef VFP_INTERPRETER_IMPL
1112VMRS_INST: 1127VMRS_INST:
1113{ 1128{
1114 if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { 1129 if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
1115 /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled, 1130 /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled,
1116 and in privileged mode */ 1131 and in privileged mode */
1117 /* Exceptions must be checked, according to v7 ref manual */ 1132 /* Exceptions must be checked, according to v7 ref manual */
1118 CHECK_VFP_ENABLED; 1133 CHECK_VFP_ENABLED;
1119 1134
1120 vmrs_inst *inst_cream = (vmrs_inst *)inst_base->component; 1135 vmrs_inst* const inst_cream = (vmrs_inst*)inst_base->component;
1121 1136
1122 if (inst_cream->reg == 1) /* FPSCR */ 1137 unsigned int reg = inst_cream->reg;
1138 unsigned int rt = inst_cream->Rt;
1139
1140 if (reg == 1) // FPSCR
1123 { 1141 {
1124 if (inst_cream->Rt != 15) 1142 if (rt != 15)
1125 { 1143 {
1126 cpu->Reg[inst_cream->Rt] = cpu->VFP[VFP_FPSCR]; 1144 cpu->Reg[rt] = cpu->VFP[VFP_FPSCR];
1127 } 1145 }
1128 else 1146 else
1129 { 1147 {
@@ -1133,25 +1151,26 @@ VMRS_INST:
1133 cpu->VFlag = (cpu->VFP[VFP_FPSCR] >> 28) & 1; 1151 cpu->VFlag = (cpu->VFP[VFP_FPSCR] >> 28) & 1;
1134 } 1152 }
1135 } 1153 }
1136 else 1154 else if (reg == 0)
1137 { 1155 {
1138 switch (inst_cream->reg) 1156 cpu->Reg[rt] = cpu->VFP[VFP_FPSID];
1139 { 1157 }
1140 case 0: 1158 else if (reg == 6)
1141 cpu->Reg[inst_cream->Rt] = cpu->VFP[VFP_FPSID]; 1159 {
1142 break; 1160 cpu->Reg[rt] = cpu->VFP[VFP_MVFR1];
1143 case 6: 1161 }
1144 cpu->Reg[inst_cream->Rt] = cpu->VFP[VFP_MVFR1]; 1162 else if (reg == 7)
1145 break; 1163 {
1146 case 7: 1164 cpu->Reg[rt] = cpu->VFP[VFP_MVFR0];
1147 cpu->Reg[inst_cream->Rt] = cpu->VFP[VFP_MVFR0]; 1165 }
1148 break; 1166 else if (InAPrivilegedMode(cpu))
1149 case 8: 1167 {
1150 cpu->Reg[inst_cream->Rt] = cpu->VFP[VFP_FPEXC]; 1168 if (reg == 8)
1151 break; 1169 cpu->Reg[rt] = cpu->VFP[VFP_FPEXC];
1152 default: 1170 else if (reg == 9)
1153 break; 1171 cpu->Reg[rt] = cpu->VFP[VFP_FPINST];
1154 } 1172 else if (reg == 10)
1173 cpu->Reg[rt] = cpu->VFP[VFP_FPINST2];
1155 } 1174 }
1156 } 1175 }
1157 cpu->Reg[15] += GET_INST_SIZE(cpu); 1176 cpu->Reg[15] += GET_INST_SIZE(cpu);