@@ -7390,7 +7390,6 @@ static ARMCPRegInfo *alloc_cpreg(const ARMCPRegInfo *in, const char *suffix)
73907390 */
73917391static void add_cpreg_to_hashtable (ARMCPU * cpu , ARMCPRegInfo * r ,
73927392 CPState state , CPSecureState secstate ,
7393- int cp , int crm , int opc1 , int opc2 ,
73947393 uint32_t key )
73957394{
73967395 CPUARMState * env = & cpu -> env ;
@@ -7457,12 +7456,8 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, ARMCPRegInfo *r,
74577456
74587457 /*
74597458 * Update fields to match the instantiation, overwiting wildcards
7460- * such as CP_ANY, ARM_CP_STATE_BOTH, or ARM_CP_SECSTATE_BOTH.
7459+ * such as ARM_CP_STATE_BOTH or ARM_CP_SECSTATE_BOTH.
74617460 */
7462- r -> cp = cp ;
7463- r -> crm = crm ;
7464- r -> opc1 = opc1 ;
7465- r -> opc2 = opc2 ;
74667461 r -> state = state ;
74677462 r -> secure = secstate ;
74687463
@@ -7478,16 +7473,16 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, ARMCPRegInfo *r,
74787473 g_hash_table_insert (cpu -> cp_regs , (gpointer )(uintptr_t )key , r );
74797474}
74807475
7481- static void add_cpreg_to_hashtable_aa32 (ARMCPU * cpu , ARMCPRegInfo * r ,
7482- int cp , int crm , int opc1 , int opc2 )
7476+ static void add_cpreg_to_hashtable_aa32 (ARMCPU * cpu , ARMCPRegInfo * r )
74837477{
74847478 /*
74857479 * Under AArch32 CP registers can be common
74867480 * (same for secure and non-secure world) or banked.
74877481 */
74887482 ARMCPRegInfo * r_s ;
74897483 bool is64 = r -> type & ARM_CP_64BIT ;
7490- uint32_t key = ENCODE_CP_REG (cp , is64 , 0 , r -> crn , crm , opc1 , opc2 );
7484+ uint32_t key = ENCODE_CP_REG (r -> cp , is64 , 0 , r -> crn ,
7485+ r -> crm , r -> opc1 , r -> opc2 );
74917486
74927487 assert (!(r -> type & ARM_CP_ADD_TLBI_NXS )); /* aa64 only */
74937488
@@ -7496,27 +7491,26 @@ static void add_cpreg_to_hashtable_aa32(ARMCPU *cpu, ARMCPRegInfo *r,
74967491 key |= CP_REG_AA32_NS_MASK ;
74977492 /* fall through */
74987493 case ARM_CP_SECSTATE_S :
7499- add_cpreg_to_hashtable (cpu , r , ARM_CP_STATE_AA32 , r -> secure ,
7500- cp , crm , opc1 , opc2 , key );
7494+ add_cpreg_to_hashtable (cpu , r , ARM_CP_STATE_AA32 , r -> secure , key );
75017495 break ;
75027496 case ARM_CP_SECSTATE_BOTH :
75037497 r_s = alloc_cpreg (r , "_S" );
7504- add_cpreg_to_hashtable (cpu , r_s , ARM_CP_STATE_AA32 , ARM_CP_SECSTATE_S ,
7505- cp , crm , opc1 , opc2 , key );
7498+ add_cpreg_to_hashtable (cpu , r_s , ARM_CP_STATE_AA32 ,
7499+ ARM_CP_SECSTATE_S , key );
75067500
75077501 key |= CP_REG_AA32_NS_MASK ;
7508- add_cpreg_to_hashtable (cpu , r , ARM_CP_STATE_AA32 , ARM_CP_SECSTATE_NS ,
7509- cp , crm , opc1 , opc2 , key );
7502+ add_cpreg_to_hashtable (cpu , r , ARM_CP_STATE_AA32 ,
7503+ ARM_CP_SECSTATE_NS , key );
75107504 break ;
75117505 default :
75127506 g_assert_not_reached ();
75137507 }
75147508}
75157509
7516- static void add_cpreg_to_hashtable_aa64 (ARMCPU * cpu , ARMCPRegInfo * r ,
7517- int crm , int opc1 , int opc2 )
7510+ static void add_cpreg_to_hashtable_aa64 (ARMCPU * cpu , ARMCPRegInfo * r )
75187511{
7519- uint32_t key = ENCODE_AA64_CP_REG (r -> opc0 , opc1 , r -> crn , crm , opc2 );
7512+ uint32_t key = ENCODE_AA64_CP_REG (r -> opc0 , r -> opc1 ,
7513+ r -> crn , r -> crm , r -> opc2 );
75207514
75217515 if ((r -> type & ARM_CP_ADD_TLBI_NXS ) &&
75227516 cpu_isar_feature (aa64_xs , cpu )) {
@@ -7542,12 +7536,11 @@ static void add_cpreg_to_hashtable_aa64(ARMCPU *cpu, ARMCPRegInfo *r,
75427536 }
75437537
75447538 add_cpreg_to_hashtable (cpu , nxs_ri , ARM_CP_STATE_AA64 ,
7545- ARM_CP_SECSTATE_NS , 0 , crm , opc1 , opc2 ,
7546- nxs_key );
7539+ ARM_CP_SECSTATE_NS , nxs_key );
75477540 }
75487541
7549- add_cpreg_to_hashtable (cpu , r , ARM_CP_STATE_AA64 , ARM_CP_SECSTATE_NS ,
7550- 0 , crm , opc1 , opc2 , key );
7542+ add_cpreg_to_hashtable (cpu , r , ARM_CP_STATE_AA64 ,
7543+ ARM_CP_SECSTATE_NS , key );
75517544}
75527545
75537546void define_one_arm_cp_reg (ARMCPU * cpu , const ARMCPRegInfo * r )
@@ -7767,17 +7760,24 @@ void define_one_arm_cp_reg(ARMCPU *cpu, const ARMCPRegInfo *r)
77677760 r2 -> type |= ARM_CP_ALIAS | ARM_CP_NO_GDB ;
77687761 }
77697762
7763+ /* Overwrite CP_ANY with the instantiation. */
7764+ r2 -> crm = crm ;
7765+ r2 -> opc1 = opc1 ;
7766+ r2 -> opc2 = opc2 ;
7767+
77707768 switch (r -> state ) {
77717769 case ARM_CP_STATE_AA32 :
7772- add_cpreg_to_hashtable_aa32 (cpu , r2 , cp , crm , opc1 , opc2 );
7770+ add_cpreg_to_hashtable_aa32 (cpu , r2 );
77737771 break ;
77747772 case ARM_CP_STATE_AA64 :
7775- add_cpreg_to_hashtable_aa64 (cpu , r2 , crm , opc1 , opc2 );
7773+ add_cpreg_to_hashtable_aa64 (cpu , r2 );
77767774 break ;
77777775 case ARM_CP_STATE_BOTH :
77787776 r3 = alloc_cpreg (r2 , NULL );
7779- add_cpreg_to_hashtable_aa32 (cpu , r2 , cp , crm , opc1 , opc2 );
7780- add_cpreg_to_hashtable_aa64 (cpu , r3 , crm , opc1 , opc2 );
7777+ r2 -> cp = cp ;
7778+ add_cpreg_to_hashtable_aa32 (cpu , r2 );
7779+ r3 -> cp = 0 ;
7780+ add_cpreg_to_hashtable_aa64 (cpu , r3 );
77817781 break ;
77827782 default :
77837783 g_assert_not_reached ();
0 commit comments