Commit d35527d9f9ca7b0c99de06eb720cb35ee56ac5f6

Authored by blueswir1
1 parent 1f5063fb

Convert CCR and CWP ops to TCG


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4086 c046a42c-6fe2-441c-8c8c-71466251a162
target-sparc/helper.h
@@ -8,6 +8,10 @@ target_ulong TCG_HELPER_PROTO helper_rdpsr(void); @@ -8,6 +8,10 @@ target_ulong TCG_HELPER_PROTO helper_rdpsr(void);
8 void TCG_HELPER_PROTO helper_wrpstate(target_ulong new_state); 8 void TCG_HELPER_PROTO helper_wrpstate(target_ulong new_state);
9 void TCG_HELPER_PROTO helper_done(void); 9 void TCG_HELPER_PROTO helper_done(void);
10 void TCG_HELPER_PROTO helper_retry(void); 10 void TCG_HELPER_PROTO helper_retry(void);
  11 +target_ulong TCG_HELPER_PROTO helper_rdccr(void);
  12 +void TCG_HELPER_PROTO helper_wrccr(target_ulong new_ccr);
  13 +target_ulong TCG_HELPER_PROTO helper_rdcwp(void);
  14 +void TCG_HELPER_PROTO helper_wrcwp(target_ulong new_cwp);
11 target_ulong TCG_HELPER_PROTO helper_array8(target_ulong pixel_addr, 15 target_ulong TCG_HELPER_PROTO helper_array8(target_ulong pixel_addr,
12 target_ulong cubesize); 16 target_ulong cubesize);
13 target_ulong TCG_HELPER_PROTO helper_alignaddr(target_ulong addr, 17 target_ulong TCG_HELPER_PROTO helper_alignaddr(target_ulong addr,
target-sparc/op.c
@@ -258,28 +258,6 @@ void OPPROTO op_restore(void) @@ -258,28 +258,6 @@ void OPPROTO op_restore(void)
258 FORCE_RET(); 258 FORCE_RET();
259 } 259 }
260 #else 260 #else
261 -void OPPROTO op_rdccr(void)  
262 -{  
263 - T0 = GET_CCR(env);  
264 -}  
265 -  
266 -void OPPROTO op_wrccr(void)  
267 -{  
268 - PUT_CCR(env, T0);  
269 -}  
270 -  
271 -// CWP handling is reversed in V9, but we still use the V8 register  
272 -// order.  
273 -void OPPROTO op_rdcwp(void)  
274 -{  
275 - T0 = GET_CWP64(env);  
276 -}  
277 -  
278 -void OPPROTO op_wrcwp(void)  
279 -{  
280 - PUT_CWP64(env, T0);  
281 -}  
282 -  
283 /* XXX: use another pointer for %iN registers to avoid slow wrapping 261 /* XXX: use another pointer for %iN registers to avoid slow wrapping
284 handling ? */ 262 handling ? */
285 void OPPROTO op_save(void) 263 void OPPROTO op_save(void)
target-sparc/op_helper.c
@@ -1636,6 +1636,27 @@ target_ulong helper_rdpsr(void) @@ -1636,6 +1636,27 @@ target_ulong helper_rdpsr(void)
1636 } 1636 }
1637 1637
1638 #else 1638 #else
  1639 +target_ulong helper_rdccr(void)
  1640 +{
  1641 + return GET_CCR(env);
  1642 +}
  1643 +
  1644 +void helper_wrccr(target_ulong new_ccr)
  1645 +{
  1646 + PUT_CCR(env, new_ccr);
  1647 +}
  1648 +
  1649 +// CWP handling is reversed in V9, but we still use the V8 register
  1650 +// order.
  1651 +target_ulong helper_rdcwp(void)
  1652 +{
  1653 + return GET_CWP64(env);
  1654 +}
  1655 +
  1656 +void helper_wrcwp(target_ulong new_cwp)
  1657 +{
  1658 + PUT_CWP64(env, new_cwp);
  1659 +}
1639 1660
1640 // This function uses non-native bit order 1661 // This function uses non-native bit order
1641 #define GET_FIELD(X, FROM, TO) \ 1662 #define GET_FIELD(X, FROM, TO) \
target-sparc/translate.c
@@ -2023,7 +2023,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2023,7 +2023,7 @@ static void disas_sparc_insn(DisasContext * dc)
2023 break; 2023 break;
2024 #ifdef TARGET_SPARC64 2024 #ifdef TARGET_SPARC64
2025 case 0x2: /* V9 rdccr */ 2025 case 0x2: /* V9 rdccr */
2026 - gen_op_rdccr(); 2026 + tcg_gen_helper_1_0(helper_rdccr, cpu_T[0]);
2027 gen_movl_T0_reg(rd); 2027 gen_movl_T0_reg(rd);
2028 break; 2028 break;
2029 case 0x3: /* V9 rdasi */ 2029 case 0x3: /* V9 rdasi */
@@ -2205,7 +2205,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2205,7 +2205,7 @@ static void disas_sparc_insn(DisasContext * dc)
2205 gen_op_movl_T0_env(offsetof(CPUSPARCState, psrpil)); 2205 gen_op_movl_T0_env(offsetof(CPUSPARCState, psrpil));
2206 break; 2206 break;
2207 case 9: // cwp 2207 case 9: // cwp
2208 - gen_op_rdcwp(); 2208 + tcg_gen_helper_1_0(helper_rdcwp, cpu_T[0]);
2209 break; 2209 break;
2210 case 10: // cansave 2210 case 10: // cansave
2211 gen_op_movl_T0_env(offsetof(CPUSPARCState, cansave)); 2211 gen_op_movl_T0_env(offsetof(CPUSPARCState, cansave));
@@ -3113,7 +3113,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3113,7 +3113,7 @@ static void disas_sparc_insn(DisasContext * dc)
3113 #else 3113 #else
3114 case 0x2: /* V9 wrccr */ 3114 case 0x2: /* V9 wrccr */
3115 gen_op_xor_T1_T0(); 3115 gen_op_xor_T1_T0();
3116 - gen_op_wrccr(); 3116 + tcg_gen_helper_0_1(helper_wrccr, cpu_T[0]);
3117 break; 3117 break;
3118 case 0x3: /* V9 wrasi */ 3118 case 0x3: /* V9 wrasi */
3119 gen_op_xor_T1_T0(); 3119 gen_op_xor_T1_T0();
@@ -3322,7 +3322,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3322,7 +3322,7 @@ static void disas_sparc_insn(DisasContext * dc)
3322 gen_op_movl_env_T0(offsetof(CPUSPARCState, psrpil)); 3322 gen_op_movl_env_T0(offsetof(CPUSPARCState, psrpil));
3323 break; 3323 break;
3324 case 9: // cwp 3324 case 9: // cwp
3325 - gen_op_wrcwp(); 3325 + tcg_gen_helper_0_1(helper_wrcwp, cpu_T[0]);
3326 break; 3326 break;
3327 case 10: // cansave 3327 case 10: // cansave
3328 gen_op_movl_env_T0(offsetof(CPUSPARCState, cansave)); 3328 gen_op_movl_env_T0(offsetof(CPUSPARCState, cansave));