]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/arm/hvf: Sort the cpreg_indexes array
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 16 Sep 2025 14:22:09 +0000 (07:22 -0700)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 25 Sep 2025 14:42:34 +0000 (15:42 +0100)
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/hvf/hvf.c

index b043eac8c62a662efbedd751f8bd219305453dd8..99d8672b9bc4416d3ce2fa0909c5f9f93bf9e467 100644 (file)
@@ -925,6 +925,9 @@ int hvf_arch_init_vcpu(CPUState *cpu)
     arm_cpu->cpreg_array_len = sregs_cnt;
     arm_cpu->cpreg_vmstate_array_len = sregs_cnt;
 
+    /* cpreg tuples must be in strictly ascending order */
+    qsort(arm_cpu->cpreg_indexes, sregs_cnt, sizeof(uint64_t), compare_u64);
+
     assert(write_cpustate_to_list(arm_cpu, false));
 
     /* Set CP_NO_RAW system registers on init */