Revision 400281af target-i386/helper.c

b/target-i386/helper.c
1627 1627
        *ebx = (env->cpuid_apic_id << 24) | 8 << 8; /* CLFLUSH size in quad words, Linux wants it. */
1628 1628
        *ecx = env->cpuid_ext_features;
1629 1629
        *edx = env->cpuid_features;
1630
        if (env->nr_cores * env->nr_threads > 1) {
1631
            *ebx |= (env->nr_cores * env->nr_threads) << 16;
1632
            *edx |= 1 << 28;    /* HTT bit */
1633
        }
1630 1634
        break;
1631 1635
    case 2:
1632 1636
        /* cache info: needed for Pentium Pro compatibility */
......
1637 1641
        break;
1638 1642
    case 4:
1639 1643
        /* cache info: needed for Core compatibility */
1644
        if (env->nr_cores > 1) {
1645
        	*eax = (env->nr_cores - 1) << 26;
1646
        } else {
1647
        	*eax = 0;
1648
        }
1640 1649
        switch (count) {
1641 1650
            case 0: /* L1 dcache info */
1642
                *eax = 0x0000121;
1651
                *eax |= 0x0000121;
1643 1652
                *ebx = 0x1c0003f;
1644 1653
                *ecx = 0x000003f;
1645 1654
                *edx = 0x0000001;
1646 1655
                break;
1647 1656
            case 1: /* L1 icache info */
1648
                *eax = 0x0000122;
1657
                *eax |= 0x0000122;
1649 1658
                *ebx = 0x1c0003f;
1650 1659
                *ecx = 0x000003f;
1651 1660
                *edx = 0x0000001;
1652 1661
                break;
1653 1662
            case 2: /* L2 cache info */
1654
                *eax = 0x0000143;
1663
                *eax |= 0x0000143;
1664
                if (env->nr_threads > 1) {
1665
                    *eax |= (env->nr_threads - 1) << 14;
1666
                }
1655 1667
                *ebx = 0x3c0003f;
1656 1668
                *ecx = 0x0000fff;
1657 1669
                *edx = 0x0000001;
......
1704 1716
        *ecx = env->cpuid_ext3_features;
1705 1717
        *edx = env->cpuid_ext2_features;
1706 1718

  
1719
        if (env->nr_cores * env->nr_threads > 1 &&
1720
            env->cpuid_vendor1 == CPUID_VENDOR_AMD_1 &&
1721
            env->cpuid_vendor2 == CPUID_VENDOR_AMD_2 &&
1722
            env->cpuid_vendor3 == CPUID_VENDOR_AMD_3) {
1723
            *ecx |= 1 << 1;    /* CmpLegacy bit */
1724
        }
1725

  
1707 1726
        if (kvm_enabled()) {
1708 1727
            /* Nested SVM not yet supported in KVM */
1709 1728
            *ecx &= ~CPUID_EXT3_SVM;
......
1750 1769
        *ebx = 0;
1751 1770
        *ecx = 0;
1752 1771
        *edx = 0;
1772
        if (env->nr_cores * env->nr_threads > 1) {
1773
            *ecx |= (env->nr_cores * env->nr_threads) - 1;
1774
        }
1753 1775
        break;
1754 1776
    case 0x8000000A:
1755 1777
        *eax = 0x00000001; /* SVM Revision */

Also available in: Unified diff