On 5/13/25 18:39, Philippe Mathieu-Daudé wrote:
arm_cpu_has_feature() is equivalent of arm_feature(), however
while the latter uses CPUARMState so is target-specific, the
former doesn't and can be called by target-agnostic code in hw/.

CPUARMState is no more target-specific than ARMCPU.

Did you really mean to use CPUState?
Or is it merely that arm_cpu_has_feature is out-of-line?


r~


Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>
---
  target/arm/cpu_has_feature.h | 2 ++
  target/arm/cpu.c             | 7 +++++++
  2 files changed, 9 insertions(+)

diff --git a/target/arm/cpu_has_feature.h b/target/arm/cpu_has_feature.h
index 2adfccd9208..352f9d75bed 100644
--- a/target/arm/cpu_has_feature.h
+++ b/target/arm/cpu_has_feature.h
@@ -62,4 +62,6 @@ typedef enum arm_features {
      ARM_FEATURE_BACKCOMPAT_CNTFRQ, /* 62.5MHz timer default */
  } ArmCpuFeature;
+bool arm_cpu_has_feature(ARMCPU *cpu, ArmCpuFeature feature);
+
  #endif
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 8c9d161f2ef..759636a3b0e 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -54,6 +54,13 @@
  #include "target/arm/gtimer.h"
  #include "target/arm/multiprocessing.h"
+bool arm_cpu_has_feature(ARMCPU *cpu, ArmCpuFeature feature)
+{
+    CPUARMState *env = &cpu->env;
+
+    return arm_feature(env, feature);
+}
+
  static void arm_cpu_set_pc(CPUState *cs, vaddr value)
  {
      ARMCPU *cpu = ARM_CPU(cs);


Reply via email to