Revision 3b671a40 target-i386/cpu.c

b/target-i386/cpu.c
61 61
    "tsc-deadline", "aes", "xsave", "osxsave",
62 62
    "avx", NULL, NULL, "hypervisor",
63 63
};
64
/* Feature names that are already defined on feature_name[] but are set on
65
 * CPUID[8000_0001].EDX on AMD CPUs don't have their names on
66
 * ext2_feature_name[]. They are copied automatically to cpuid_ext2_features
67
 * if and only if CPU vendor is AMD.
68
 */
64 69
static const char *ext2_feature_name[] = {
65
    "fpu", "vme", "de", "pse",
66
    "tsc", "msr", "pae", "mce",
67
    "cx8" /* AMD CMPXCHG8B */, "apic", NULL, "syscall",
68
    "mtrr", "pge", "mca", "cmov",
69
    "pat", "pse36", NULL, NULL /* Linux mp */,
70
    "nx|xd", NULL, "mmxext", "mmx",
71
    "fxsr", "fxsr_opt|ffxsr", "pdpe1gb" /* AMD Page1GB */, "rdtscp",
72
    NULL, "lm|i64", "3dnowext", "3dnow",
70
    NULL /* fpu */, NULL /* vme */, NULL /* de */, NULL /* pse */,
71
    NULL /* tsc */, NULL /* msr */, NULL /* pae */, NULL /* mce */,
72
    NULL /* cx8 */ /* AMD CMPXCHG8B */, NULL /* apic */, NULL, "syscall",
73
    NULL /* mtrr */, NULL /* pge */, NULL /* mca */, NULL /* cmov */,
74
    NULL /* pat */, NULL /* pse36 */, NULL, NULL /* Linux mp */,
75
    "nx|xd", NULL, "mmxext", NULL /* mmx */,
76
    NULL /* fxsr */, "fxsr_opt|ffxsr", "pdpe1gb" /* AMD Page1GB */, "rdtscp",
73 77
};
74 78
static const char *ext3_feature_name[] = {
75 79
    "lahf_lm" /* AMD LahfSahf */, "cmp_legacy", "svm", "extapic" /* AMD ExtApicSpace */,
......
1374 1378
    env->cpuid_xlevel2 = def->xlevel2;
1375 1379
    object_property_set_int(OBJECT(cpu), (int64_t)def->tsc_khz * 1000,
1376 1380
                            "tsc-frequency", &error);
1381

  
1382
    /* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on
1383
     * CPUID[1].EDX.
1384
     */
1385
    if (env->cpuid_vendor1 == CPUID_VENDOR_AMD_1 &&
1386
            env->cpuid_vendor2 == CPUID_VENDOR_AMD_2 &&
1387
            env->cpuid_vendor3 == CPUID_VENDOR_AMD_3) {
1388
        env->cpuid_ext2_features &= ~CPUID_EXT2_AMD_ALIASES;
1389
        env->cpuid_ext2_features |= (def->features & CPUID_EXT2_AMD_ALIASES);
1390
    }
1391

  
1377 1392
    if (!kvm_enabled()) {
1378 1393
        env->cpuid_features &= TCG_FEATURES;
1379 1394
        env->cpuid_ext_features &= TCG_EXT_FEATURES;

Also available in: Unified diff