diff options
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/cpu.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 6eb5f05f40..d05b8ecb1b 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1649,6 +1649,7 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features, { X86CPU *cpu = X86_CPU(cs); char *featurestr; /* Single 'key=value" string being parsed */ + FeatureWord w; /* Features to be added */ FeatureWordArray plus_features = { 0 }; /* Features to be removed */ @@ -1728,22 +1729,11 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features, } featurestr = strtok(NULL, ","); } - env->features[FEAT_1_EDX] |= plus_features[FEAT_1_EDX]; - env->features[FEAT_1_ECX] |= plus_features[FEAT_1_ECX]; - env->features[FEAT_8000_0001_EDX] |= plus_features[FEAT_8000_0001_EDX]; - env->features[FEAT_8000_0001_ECX] |= plus_features[FEAT_8000_0001_ECX]; - env->features[FEAT_C000_0001_EDX] |= plus_features[FEAT_C000_0001_EDX]; - env->features[FEAT_KVM] |= plus_features[FEAT_KVM]; - env->features[FEAT_SVM] |= plus_features[FEAT_SVM]; - env->features[FEAT_7_0_EBX] |= plus_features[FEAT_7_0_EBX]; - env->features[FEAT_1_EDX] &= ~minus_features[FEAT_1_EDX]; - env->features[FEAT_1_ECX] &= ~minus_features[FEAT_1_ECX]; - env->features[FEAT_8000_0001_EDX] &= ~minus_features[FEAT_8000_0001_EDX]; - env->features[FEAT_8000_0001_ECX] &= ~minus_features[FEAT_8000_0001_ECX]; - env->features[FEAT_C000_0001_EDX] &= ~minus_features[FEAT_C000_0001_EDX]; - env->features[FEAT_KVM] &= ~minus_features[FEAT_KVM]; - env->features[FEAT_SVM] &= ~minus_features[FEAT_SVM]; - env->features[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX]; + + for (w = 0; w < FEATURE_WORDS; w++) { + env->features[w] |= plus_features[w]; + env->features[w] &= ~minus_features[w]; + } } /* generate a composite string into buf of all cpuid names in featureset @@ -1872,24 +1862,19 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp) CPUX86State *env = &cpu->env; const char *vendor; char host_vendor[CPUID_VENDOR_SZ + 1]; + FeatureWord w; object_property_set_int(OBJECT(cpu), def->level, "level", errp); object_property_set_int(OBJECT(cpu), def->family, "family", errp); object_property_set_int(OBJECT(cpu), def->model, "model", errp); object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp); - env->features[FEAT_1_EDX] = def->features[FEAT_1_EDX]; - env->features[FEAT_1_ECX] = def->features[FEAT_1_ECX]; - env->features[FEAT_8000_0001_EDX] = def->features[FEAT_8000_0001_EDX]; - env->features[FEAT_8000_0001_ECX] = def->features[FEAT_8000_0001_ECX]; object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp); - env->features[FEAT_KVM] = def->features[FEAT_KVM]; - env->features[FEAT_SVM] = def->features[FEAT_SVM]; - env->features[FEAT_C000_0001_EDX] = def->features[FEAT_C000_0001_EDX]; - env->features[FEAT_7_0_EBX] = def->features[FEAT_7_0_EBX]; env->cpuid_xlevel2 = def->xlevel2; cpu->cache_info_passthrough = def->cache_info_passthrough; - object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp); + for (w = 0; w < FEATURE_WORDS; w++) { + env->features[w] = def->features[w]; + } /* Special cases not set in the X86CPUDefinition structs: */ if (kvm_enabled()) { |