In case a cpreg is hidden, skip it when initialing the cpreg
list.

Signed-off-by: Eric Auger <[email protected]>
---
 target/arm/helper.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 27ebc6f29b..7e34b4803d 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -236,8 +236,11 @@ static void add_cpreg_to_list(gpointer key, gpointer 
value, gpointer opaque)
     uint32_t regidx = (uintptr_t)key;
     const ARMCPRegInfo *ri = value;
 
+    if (arm_cpu_hidden_reg(cpu, regidx)) {
+        return;
+    }
     if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_ALIAS))) {
-        cpu->cpreg_indexes[cpu->cpreg_array_len] = cpreg_to_kvm_id(regidx);
+        cpu->cpreg_indexes[cpu->cpreg_array_len] = kvm_regidx;
         /* The value array need not be initialized at this point */
         cpu->cpreg_array_len++;
     }
@@ -247,6 +250,11 @@ static void count_cpreg(gpointer key, gpointer value, 
gpointer opaque)
 {
     ARMCPU *cpu = opaque;
     const ARMCPRegInfo *ri = value;
+    uint32_t regidx = (uintptr_t)key;
+
+    if (arm_cpu_hidden_reg(cpu, regidx)) {
+        return;
+    }
 
     if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_ALIAS))) {
         cpu->cpreg_array_len++;
-- 
2.51.1


Reply via email to