Create a features member in ARMCPUClass and copy to the instance in
arm_cpu_init. Settings of this value will come in a future patch.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/cpu-qom.h | 18 ++++++++++++++++++
target/arm/cpu.c | 1 +
2 files changed, 19 insertions(+)
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
index 5509ef9d85..ac58cc3a87 100644
--- a/target/arm/cpu-qom.h
+++ b/target/arm/cpu-qom.h
@@ -74,8 +74,26 @@ struct ARMCPUClass {
/* 'compatible' string for this CPU for Linux device trees */
const char *dtb_compatible;
+
+ /* Internal CPU feature flags. */
+ uint64_t features;
};
+static inline int arm_class_feature(ARMCPUClass *acc, int feature)
+{
+ return (acc->features & (1ULL << feature)) != 0;
+}
+
+static inline void set_class_feature(ARMCPUClass *acc, int feature)
+{
+ acc->features |= 1ULL << feature;
+}
+
+static inline void unset_class_feature(ARMCPUClass *acc, int feature)
+{
+ acc->features &= ~(1ULL << feature);
+}
void register_cp_regs_for_features(ARMCPU *cpu);
void init_cpreg_list(ARMCPU *cpu);
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 1bc45b2b25..d64b86b6a5 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1191,6 +1191,7 @@ static void arm_cpu_initfn(Object *obj)
QLIST_INIT(&cpu->el_change_hooks);
cpu->dtb_compatible = acc->dtb_compatible;
+ cpu->env.features = acc->features;
#ifdef CONFIG_USER_ONLY
# ifdef TARGET_AARCH64