diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2013-04-22 16:00:18 -0300 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-05-06 17:53:57 +0200 |
commit | bd87d2a2c05569a28768648b069cbc24c40f4fb8 (patch) | |
tree | b76660354f93e2c18aec249af54ecf0303e823a6 | |
parent | 04d104b61198615c259d1851684b2713213dcf99 (diff) |
target-i386: Use FeatureWord loop on filter_features_for_kvm()
Instead of open-coding the filtering code for each feature word, change
the existing code to use the feature_word_info array, that has exactly
the same CPUID eax/ecx/register values for each feature word.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r-- | target-i386/cpu.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0f924696f9..a39b36422f 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1651,24 +1651,14 @@ static void filter_features_for_kvm(X86CPU *cpu) { CPUX86State *env = &cpu->env; KVMState *s = kvm_state; + FeatureWord w; - env->features[FEAT_1_EDX] &= - kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX); - env->features[FEAT_1_ECX] &= - kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX); - env->features[FEAT_8000_0001_EDX] &= - kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_EDX); - env->features[FEAT_8000_0001_ECX] &= - kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_ECX); - env->features[FEAT_SVM] &= - kvm_arch_get_supported_cpuid(s, 0x8000000A, 0, R_EDX); - env->features[FEAT_7_0_EBX] &= - kvm_arch_get_supported_cpuid(s, 7, 0, R_EBX); - env->features[FEAT_KVM] &= - kvm_arch_get_supported_cpuid(s, KVM_CPUID_FEATURES, 0, R_EAX); - env->features[FEAT_C000_0001_EDX] &= - kvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX); - + for (w = 0; w < FEATURE_WORDS; w++) { + FeatureWordInfo *wi = &feature_word_info[w]; + env->features[w] &= kvm_arch_get_supported_cpuid(s, wi->cpuid_eax, + wi->cpuid_ecx, + wi->cpuid_reg); + } } #endif |