mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 11:23:43 +08:00
target-i386: Loop-based copying and setting/unsetting of feature words
Now that we have the feature word arrays, we don't need to manually copy each array item, we can simply iterate through each feature word. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
621626ce7d
commit
e1c224b4eb
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user