[PATCH 10/61] target/arm: Use raw_write in cp_reg_reset

Richard Henderson posted 61 patches 1 month ago
[PATCH 10/61] target/arm: Use raw_write in cp_reg_reset
Posted by Richard Henderson 1 month ago
Reduce the places that know about field types by 1.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/cpu.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index e2b2337399..ed40e102fc 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -192,14 +192,8 @@ static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque)
      * This is basically only used for fields in non-core coprocessors
      * (like the pxa2xx ones).
      */
-    if (!ri->fieldoffset) {
-        return;
-    }
-
-    if (cpreg_field_is_64bit(ri)) {
-        CPREG_FIELD64(&cpu->env, ri) = ri->resetvalue;
-    } else {
-        CPREG_FIELD32(&cpu->env, ri) = ri->resetvalue;
+    if (ri->fieldoffset) {
+        raw_write(&cpu->env, ri, ri->resetvalue);
     }
 }
 
-- 
2.43.0
Re: [PATCH 10/61] target/arm: Use raw_write in cp_reg_reset
Posted by Manos Pitsidianakis 1 month ago
On Wed, 27 Aug 2025 04:04, Richard Henderson <richard.henderson@linaro.org> wrote:
>Reduce the places that know about field types by 1.
>
>Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>---


Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

> target/arm/cpu.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
>diff --git a/target/arm/cpu.c b/target/arm/cpu.c
>index e2b2337399..ed40e102fc 100644
>--- a/target/arm/cpu.c
>+++ b/target/arm/cpu.c
>@@ -192,14 +192,8 @@ static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque)
>      * This is basically only used for fields in non-core coprocessors
>      * (like the pxa2xx ones).
>      */
>-    if (!ri->fieldoffset) {
>-        return;
>-    }
>-
>-    if (cpreg_field_is_64bit(ri)) {
>-        CPREG_FIELD64(&cpu->env, ri) = ri->resetvalue;
>-    } else {
>-        CPREG_FIELD32(&cpu->env, ri) = ri->resetvalue;
>+    if (ri->fieldoffset) {
>+        raw_write(&cpu->env, ri, ri->resetvalue);
>     }
> }
> 
>-- 
>2.43.0
>
>