Revision 6c1f42fe target-i386/helper.c

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

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

  
101
    for (i = 0; i < 32; ++i) {
102
        mask = 1U << i;
103
        if ((*features & mask) && !(supported & mask)) {
104
            *features &= ~mask;
105
        }
106
    }
107
}
108

  
109 95
typedef struct x86_def_t {
110 96
    const char *name;
111 97
    uint32_t level;
......
1773 1759

  
1774 1760
    qemu_init_vcpu(env);
1775 1761

  
1776
    if (kvm_enabled()) {
1777
        kvm_trim_features(&env->cpuid_features,
1778
                          kvm_arch_get_supported_cpuid(env, 1, R_EDX),
1779
                          feature_name);
1780
        kvm_trim_features(&env->cpuid_ext_features,
1781
                          kvm_arch_get_supported_cpuid(env, 1, R_ECX),
1782
                          ext_feature_name);
1783
        kvm_trim_features(&env->cpuid_ext2_features,
1784
                          kvm_arch_get_supported_cpuid(env, 0x80000001, R_EDX),
1785
                          ext2_feature_name);
1786
        kvm_trim_features(&env->cpuid_ext3_features,
1787
                          kvm_arch_get_supported_cpuid(env, 0x80000001, R_ECX),
1788
                          ext3_feature_name);
1789
    }
1790

  
1791 1762
    return env;
1792 1763
}
1793 1764

  

Also available in: Unified diff