Changeset 1057 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Feb 23, 2007 8:38:37 PM (18 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/TMAll.cpp
r1027 r1057 609 609 610 610 case TMCLOCK_TSC: 611 { 612 PCSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage; 613 if (pGip) 614 return SUPGetCpuHzFromGIP(pGip) ; 615 return pTimer->CTXALLSUFF(pVM)->tm.s.cTSCTicksPerSecond; 616 } 611 return TMCpuTicksPerSecond(pTimer->CTXALLSUFF(pVM)); 617 612 618 613 default: -
trunk/src/VBox/VMM/VMMAll/TMAllCpu.cpp
r23 r1057 28 28 #include "TMInternal.h" 29 29 #include <VBox/vm.h> 30 #include <VBox/sup.h> 30 31 31 32 #include <VBox/param.h> … … 33 34 #include <iprt/assert.h> 34 35 #include <iprt/asm.h> 36 37 38 /** 39 * Gets the raw cpu tick from current virtual time. 40 */ 41 DECLINLINE(uint64_t) tmCpuTickGetRawVirtual(PVM pVM) 42 { 43 uint64_t u64 = TMVirtualGet(pVM); 44 /** @todo calc tsc from virtual time. */ 45 return u64; 46 } 35 47 36 48 … … 46 58 { 47 59 pVM->tm.s.fTSCTicking = true; 48 #ifndef TM_REAL_CPU_TICK 49 pVM->tm.s.u64TSCOffset = ASMReadTSC() - pVM->tm.s.u64TSC; 50 #endif 60 if (pVM->tm.s.fTSCVirtualized) 61 { 62 if (pVM->tm.s.fTSCUseRealTSC) 63 pVM->tm.s.u64TSCOffset = ASMReadTSC() - pVM->tm.s.u64TSC; 64 else 65 pVM->tm.s.u64TSCOffset = tmCpuTickGetRawVirtual(pVM) - pVM->tm.s.u64TSC; 66 } 51 67 return VINF_SUCCESS; 52 68 } … … 66 82 if (pVM->tm.s.fTSCTicking) 67 83 { 68 #ifndef TM_REAL_CPU_TICK 69 pVM->tm.s.u64TSC = ASMReadTSC() - pVM->tm.s.u64TSCOffset; 70 #endif 84 if (!pVM->tm.s.fTSCVirtualized) 85 { 86 if (pVM->tm.s.fTSCUseRealTSC) 87 pVM->tm.s.u64TSC = ASMReadTSC() - pVM->tm.s.u64TSCOffset; 88 else 89 pVM->tm.s.u64TSC = tmCpuTickGetRawVirtual(pVM) - pVM->tm.s.u64TSCOffset; 90 } 71 91 pVM->tm.s.fTSCTicking = false; 72 92 return VINF_SUCCESS; … … 86 106 TMDECL(uint64_t) TMCpuTickGet(PVM pVM) 87 107 { 88 #ifdef TM_REAL_CPU_TICK 89 return ASMReadTSC(); 90 #else 91 if (pVM->tm.s.fTSCTicking) 92 return ASMReadTSC() - pVM->tm.s.u64TSCOffset; 93 return pVM->tm.s.u64TSC; 94 #endif 108 uint64_t u64; 109 if (pVM->tm.s.fTSCUseRealTSC) 110 u64 = ASMReadTSC(); 111 else 112 { 113 if (pVM->tm.s.fTSCTicking) 114 { 115 if (pVM->tm.s.fTSCUseRealTSC) 116 u64 = ASMReadTSC() - pVM->tm.s.u64TSCOffset; 117 else 118 u64 = tmCpuTickGetRawVirtual(pVM) - pVM->tm.s.u64TSCOffset; 119 } 120 else 121 u64 = pVM->tm.s.u64TSC; 122 } 123 return u64; 95 124 } 96 125 … … 119 148 TMDECL(uint64_t) TMCpuTicksPerSecond(PVM pVM) 120 149 { 150 if (pVM->tm.s.fTSCUseRealTSC) 151 { 152 uint64_t cTSCTicksPerSecond = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage); 153 if (RT_LIKELY(cTSCTicksPerSecond != ~(uint64_t)0)) 154 return cTSCTicksPerSecond; 155 } 121 156 return pVM->tm.s.cTSCTicksPerSecond; 122 157 } -
trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
r443 r1057 372 372 int rc = TMVirtualPause(pVM); 373 373 AssertRCReturn(rc, rc); 374 rc = TMCpuTickPause(pVM); 375 AssertRCReturn(rc, rc); 374 376 } 375 377 … … 383 385 int rc = TMVirtualResume(pVM); 384 386 AssertRCReturn(rc, rc); 387 rc = TMCpuTickResume(pVM); 388 AssertRCReturn(rc, rc); 385 389 } 386 390
Note:
See TracChangeset
for help on using the changeset viewer.