Commit d72a19f7bd861390fcd1ddb3cb792a04eca1bedd

Authored by aurel32
1 parent fa407c03

target-ppc: convert return from interrupt instructions to TCG

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5832 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.h
@@ -6,6 +6,18 @@ DEF_HELPER_3(tw, void, tl, tl, i32) @@ -6,6 +6,18 @@ DEF_HELPER_3(tw, void, tl, tl, i32)
6 #if defined(TARGET_PPC64) 6 #if defined(TARGET_PPC64)
7 DEF_HELPER_3(td, void, tl, tl, i32) 7 DEF_HELPER_3(td, void, tl, tl, i32)
8 #endif 8 #endif
  9 +#if !defined(CONFIG_USER_ONLY)
  10 +DEF_HELPER_0(rfi, void)
  11 +DEF_HELPER_0(rfsvc, void)
  12 +DEF_HELPER_0(40x_rfci, void)
  13 +DEF_HELPER_0(rfci, void)
  14 +DEF_HELPER_0(rfdi, void)
  15 +DEF_HELPER_0(rfmci, void)
  16 +#if defined(TARGET_PPC64)
  17 +DEF_HELPER_0(rfid, void)
  18 +DEF_HELPER_0(hrfid, void)
  19 +#endif
  20 +#endif
9 21
10 DEF_HELPER_2(lmw, void, tl, i32) 22 DEF_HELPER_2(lmw, void, tl, i32)
11 DEF_HELPER_2(stmw, void, tl, i32) 23 DEF_HELPER_2(stmw, void, tl, i32)
@@ -17,10 +29,6 @@ DEF_HELPER_1(dcbz_970, void, tl) @@ -17,10 +29,6 @@ DEF_HELPER_1(dcbz_970, void, tl)
17 DEF_HELPER_1(icbi, void, tl) 29 DEF_HELPER_1(icbi, void, tl)
18 DEF_HELPER_4(lscbx, tl, tl, i32, i32, i32) 30 DEF_HELPER_4(lscbx, tl, tl, i32, i32, i32)
19 31
20 -  
21 -DEF_HELPER_2(fcmpo, i32, i64, i64)  
22 -DEF_HELPER_2(fcmpu, i32, i64, i64)  
23 -  
24 DEF_HELPER_0(load_cr, tl) 32 DEF_HELPER_0(load_cr, tl)
25 DEF_HELPER_2(store_cr, void, tl, i32) 33 DEF_HELPER_2(store_cr, void, tl, i32)
26 34
@@ -53,6 +61,9 @@ DEF_HELPER_1(fpscr_setbit, void, i32) @@ -53,6 +61,9 @@ DEF_HELPER_1(fpscr_setbit, void, i32)
53 DEF_HELPER_1(float64_to_float32, i32, i64) 61 DEF_HELPER_1(float64_to_float32, i32, i64)
54 DEF_HELPER_1(float32_to_float64, i64, i32) 62 DEF_HELPER_1(float32_to_float64, i64, i32)
55 63
  64 +DEF_HELPER_2(fcmpo, i32, i64, i64)
  65 +DEF_HELPER_2(fcmpu, i32, i64, i64)
  66 +
56 DEF_HELPER_1(fctiw, i64, i64) 67 DEF_HELPER_1(fctiw, i64, i64)
57 DEF_HELPER_1(fctiwz, i64, i64) 68 DEF_HELPER_1(fctiwz, i64, i64)
58 #if defined(TARGET_PPC64) 69 #if defined(TARGET_PPC64)
target-ppc/op.c
@@ -259,26 +259,6 @@ void OPPROTO op_srli_T1 (void) @@ -259,26 +259,6 @@ void OPPROTO op_srli_T1 (void)
259 259
260 /* Return from interrupt */ 260 /* Return from interrupt */
261 #if !defined(CONFIG_USER_ONLY) 261 #if !defined(CONFIG_USER_ONLY)
262 -void OPPROTO op_rfi (void)  
263 -{  
264 - do_rfi();  
265 - RETURN();  
266 -}  
267 -  
268 -#if defined(TARGET_PPC64)  
269 -void OPPROTO op_rfid (void)  
270 -{  
271 - do_rfid();  
272 - RETURN();  
273 -}  
274 -  
275 -void OPPROTO op_hrfid (void)  
276 -{  
277 - do_hrfid();  
278 - RETURN();  
279 -}  
280 -#endif  
281 -  
282 /* Exception vectors */ 262 /* Exception vectors */
283 void OPPROTO op_store_excp_prefix (void) 263 void OPPROTO op_store_excp_prefix (void)
284 { 264 {
@@ -637,12 +617,6 @@ void OPPROTO op_POWER_rac (void) @@ -637,12 +617,6 @@ void OPPROTO op_POWER_rac (void)
637 do_POWER_rac(); 617 do_POWER_rac();
638 RETURN(); 618 RETURN();
639 } 619 }
640 -  
641 -void OPPROTO op_POWER_rfsvc (void)  
642 -{  
643 - do_POWER_rfsvc();  
644 - RETURN();  
645 -}  
646 #endif 620 #endif
647 621
648 /* PowerPC 4xx specific micro-ops */ 622 /* PowerPC 4xx specific micro-ops */
@@ -659,33 +633,6 @@ void OPPROTO op_store_dcr (void) @@ -659,33 +633,6 @@ void OPPROTO op_store_dcr (void)
659 } 633 }
660 634
661 #if !defined(CONFIG_USER_ONLY) 635 #if !defined(CONFIG_USER_ONLY)
662 -/* Return from critical interrupt :  
663 - * same as rfi, except nip & MSR are loaded from SRR2/3 instead of SRR0/1  
664 - */  
665 -void OPPROTO op_40x_rfci (void)  
666 -{  
667 - do_40x_rfci();  
668 - RETURN();  
669 -}  
670 -  
671 -void OPPROTO op_rfci (void)  
672 -{  
673 - do_rfci();  
674 - RETURN();  
675 -}  
676 -  
677 -void OPPROTO op_rfdi (void)  
678 -{  
679 - do_rfdi();  
680 - RETURN();  
681 -}  
682 -  
683 -void OPPROTO op_rfmci (void)  
684 -{  
685 - do_rfmci();  
686 - RETURN();  
687 -}  
688 -  
689 void OPPROTO op_wrte (void) 636 void OPPROTO op_wrte (void)
690 { 637 {
691 /* We don't call do_store_msr here as we won't trigger 638 /* We don't call do_store_msr here as we won't trigger
target-ppc/op_helper.c
@@ -1618,7 +1618,7 @@ void do_store_msr (void) @@ -1618,7 +1618,7 @@ void do_store_msr (void)
1618 } 1618 }
1619 } 1619 }
1620 1620
1621 -static always_inline void __do_rfi (target_ulong nip, target_ulong msr, 1621 +static always_inline void do_rfi (target_ulong nip, target_ulong msr,
1622 target_ulong msrm, int keep_msrh) 1622 target_ulong msrm, int keep_msrh)
1623 { 1623 {
1624 #if defined(TARGET_PPC64) 1624 #if defined(TARGET_PPC64)
@@ -1647,23 +1647,23 @@ static always_inline void __do_rfi (target_ulong nip, target_ulong msr, @@ -1647,23 +1647,23 @@ static always_inline void __do_rfi (target_ulong nip, target_ulong msr,
1647 env->interrupt_request |= CPU_INTERRUPT_EXITTB; 1647 env->interrupt_request |= CPU_INTERRUPT_EXITTB;
1648 } 1648 }
1649 1649
1650 -void do_rfi (void) 1650 +void helper_rfi (void)
1651 { 1651 {
1652 - __do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],  
1653 - ~((target_ulong)0xFFFF0000), 1); 1652 + do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],
  1653 + ~((target_ulong)0xFFFF0000), 1);
1654 } 1654 }
1655 1655
1656 #if defined(TARGET_PPC64) 1656 #if defined(TARGET_PPC64)
1657 -void do_rfid (void) 1657 +void helper_rfid (void)
1658 { 1658 {
1659 - __do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],  
1660 - ~((target_ulong)0xFFFF0000), 0); 1659 + do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],
  1660 + ~((target_ulong)0xFFFF0000), 0);
1661 } 1661 }
1662 1662
1663 -void do_hrfid (void) 1663 +void helper_hrfid (void)
1664 { 1664 {
1665 - __do_rfi(env->spr[SPR_HSRR0], env->spr[SPR_HSRR1],  
1666 - ~((target_ulong)0xFFFF0000), 0); 1665 + do_rfi(env->spr[SPR_HSRR0], env->spr[SPR_HSRR1],
  1666 + ~((target_ulong)0xFFFF0000), 0);
1667 } 1667 }
1668 #endif 1668 #endif
1669 #endif 1669 #endif
@@ -1859,9 +1859,9 @@ void do_POWER_rac (void) @@ -1859,9 +1859,9 @@ void do_POWER_rac (void)
1859 env->nb_BATs = nb_BATs; 1859 env->nb_BATs = nb_BATs;
1860 } 1860 }
1861 1861
1862 -void do_POWER_rfsvc (void) 1862 +void helper_rfsvc (void)
1863 { 1863 {
1864 - __do_rfi(env->lr, env->ctr, 0x0000FFFF, 0); 1864 + do_rfi(env->lr, env->ctr, 0x0000FFFF, 0);
1865 } 1865 }
1866 1866
1867 void do_store_hid0_601 (void) 1867 void do_store_hid0_601 (void)
@@ -1959,28 +1959,28 @@ void do_store_dcr (void) @@ -1959,28 +1959,28 @@ void do_store_dcr (void)
1959 } 1959 }
1960 1960
1961 #if !defined(CONFIG_USER_ONLY) 1961 #if !defined(CONFIG_USER_ONLY)
1962 -void do_40x_rfci (void) 1962 +void helper_40x_rfci (void)
1963 { 1963 {
1964 - __do_rfi(env->spr[SPR_40x_SRR2], env->spr[SPR_40x_SRR3],  
1965 - ~((target_ulong)0xFFFF0000), 0); 1964 + do_rfi(env->spr[SPR_40x_SRR2], env->spr[SPR_40x_SRR3],
  1965 + ~((target_ulong)0xFFFF0000), 0);
1966 } 1966 }
1967 1967
1968 -void do_rfci (void) 1968 +void helper_rfci (void)
1969 { 1969 {
1970 - __do_rfi(env->spr[SPR_BOOKE_CSRR0], SPR_BOOKE_CSRR1,  
1971 - ~((target_ulong)0x3FFF0000), 0); 1970 + do_rfi(env->spr[SPR_BOOKE_CSRR0], SPR_BOOKE_CSRR1,
  1971 + ~((target_ulong)0x3FFF0000), 0);
1972 } 1972 }
1973 1973
1974 -void do_rfdi (void) 1974 +void helper_rfdi (void)
1975 { 1975 {
1976 - __do_rfi(env->spr[SPR_BOOKE_DSRR0], SPR_BOOKE_DSRR1,  
1977 - ~((target_ulong)0x3FFF0000), 0); 1976 + do_rfi(env->spr[SPR_BOOKE_DSRR0], SPR_BOOKE_DSRR1,
  1977 + ~((target_ulong)0x3FFF0000), 0);
1978 } 1978 }
1979 1979
1980 -void do_rfmci (void) 1980 +void helper_rfmci (void)
1981 { 1981 {
1982 - __do_rfi(env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1,  
1983 - ~((target_ulong)0x3FFF0000), 0); 1982 + do_rfi(env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1,
  1983 + ~((target_ulong)0x3FFF0000), 0);
1984 } 1984 }
1985 1985
1986 void do_load_403_pb (int num) 1986 void do_load_403_pb (int num)
target-ppc/op_helper.h
@@ -21,8 +21,6 @@ @@ -21,8 +21,6 @@
21 void do_print_mem_EA (target_ulong EA); 21 void do_print_mem_EA (target_ulong EA);
22 22
23 /* Registers load and stores */ 23 /* Registers load and stores */
24 -void do_load_cr (void);  
25 -void do_store_cr (uint32_t mask);  
26 #if defined(TARGET_PPC64) 24 #if defined(TARGET_PPC64)
27 void do_store_pri (int prio); 25 void do_store_pri (int prio);
28 #endif 26 #endif
@@ -32,11 +30,6 @@ void ppc_store_dump_spr (int sprn, target_ulong val); @@ -32,11 +30,6 @@ void ppc_store_dump_spr (int sprn, target_ulong val);
32 /* Misc */ 30 /* Misc */
33 #if !defined(CONFIG_USER_ONLY) 31 #if !defined(CONFIG_USER_ONLY)
34 void do_store_msr (void); 32 void do_store_msr (void);
35 -void do_rfi (void);  
36 -#if defined(TARGET_PPC64)  
37 -void do_rfid (void);  
38 -void do_hrfid (void);  
39 -#endif  
40 #endif 33 #endif
41 34
42 /* POWER / PowerPC 601 specific helpers */ 35 /* POWER / PowerPC 601 specific helpers */
@@ -51,7 +44,6 @@ void do_POWER_maskg (void); @@ -51,7 +44,6 @@ void do_POWER_maskg (void);
51 void do_POWER_mulo (void); 44 void do_POWER_mulo (void);
52 #if !defined(CONFIG_USER_ONLY) 45 #if !defined(CONFIG_USER_ONLY)
53 void do_POWER_rac (void); 46 void do_POWER_rac (void);
54 -void do_POWER_rfsvc (void);  
55 void do_store_hid0_601 (void); 47 void do_store_hid0_601 (void);
56 #endif 48 #endif
57 49
@@ -65,10 +57,6 @@ void do_440_tlbwe (int word); @@ -65,10 +57,6 @@ void do_440_tlbwe (int word);
65 void do_load_dcr (void); 57 void do_load_dcr (void);
66 void do_store_dcr (void); 58 void do_store_dcr (void);
67 #if !defined(CONFIG_USER_ONLY) 59 #if !defined(CONFIG_USER_ONLY)
68 -void do_40x_rfci (void);  
69 -void do_rfci (void);  
70 -void do_rfdi (void);  
71 -void do_rfmci (void);  
72 void do_4xx_tlbre_lo (void); 60 void do_4xx_tlbre_lo (void);
73 void do_4xx_tlbre_hi (void); 61 void do_4xx_tlbre_hi (void);
74 void do_4xx_tlbwe_lo (void); 62 void do_4xx_tlbwe_lo (void);
target-ppc/translate.c
@@ -3732,7 +3732,7 @@ GEN_HANDLER(rfi, 0x13, 0x12, 0x01, 0x03FF8001, PPC_FLOW) @@ -3732,7 +3732,7 @@ GEN_HANDLER(rfi, 0x13, 0x12, 0x01, 0x03FF8001, PPC_FLOW)
3732 GEN_EXCP_PRIVOPC(ctx); 3732 GEN_EXCP_PRIVOPC(ctx);
3733 return; 3733 return;
3734 } 3734 }
3735 - gen_op_rfi(); 3735 + gen_helper_rfi();
3736 GEN_SYNC(ctx); 3736 GEN_SYNC(ctx);
3737 #endif 3737 #endif
3738 } 3738 }
@@ -3748,7 +3748,7 @@ GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_64B) @@ -3748,7 +3748,7 @@ GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_64B)
3748 GEN_EXCP_PRIVOPC(ctx); 3748 GEN_EXCP_PRIVOPC(ctx);
3749 return; 3749 return;
3750 } 3750 }
3751 - gen_op_rfid(); 3751 + gen_helper_rfid();
3752 GEN_SYNC(ctx); 3752 GEN_SYNC(ctx);
3753 #endif 3753 #endif
3754 } 3754 }
@@ -3763,7 +3763,7 @@ GEN_HANDLER(hrfid, 0x13, 0x12, 0x08, 0x03FF8001, PPC_64H) @@ -3763,7 +3763,7 @@ GEN_HANDLER(hrfid, 0x13, 0x12, 0x08, 0x03FF8001, PPC_64H)
3763 GEN_EXCP_PRIVOPC(ctx); 3763 GEN_EXCP_PRIVOPC(ctx);
3764 return; 3764 return;
3765 } 3765 }
3766 - gen_op_hrfid(); 3766 + gen_helper_hrfid();
3767 GEN_SYNC(ctx); 3767 GEN_SYNC(ctx);
3768 #endif 3768 #endif
3769 } 3769 }
@@ -4964,7 +4964,7 @@ GEN_HANDLER(rfsvc, 0x13, 0x12, 0x02, 0x03FFF0001, PPC_POWER) @@ -4964,7 +4964,7 @@ GEN_HANDLER(rfsvc, 0x13, 0x12, 0x02, 0x03FFF0001, PPC_POWER)
4964 GEN_EXCP_PRIVOPC(ctx); 4964 GEN_EXCP_PRIVOPC(ctx);
4965 return; 4965 return;
4966 } 4966 }
4967 - gen_op_POWER_rfsvc(); 4967 + gen_helper_rfsvc();
4968 GEN_SYNC(ctx); 4968 GEN_SYNC(ctx);
4969 #endif 4969 #endif
4970 } 4970 }
@@ -5508,7 +5508,7 @@ GEN_HANDLER2(rfci_40x, &quot;rfci&quot;, 0x13, 0x13, 0x01, 0x03FF8001, PPC_40x_EXCP) @@ -5508,7 +5508,7 @@ GEN_HANDLER2(rfci_40x, &quot;rfci&quot;, 0x13, 0x13, 0x01, 0x03FF8001, PPC_40x_EXCP)
5508 return; 5508 return;
5509 } 5509 }
5510 /* Restore CPU state */ 5510 /* Restore CPU state */
5511 - gen_op_40x_rfci(); 5511 + gen_helper_40x_rfci();
5512 GEN_SYNC(ctx); 5512 GEN_SYNC(ctx);
5513 #endif 5513 #endif
5514 } 5514 }
@@ -5523,7 +5523,7 @@ GEN_HANDLER(rfci, 0x13, 0x13, 0x01, 0x03FF8001, PPC_BOOKE) @@ -5523,7 +5523,7 @@ GEN_HANDLER(rfci, 0x13, 0x13, 0x01, 0x03FF8001, PPC_BOOKE)
5523 return; 5523 return;
5524 } 5524 }
5525 /* Restore CPU state */ 5525 /* Restore CPU state */
5526 - gen_op_rfci(); 5526 + gen_helper_rfci();
5527 GEN_SYNC(ctx); 5527 GEN_SYNC(ctx);
5528 #endif 5528 #endif
5529 } 5529 }
@@ -5540,7 +5540,7 @@ GEN_HANDLER(rfdi, 0x13, 0x07, 0x01, 0x03FF8001, PPC_RFDI) @@ -5540,7 +5540,7 @@ GEN_HANDLER(rfdi, 0x13, 0x07, 0x01, 0x03FF8001, PPC_RFDI)
5540 return; 5540 return;
5541 } 5541 }
5542 /* Restore CPU state */ 5542 /* Restore CPU state */
5543 - gen_op_rfdi(); 5543 + gen_helper_rfdi();
5544 GEN_SYNC(ctx); 5544 GEN_SYNC(ctx);
5545 #endif 5545 #endif
5546 } 5546 }
@@ -5556,7 +5556,7 @@ GEN_HANDLER(rfmci, 0x13, 0x06, 0x01, 0x03FF8001, PPC_RFMCI) @@ -5556,7 +5556,7 @@ GEN_HANDLER(rfmci, 0x13, 0x06, 0x01, 0x03FF8001, PPC_RFMCI)
5556 return; 5556 return;
5557 } 5557 }
5558 /* Restore CPU state */ 5558 /* Restore CPU state */
5559 - gen_op_rfmci(); 5559 + gen_helper_rfmci();
5560 GEN_SYNC(ctx); 5560 GEN_SYNC(ctx);
5561 #endif 5561 #endif
5562 } 5562 }