@@ -20,6 +20,8 @@
#ifndef I386_CPU_INTERNAL_H
#define I386_CPU_INTERNAL_H
+#include "qapi/qapi-types-machine.h"
+
typedef enum FeatureWordType {
CPUID_FEATURE_WORD,
MSR_FEATURE_WORD,
@@ -55,6 +57,8 @@ typedef struct FeatureWordInfo {
extern FeatureWordInfo feature_word_info[];
+X86CPURegister32 get_register_enum_32(FeatureWord w);
+
void x86_cpu_expand_features(X86CPU *cpu, Error **errp);
#ifndef CONFIG_USER_ONLY
@@ -1476,6 +1476,11 @@ static const char *get_register_name_32(unsigned int reg)
return x86_reg_info_32[reg].name;
}
+X86CPURegister32 get_register_enum_32(FeatureWord w)
+{
+ return x86_reg_info_32[feature_word_info[w].cpuid.reg].qapi_enum;
+}
+
/*
* Returns the set of feature flags that are supported and migratable by
* QEMU, for a given FeatureWord.
@@ -4548,7 +4553,7 @@ static void x86_cpu_get_feature_words(Object *obj, Visitor *v,
qwi->cpuid_input_eax = wi->cpuid.eax;
qwi->has_cpuid_input_ecx = wi->cpuid.needs_ecx;
qwi->cpuid_input_ecx = wi->cpuid.ecx;
- qwi->cpuid_register = x86_reg_info_32[wi->cpuid.reg].qapi_enum;
+ qwi->cpuid_register = get_register_enum_32(w);
qwi->features = array[w];
/* List will be in reverse order, but order shouldn't matter */
Introduce get_register_enum_32(), similar to get_register_name_32(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- target/i386/cpu-internal.h | 4 ++++ target/i386/cpu.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-)