Changeset 50584 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Feb 25, 2014 4:06:26 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
r50158 r50584 1571 1571 *puValue = ((uint32_t)uTsc133MHz << 8) /* TSC invariant frequency. */ 1572 1572 | ((uint64_t)uTsc133MHz << 40); /* The max turbo frequency. */ 1573 return VINF_SUCCESS; 1574 } 1575 1576 1577 /** @callback_method_impl{FNCPUMRDMSR} */ 1578 static DECLCALLBACK(int) cpumMsrRd_IntelFlexRatio100MHz(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue) 1579 { 1580 uint64_t uValue = pRange->uValue & ~UINT64_C(0x1ff00); 1581 1582 uint64_t uTscHz = TMCpuTicksPerSecond(pVCpu->CTX_SUFF(pVM)); 1583 uint8_t uTsc100MHz = (uint8_t)(uTscHz / UINT32_C(100000000)); 1584 uValue |= (uint32_t)uTsc100MHz << 8; 1585 1586 *puValue = uValue; 1587 return VINF_SUCCESS; 1588 } 1589 1590 1591 /** @callback_method_impl{FNCPUMWRMSR} */ 1592 static DECLCALLBACK(int) cpumMsrWr_IntelFlexRatio100MHz(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue) 1593 { 1594 /** @todo implement writing MSR_FLEX_RATIO. */ 1595 return VINF_SUCCESS; 1596 } 1597 1598 1599 /** @callback_method_impl{FNCPUMRDMSR} */ 1600 static DECLCALLBACK(int) cpumMsrRd_IntelFlexRatio133MHz(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue) 1601 { 1602 uint64_t uValue = pRange->uValue & ~UINT64_C(0x1ff00); 1603 1604 uint64_t uTscHz = TMCpuTicksPerSecond(pVCpu->CTX_SUFF(pVM)); 1605 uint8_t uTsc133MHz = (uint8_t)(uTscHz / UINT32_C(133333333)); 1606 uValue |= (uint32_t)uTsc133MHz << 8; 1607 1608 *puValue = uValue; 1609 return VINF_SUCCESS; 1610 } 1611 1612 1613 /** @callback_method_impl{FNCPUMWRMSR} */ 1614 static DECLCALLBACK(int) cpumMsrWr_IntelFlexRatio133MHz(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue) 1615 { 1616 /** @todo implement writing MSR_FLEX_RATIO. */ 1573 1617 return VINF_SUCCESS; 1574 1618 } … … 4346 4390 cpumMsrRd_IntelPlatformInfo100MHz, 4347 4391 cpumMsrRd_IntelPlatformInfo133MHz, 4392 cpumMsrRd_IntelFlexRatio100MHz, 4393 cpumMsrRd_IntelFlexRatio133MHz, 4348 4394 cpumMsrRd_IntelPkgCStConfigControl, 4349 4395 cpumMsrRd_IntelPmgIoCaptureBase, … … 4581 4627 cpumMsrWr_IntelP4EbcSoftPowerOn, 4582 4628 cpumMsrWr_IntelP4EbcFrequencyId, 4629 cpumMsrWr_IntelFlexRatio100MHz, 4630 cpumMsrWr_IntelFlexRatio133MHz, 4583 4631 cpumMsrWr_IntelPkgCStConfigControl, 4584 4632 cpumMsrWr_IntelPmgIoCaptureBase, … … 5032 5080 CPUM_ASSERT_RD_MSR_FN(IntelPlatformInfo100MHz); 5033 5081 CPUM_ASSERT_RD_MSR_FN(IntelPlatformInfo133MHz); 5082 CPUM_ASSERT_RD_MSR_FN(IntelFlexRatio100MHz); 5083 CPUM_ASSERT_RD_MSR_FN(IntelFlexRatio133MHz); 5034 5084 CPUM_ASSERT_RD_MSR_FN(IntelPkgCStConfigControl); 5035 5085 CPUM_ASSERT_RD_MSR_FN(IntelPmgIoCaptureBase); … … 5256 5306 CPUM_ASSERT_WR_MSR_FN(IntelP4EbcSoftPowerOn); 5257 5307 CPUM_ASSERT_WR_MSR_FN(IntelP4EbcFrequencyId); 5308 CPUM_ASSERT_WR_MSR_FN(IntelFlexRatio100MHz); 5309 CPUM_ASSERT_WR_MSR_FN(IntelFlexRatio133MHz); 5258 5310 CPUM_ASSERT_WR_MSR_FN(IntelPkgCStConfigControl); 5259 5311 CPUM_ASSERT_WR_MSR_FN(IntelPmgIoCaptureBase); … … 5400 5452 5401 5453 5454 /** 5455 * Gets the bus frequency. 5456 * 5457 * The bus frequency is used as a base in several MSRs that gives the CPU and 5458 * other frequency ratios. 5459 * 5460 * @returns Bus frequency in Hz. 5461 * @param pVM Pointer to the shared VM structure. 5462 */ 5463 VMMDECL(uint64_t) CPUMGetGuestBusFrequency(PVM pVM) 5464 { 5465 if (CPUMMICROARCH_IS_INTEL_CORE7(pVM->cpum.s.GuestFeatures.enmMicroarch)) 5466 { 5467 return pVM->cpum.s.GuestFeatures.enmMicroarch >= kCpumMicroarch_Intel_Core7_SandyBridge 5468 ? UINT64_C(100000000) /* 100MHz */ 5469 : UINT64_C(133333333); /* 133MHz */ 5470 } 5471 5472 /* 133MHz */ 5473 return UINT64_C(133333333); 5474 } 5475 5476 5402 5477 #ifdef IN_RING0 5403 5478
Note:
See TracChangeset
for help on using the changeset viewer.