ppc403: load/store pb
RFC 1/1 ppc403: load/store pb
Add TCG variables for 403's pb registers.
Replace op_load_403_pb with tcg_gen_mov_tl.
Convert do_store_403_pb to a TCG helper.
Signed-off-by Andreas Faerber <[email protected]>
---
This is not yet compile-tested.
No problematic dyngen ops seem to remain inside translate.c, but
some more are used from translate_init.c.
Some more similar conversions are coming up, so please let me know
if I got this wrong again.
Andreas
target-ppc/helper.h +4 -0
@@ -202,4 +202,8 @@ DEF_HELPER_2(divso, tl, tl, tl)DEF_HELPER_1 (load_dcr, tl, tl);DEF_HELPER_2 (store_dcr, void, tl, tl); +#if !defined(CONFIG_USER_ONLY ) +DEF_HELPER_2 (store_403_pb, void, i32, tl); +#endif +#include "def-helper.h"
target-ppc/op.c +0 -12
@@ -269,18 +269,6 @@ void OPPROTO op_store_pir (void)RETURN (); } -void OPPROTO op_load_403_pb (void) -{ -do_load_403_pb (PARAM1 ); -RETURN (); -} - -void OPPROTO op_store_403_pb (void) -{ -do_store_403_pb (PARAM1 ); -RETURN (); -} - void OPPROTO op_load_40x_pit (void) {T0 =load_40x_pit (env);
target-ppc/op_helper.c +3 -8
@@ -1818,15 +1818,10 @@ void helper_rfmci (void) ~((target_ulong)0x3FFF0000), 0); } -void do_load_403_pb (int num) +void helper_store_403_pb (uint32_t num,target_ulong value) { -T0 = env->pb[num]; -} - -void do_store_403_pb (int num) -{ -if (likely (env->pb[num] !=T0 )) { - env->pb[num] =T0 ; +if (likely (env->pb[num] != value)) { + env->pb[num] = value;/* Should be optimized */ tlb_flush (env,1 ); }
target-ppc/op_helper.h +0 -6
@@ -30,9 +30,3 @@ void ppc_store_dump_spr (int sprn, target_ulong val);#if !defined(CONFIG_USER_ONLY )void do_store_hid0_601 (void );#endif - -/* PowerPC 403 specific helpers */ -#if !defined(CONFIG_USER_ONLY ) -void do_load_403_pb (int num); -void do_store_403_pb (int num); -#endif
target-ppc/translate.c +10 -1
@@ -54,7 +54,8 @@ static char cpu_reg_names[10*3 + 22*4 /* GPR */#endif +10 *4 +22 *5 /* FPR */ +2 *(10 *6 +22 *7 )/* AVRh, AVRl */ - + 8*5 /* CRF */]; + +8 *5 /* CRF */ + + 4*4 /* PB */];static TCGv cpu_gpr[32 ];#if !defined(TARGET_PPC64 )static TCGv cpu_gprh[32 ];
@@ -62,6 +63,7 @@ static TCGv cpu_gprh[32];static TCGv_i64 cpu_fpr[32 ];static TCGv_i64 cpu_avrh[32 ], cpu_avrl[32 ];static TCGv_i32 cpu_crf[8 ]; +static TCGv cpu_pb[4 ];static TCGv cpu_nip;static TCGv cpu_msr;static TCGv cpu_ctr;
@@ -101,6 +103,13 @@ void ppc_translate_init(void) p +=5 ; } +for (i =0 ; i <4 ; i++) { +sprintf (p,"pb%d" , i); + cpu_pb[i] =tcg_global_mem_new (TCG_AREG0 , + offsetof(CPUState, pb[i]), p); + p +=4 ; + } +for (i =0 ; i <32 ; i++) {sprintf (p,"r%d" , i); cpu_gpr[i] = tcg_global_mem_new(TCG_AREG0,
target-ppc/translate_init.c +2 -2
@@ -386,12 +386,12 @@ static void spr_write_booke_tsr (void *opaque, int sprn)#if !defined(CONFIG_USER_ONLY )static void spr_read_403_pbr (void *opaque,int sprn) { -gen_op_load_403_pb (sprn -SPR_403_PBL1 ); +tcg_gen_mov_tl (cpu_T[0 ], cpu_pb[sprn -SPR_403_PBL1 ]); }static void spr_write_403_pbr (void *opaque,int sprn) { -gen_op_store_403_pb (sprn -SPR_403_PBL1 ); +gen_helper_store_403_pb (sprn -SPR_403_PBL1 , cpu_T[0 ]); }static void spr_write_pir (void *opaque,int sprn)
target-ppc/helper.h +4 -0
@@ -202,4 +202,8 @@ DEF_HELPER_2(divso, tl, tl, tl)DEF_HELPER_1 (load_dcr, tl, tl);DEF_HELPER_2 (store_dcr, void, tl, tl); +#if !defined(CONFIG_USER_ONLY ) +DEF_HELPER_2 (store_403_pb, void, i32, tl); +#endif +#include "def-helper.h"
target-ppc/op.c +0 -12
@@ -269,18 +269,6 @@ void OPPROTO op_store_pir (void)RETURN (); } -void OPPROTO op_load_403_pb (void) -{ -do_load_403_pb (PARAM1 ); -RETURN (); -} - -void OPPROTO op_store_403_pb (void) -{ -do_store_403_pb (PARAM1 ); -RETURN (); -} - void OPPROTO op_load_40x_pit (void) {T0 =load_40x_pit (env);
target-ppc/op_helper.c +3 -8
@@ -1818,15 +1818,10 @@ void helper_rfmci (void) ~((target_ulong)0x3FFF0000), 0); } -void do_load_403_pb (int num) +void helper_store_403_pb (uint32_t num,target_ulong value) { -T0 = env->pb[num]; -} - -void do_store_403_pb (int num) -{ -if (likely (env->pb[num] !=T0 )) { - env->pb[num] =T0 ; +if (likely (env->pb[num] != value)) { + env->pb[num] = value;/* Should be optimized */ tlb_flush (env,1 ); }
target-ppc/op_helper.h +0 -6
@@ -30,9 +30,3 @@ void ppc_store_dump_spr (int sprn, target_ulong val);#if !defined(CONFIG_USER_ONLY )void do_store_hid0_601 (void );#endif - -/* PowerPC 403 specific helpers */ -#if !defined(CONFIG_USER_ONLY ) -void do_load_403_pb (int num); -void do_store_403_pb (int num); -#endif
target-ppc/translate.c +10 -1
@@ -54,7 +54,8 @@ static char cpu_reg_names[10*3 + 22*4 /* GPR */#endif +10 *4 +22 *5 /* FPR */ +2 *(10 *6 +22 *7 )/* AVRh, AVRl */ - + 8*5 /* CRF */]; + +8 *5 /* CRF */ + + 4*4 /* PB */];static TCGv cpu_gpr[32 ];#if !defined(TARGET_PPC64 )static TCGv cpu_gprh[32 ];
@@ -62,6 +63,7 @@ static TCGv cpu_gprh[32];static TCGv_i64 cpu_fpr[32 ];static TCGv_i64 cpu_avrh[32 ], cpu_avrl[32 ];static TCGv_i32 cpu_crf[8 ]; +static TCGv cpu_pb[4 ];static TCGv cpu_nip;static TCGv cpu_msr;static TCGv cpu_ctr;
@@ -101,6 +103,13 @@ void ppc_translate_init(void) p +=5 ; } +for (i =0 ; i <4 ; i++) { +sprintf (p,"pb%d" , i); + cpu_pb[i] =tcg_global_mem_new (TCG_AREG0 , + offsetof(CPUState, pb[i]), p); + p +=4 ; + } +for (i =0 ; i <32 ; i++) {sprintf (p,"r%d" , i); cpu_gpr[i] = tcg_global_mem_new(TCG_AREG0,
target-ppc/translate_init.c +2 -2
@@ -386,12 +386,12 @@ static void spr_write_booke_tsr (void *opaque, int sprn)#if !defined(CONFIG_USER_ONLY )static void spr_read_403_pbr (void *opaque,int sprn) { -gen_op_load_403_pb (sprn -SPR_403_PBL1 ); +tcg_gen_mov_tl (cpu_T[0 ], cpu_pb[sprn -SPR_403_PBL1 ]); }static void spr_write_403_pbr (void *opaque,int sprn) { -gen_op_store_403_pb (sprn -SPR_403_PBL1 ); +gen_helper_store_403_pb (sprn -SPR_403_PBL1 , cpu_T[0 ]); }static void spr_write_pir (void *opaque,int sprn)
Quoted 4 lines · Andreas Färber
Add TCG variables for 403's pb registers.
Replace
op_load_403_pbwithtcg_gen_mov_tl.
Convertdo_store_403_pbto a TCG helper.
I have committed a different patch that finishes the TCG conversion of the PowerPC target.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net