Changeset 36254 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Mar 10, 2011 5:22:08 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 70492
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/TM.cpp
r35346 r36254 122 122 #define LOG_GROUP LOG_GROUP_TM 123 123 #include <VBox/vmm/tm.h> 124 #include <iprt/asm-amd64-x86.h> /* for SUPGetCpuHzFromGIP from sup.h */ 124 125 #include <VBox/vmm/vmm.h> 125 126 #include <VBox/vmm/mm.h> … … 139 140 #include <iprt/asm.h> 140 141 #include <iprt/asm-math.h> 141 #include <iprt/asm-amd64-x86.h>142 142 #include <iprt/assert.h> 143 143 #include <iprt/thread.h> … … 222 222 pVM->tm.s.pvGIPR3 = (void *)g_pSUPGlobalInfoPage; 223 223 AssertMsgReturn(pVM->tm.s.pvGIPR3, ("GIP support is now required!\n"), VERR_INTERNAL_ERROR); 224 AssertMsgReturn((g_pSUPGlobalInfoPage->u32Version >> 16) == (SUPGLOBALINFOPAGE_VERSION >> 16), 225 ("Unsupported GIP version!\n"), VERR_INTERNAL_ERROR); 226 224 227 RTHCPHYS HCPhysGIP; 225 228 rc = SUPR3GipGetPhys(&HCPhysGIP); … … 227 230 228 231 RTGCPTR GCPtr; 232 #ifdef SUP_WITH_LOTS_OF_CPUS 233 rc = MMR3HyperMapHCPhys(pVM, pVM->tm.s.pvGIPR3, NIL_RTR0PTR, HCPhysGIP, (size_t)g_pSUPGlobalInfoPage->cPages * PAGE_SIZE, 234 "GIP", &GCPtr); 235 #else 229 236 rc = MMR3HyperMapHCPhys(pVM, pVM->tm.s.pvGIPR3, NIL_RTR0PTR, HCPhysGIP, PAGE_SIZE, "GIP", &GCPtr); 237 #endif 230 238 if (RT_FAILURE(rc)) 231 239 { … … 795 803 * Use GIP when available present. 796 804 */ 797 uint64_t u64Hz; 798 PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage; 799 if ( pGip 800 && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC) 801 { 802 unsigned iCpu = pGip->u32Mode != SUPGIPMODE_ASYNC_TSC ? 0 : ASMGetApicId(); 803 if (iCpu >= RT_ELEMENTS(pGip->aCPUs)) 804 AssertReleaseMsgFailed(("iCpu=%d - the ApicId is too high. send VBox.log and hardware specs!\n", iCpu)); 805 uint64_t u64Hz = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage); 806 if (u64Hz != UINT64_MAX) 807 { 808 if (tmR3HasFixedTSC(pVM)) 809 /* Sleep a bit to get a more reliable CpuHz value. */ 810 RTThreadSleep(32); 805 811 else 806 812 { 807 if (tmR3HasFixedTSC(pVM)) 808 /* Sleep a bit to get a more reliable CpuHz value. */ 809 RTThreadSleep(32); 810 else 811 { 812 /* Spin for 40ms to try push up the CPU frequency and get a more reliable CpuHz value. */ 813 const uint64_t u64 = RTTimeMilliTS(); 814 while ((RTTimeMilliTS() - u64) < 40 /*ms*/) 815 /* nothing */; 816 } 817 818 pGip = g_pSUPGlobalInfoPage; 819 if ( pGip 820 && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC 821 && (u64Hz = pGip->aCPUs[iCpu].u64CpuHz) 822 && u64Hz != ~(uint64_t)0) 823 return u64Hz; 813 /* Spin for 40ms to try push up the CPU frequency and get a more reliable CpuHz value. */ 814 const uint64_t u64 = RTTimeMilliTS(); 815 while ((RTTimeMilliTS() - u64) < 40 /*ms*/) 816 /* nothing */; 824 817 } 818 819 u64Hz = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage); 820 if (u64Hz != UINT64_MAX) 821 return u64Hz; 825 822 } 826 823
Note:
See TracChangeset
for help on using the changeset viewer.