VirtualBox

Changeset 48695 in vbox


Ignore:
Timestamp:
Sep 26, 2013 12:20:56 AM (11 years ago)
Author:
vboxsync
Message:

CPUM: MSR_CORE_THREAD_COUNT and MSR_FLEX_RATIO for snow leopard.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/x86.h

    r48368 r48695  
    947947#endif
    948948
     949/** Undocumented intel MSR for reporting thread and core counts.
     950 * Judging from the XNU sources, it seems to be introduced in Nehalem. The
     951 * first 16 bits is the thread count. The next 16 bits the core count, except
     952 * on westmer where it seems it's only the next 4 bits for some reason. */
     953#define MSR_CORE_THREAD_COUNT               0x35
     954
    949955/** CPU Feature control. */
    950956#define MSR_IA32_FEATURE_CONTROL            0x3A
     
    10141020#define MSR_IA32_PERFEVTSEL0                0x186
    10151021#define MSR_IA32_PERFEVTSEL1                0x187
    1016 #define MSR_IA32_FLEX_RATIO                 0x194
     1022/** Flexible ratio, seems to be undocumented, used by XNU (tsc.c).
     1023 * The 16th bit whether flex ratio is being used, in which case bits 15:8
     1024 * holds a ratio that Apple takes for TSC granularity.
     1025 *
     1026 * @note This MSR conflics the P4 MSR_MCG_R12 register. */
     1027#define MSR_FLEX_RATIO                      0x194
     1028/** Performance state value and starting with Intel core more.
     1029 * Apple uses the >=core features to determine TSC granularity on older CPUs. */
    10171030#define MSR_IA32_PERF_STATUS                0x198
    10181031#define MSR_IA32_PERF_CTL                   0x199
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r48602 r48695  
    10441044
    10451045        case MSR_IA32_PERF_STATUS:
    1046             /** @todo could really be not exactly correct, maybe use host's values */
     1046            /** @todo could really be not exactly correct, maybe use host's values
     1047             * Apple code indicates that we should use CPU Hz / 1.333MHz here. */
     1048            /** @todo Where are the specs implemented here found? */
    10471049            *puValue = UINT64_C(1000)                 /* TSC increment by tick */
    10481050                     | ((uint64_t)u8Multiplier << 24) /* CPU multiplier (aka bus ratio) min */
     
    10631065
    10641066        case MSR_IA32_PLATFORM_INFO:
    1065             *puValue = (u8Multiplier << 8)            /* Flex ratio max */
     1067            *puValue = ((uint32_t)u8Multiplier << 8)  /* Flex ratio max */
    10661068                     | ((uint64_t)u8Multiplier << 40) /* Flex ratio min */;
    10671069            break;
     
    11421144        case MSR_RAPL_POWER_UNIT:
    11431145        case MSR_BBL_CR_CTL3:               /* ca. core arch? */
    1144         case MSR_PKG_CST_CONFIG_CONTROL:   /* Nahalem, Sandy Bridge */
     1146        case MSR_PKG_CST_CONFIG_CONTROL:    /* Nahalem, Sandy Bridge */
     1147        case MSR_CORE_THREAD_COUNT:         /* Apple queries this. */
     1148        case MSR_FLEX_RATIO:                /* Apple queries this. */
    11451149            *puValue = 0;
    11461150            if (CPUMGetGuestCpuVendor(pVCpu->CTX_SUFF(pVM)) != CPUMCPUVENDOR_INTEL)
     
    11691173                    *puValue = pVCpu->cpum.s.GuestMsrs.msr.PkgCStateCfgCtrl;
    11701174                    break;
     1175                case MSR_CORE_THREAD_COUNT:
     1176                {
     1177                    /** @todo restrict this to nehalem.  */
     1178                    PVM pVM = pVCpu->CTX_SUFF(pVM); /* Note! Not sweating the 4-bit core count limit on westmere. */
     1179                    *puValue = pVM->cCpus & 0xffff | ((pVM->cCpus & 0xffff) << 16);
     1180                    break;
     1181                }
     1182
     1183                case MSR_FLEX_RATIO:
     1184                {
     1185                    /** @todo Check for P4, it's different there. Try find accurate specs. */
     1186                    *puValue = (uint32_t)u8Multiplier << 8;
     1187                    break;
     1188                }
    11711189            }
    11721190            break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette