[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/23] target/arm: Consolidate cpreg updates in add_cpreg_to_hasht
From: |
Peter Maydell |
Subject: |
[PULL 15/23] target/arm: Consolidate cpreg updates in add_cpreg_to_hashtable |
Date: |
Thu, 5 May 2022 10:11:39 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Put most of the value writeback to the same place,
and improve the comment that goes with them.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220501055028.646596-15-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/helper.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index cbc873e3e60..8ee96d5c042 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -8543,10 +8543,19 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const
ARMCPRegInfo *r,
*r2 = *r;
r2->name = memcpy(r2 + 1, name, name_len);
- /* Reset the secure state to the specific incoming state. This is
- * necessary as the register may have been defined with both states.
+ /*
+ * Update fields to match the instantiation, overwiting wildcards
+ * such as CP_ANY, ARM_CP_STATE_BOTH, or ARM_CP_SECSTATE_BOTH.
*/
+ r2->cp = cp;
+ r2->crm = crm;
+ r2->opc1 = opc1;
+ r2->opc2 = opc2;
+ r2->state = state;
r2->secure = secstate;
+ if (opaque) {
+ r2->opaque = opaque;
+ }
if (r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1]) {
/* Register is banked (using both entries in array).
@@ -8587,20 +8596,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const
ARMCPRegInfo *r,
#endif
}
}
- if (opaque) {
- r2->opaque = opaque;
- }
- /* reginfo passed to helpers is correct for the actual access,
- * and is never ARM_CP_STATE_BOTH:
- */
- r2->state = state;
- /* Make sure reginfo passed to helpers for wildcarded regs
- * has the correct crm/opc1/opc2 for this reg, not CP_ANY:
- */
- r2->cp = cp;
- r2->crm = crm;
- r2->opc1 = opc1;
- r2->opc2 = opc2;
+
/* By convention, for wildcarded registers only the first
* entry is used for migration; the others are marked as
* ALIAS so we don't try to transfer the register
--
2.25.1
- [PULL 03/23] target/arm: Reorg CPAccessResult and access_check_cp_reg, (continued)
- [PULL 03/23] target/arm: Reorg CPAccessResult and access_check_cp_reg, Peter Maydell, 2022/05/05
- [PULL 02/23] target/arm: Split out cpregs.h, Peter Maydell, 2022/05/05
- [PULL 05/23] target/arm: Make some more cpreg data static const, Peter Maydell, 2022/05/05
- [PULL 06/23] target/arm: Reorg ARMCPRegInfo type field bits, Peter Maydell, 2022/05/05
- [PULL 08/23] target/arm: Change cpreg access permissions to enum, Peter Maydell, 2022/05/05
- [PULL 07/23] target/arm: Avoid bare abort() or assert(0), Peter Maydell, 2022/05/05
- [PULL 10/23] target/arm: Name CPSecureState type, Peter Maydell, 2022/05/05
- [PULL 09/23] target/arm: Name CPState type, Peter Maydell, 2022/05/05
- [PULL 04/23] target/arm: Replace sentinels with ARRAY_SIZE in cpregs.h, Peter Maydell, 2022/05/05
- [PULL 13/23] target/arm: Merge allocation of the cpreg and its name, Peter Maydell, 2022/05/05
- [PULL 15/23] target/arm: Consolidate cpreg updates in add_cpreg_to_hashtable,
Peter Maydell <=
- [PULL 11/23] target/arm: Drop always-true test in define_arm_vh_e2h_redirects_aliases, Peter Maydell, 2022/05/05
- [PULL 17/23] target/arm: Hoist isbanked computation in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 18/23] target/arm: Perform override check early in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 19/23] target/arm: Reformat comments in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 12/23] target/arm: Store cpregs key in the hash table directly, Peter Maydell, 2022/05/05
- [PULL 14/23] target/arm: Hoist computation of key in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 16/23] target/arm: Use bool for is64 and ns in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 20/23] target/arm: Remove HOST_BIG_ENDIAN ifdef in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 22/23] target/arm: Add isar_feature_{aa64,any}_ras, Peter Maydell, 2022/05/05
- [PULL 23/23] target/arm: read access to performance counters from EL0, Peter Maydell, 2022/05/05