Revision e8a6aec9 target-i386/helper.c

b/target-i386/helper.c
93 93
    }
94 94
}
95 95

  
96
static void kvm_trim_features(uint32_t *features, uint32_t supported,
97
                              const char *names[])
98
{
99
    int i;
100
    uint32_t mask;
101

  
102
    for (i = 0; i < 32; ++i) {
103
        mask = 1U << i;
104
        if ((*features & mask) && !(supported & mask)) {
105
            printf("Processor feature %s not supported by kvm\n", names[i]);
106
            *features &= ~mask;
107
        }
108
    }
109
}
110

  
96 111
typedef struct x86_def_t {
97 112
    const char *name;
98 113
    uint32_t level;
......
1699 1714

  
1700 1715
    qemu_init_vcpu(env);
1701 1716

  
1717
    if (kvm_enabled()) {
1718
        kvm_trim_features(&env->cpuid_features,
1719
                          kvm_arch_get_supported_cpuid(env, 1, R_EDX),
1720
                          feature_name);
1721
        kvm_trim_features(&env->cpuid_ext_features,
1722
                          kvm_arch_get_supported_cpuid(env, 1, R_ECX),
1723
                          ext_feature_name);
1724
        kvm_trim_features(&env->cpuid_ext2_features,
1725
                          kvm_arch_get_supported_cpuid(env, 0x80000001, R_EDX),
1726
                          ext2_feature_name);
1727
        kvm_trim_features(&env->cpuid_ext3_features,
1728
                          kvm_arch_get_supported_cpuid(env, 0x80000001, R_ECX),
1729
                          ext3_feature_name);
1730
    }
1731

  
1702 1732
    return env;
1703 1733
}

Also available in: Unified diff