Changeset 19500 in vbox for trunk/src/VBox
- Timestamp:
- May 7, 2009 6:23:22 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineDebuggerImpl.cpp
r19300 r19500 585 585 586 586 if (pVM.isOk()) 587 *aPct = TM VirtualGetWarpDrive (pVM);587 *aPct = TMGetWarpDrive (pVM); 588 588 else 589 589 *aPct = 100; … … 618 618 CheckComRCReturnRC (pVM.rc()); 619 619 620 int vrc = TM VirtualSetWarpDrive (pVM, aPct);620 int vrc = TMR3SetWarpDrive (pVM, aPct); 621 621 if (RT_FAILURE (vrc)) 622 622 { -
trunk/src/VBox/VMM/TM.cpp
r19497 r19500 166 166 static void tmR3TimerQueueRun(PVM pVM, PTMTIMERQUEUE pQueue); 167 167 static void tmR3TimerQueueRunVirtualSync(PVM pVM); 168 static DECLCALLBACK(int) tmR3SetWarpDrive(PVM pVM, uint32_t u32Percent); 168 169 static DECLCALLBACK(void) tmR3TimerInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs); 169 170 static DECLCALLBACK(void) tmR3TimerInfoActive(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs); … … 2047 2048 2048 2049 /** 2050 * Sets the warp drive percent of the virtual time. 2051 * 2052 * @returns VBox status code. 2053 * @param pVM The VM handle. 2054 * @param u32Percent The new percentage. 100 means normal operation. 2055 * 2056 * @todo Move to Ring-3! 2057 */ 2058 VMMDECL(int) TMR3SetWarpDrive(PVM pVM, uint32_t u32Percent) 2059 { 2060 PVMREQ pReq; 2061 int rc = VMR3ReqCall(pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, 2062 (PFNRT)tmR3SetWarpDrive, 2, pVM, u32Percent); 2063 if (RT_SUCCESS(rc)) 2064 rc = pReq->iStatus; 2065 VMR3ReqFree(pReq); 2066 return rc; 2067 } 2068 2069 2070 /** 2071 * EMT worker for TMR3SetWarpDrive. 2072 * 2073 * @returns VBox status code. 2074 * @param pVM The VM handle. 2075 * @param u32Percent See TMR3SetWarpDrive(). 2076 * @internal 2077 */ 2078 static DECLCALLBACK(int) tmR3SetWarpDrive(PVM pVM, uint32_t u32Percent) 2079 { 2080 PVMCPU pVCpu = VMMGetCpu(pVM); 2081 2082 /* 2083 * Validate it. 2084 */ 2085 AssertMsgReturn(u32Percent >= 2 && u32Percent <= 20000, 2086 ("%RX32 is not between 2 and 20000 (inclusive).\n", u32Percent), 2087 VERR_INVALID_PARAMETER); 2088 tmLock(pVM); /* paranoia */ 2089 2090 /** @todo This isn't a feature specific to virtual time, move the variables to 2091 * TM level and make it affect TMR3UCTNow as well! */ 2092 2093 /* 2094 * If the time is running we'll have to pause it before we can change 2095 * the warp drive settings. 2096 */ 2097 bool fPaused = !!pVM->tm.s.cVirtualTicking; 2098 if (fPaused) 2099 { 2100 int rc = TMVirtualPause(pVM); 2101 AssertRC(rc); 2102 rc = TMCpuTickPause(pVCpu); 2103 AssertRC(rc); 2104 } 2105 2106 pVM->tm.s.u32VirtualWarpDrivePercentage = u32Percent; 2107 pVM->tm.s.fVirtualWarpDrive = u32Percent != 100; 2108 LogRel(("TM: u32VirtualWarpDrivePercentage=%RI32 fVirtualWarpDrive=%RTbool\n", 2109 pVM->tm.s.u32VirtualWarpDrivePercentage, pVM->tm.s.fVirtualWarpDrive)); 2110 2111 if (fPaused) 2112 { 2113 int rc = TMVirtualResume(pVM); 2114 AssertRC(rc); 2115 rc = TMCpuTickResume(pVCpu); 2116 AssertRC(rc); 2117 } 2118 2119 tmUnlock(pVM); 2120 return VINF_SUCCESS; 2121 } 2122 2123 2124 2125 2126 /** 2049 2127 * Display all timers. 2050 2128 * -
trunk/src/VBox/VMM/VMMAll/TMAll.cpp
r19498 r19500 1714 1714 #endif /* !VBOX_STRICT */ 1715 1715 1716 1717 /** 1718 * Gets the current warp drive percent. 1719 * 1720 * @returns The warp drive percent. 1721 * @param pVM The VM handle. 1722 */ 1723 VMMDECL(uint32_t) TMGetWarpDrive(PVM pVM) 1724 { 1725 return pVM->tm.s.u32VirtualWarpDrivePercentage; 1726 } 1727 -
trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
r19444 r19500 41 41 #include <iprt/asm.h> 42 42 43 44 /*******************************************************************************45 * Internal Functions *46 *******************************************************************************/47 static DECLCALLBACK(int) tmVirtualSetWarpDrive(PVM pVM, uint32_t u32Percent);48 43 49 44 … … 660 655 661 656 /** 662 * Gets the current warp drive percent.663 *664 * @returns The warp drive percent.665 * @param pVM The VM handle.666 */667 VMMDECL(uint32_t) TMVirtualGetWarpDrive(PVM pVM)668 {669 return pVM->tm.s.u32VirtualWarpDrivePercentage;670 }671 672 673 /**674 * Sets the warp drive percent of the virtual time.675 *676 * @returns VBox status code.677 * @param pVM The VM handle.678 * @param u32Percent The new percentage. 100 means normal operation.679 */680 VMMDECL(int) TMVirtualSetWarpDrive(PVM pVM, uint32_t u32Percent)681 {682 /** @todo This isn't a feature specific to virtual time, move to TM level. (It683 * should affect the TMR3UCTNow as well! */684 #ifdef IN_RING3685 PVMREQ pReq;686 int rc = VMR3ReqCall(pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, (PFNRT)tmVirtualSetWarpDrive, 2, pVM, u32Percent);687 if (RT_SUCCESS(rc))688 rc = pReq->iStatus;689 VMR3ReqFree(pReq);690 return rc;691 #else692 693 return tmVirtualSetWarpDrive(pVM, u32Percent);694 #endif695 }696 697 698 /**699 * EMT worker for tmVirtualSetWarpDrive.700 *701 * @returns VBox status code.702 * @param pVM The VM handle.703 * @param u32Percent See TMVirtualSetWarpDrive().704 * @internal705 */706 static DECLCALLBACK(int) tmVirtualSetWarpDrive(PVM pVM, uint32_t u32Percent)707 {708 PVMCPU pVCpu = VMMGetCpu(pVM);709 710 /*711 * Validate it.712 */713 AssertMsgReturn(u32Percent >= 2 && u32Percent <= 20000,714 ("%RX32 is not between 2 and 20000 (inclusive).\n", u32Percent),715 VERR_INVALID_PARAMETER);716 tmLock(pVM);717 718 /*719 * If the time is running we'll have to pause it before we can change720 * the warp drive settings.721 */722 bool fPaused = !!pVM->tm.s.cVirtualTicking;723 if (fPaused)724 {725 int rc = TMVirtualPause(pVM);726 AssertRC(rc);727 rc = TMCpuTickPause(pVCpu);728 AssertRC(rc);729 }730 731 pVM->tm.s.u32VirtualWarpDrivePercentage = u32Percent;732 pVM->tm.s.fVirtualWarpDrive = u32Percent != 100;733 LogRel(("TM: u32VirtualWarpDrivePercentage=%RI32 fVirtualWarpDrive=%RTbool\n",734 pVM->tm.s.u32VirtualWarpDrivePercentage, pVM->tm.s.fVirtualWarpDrive));735 736 if (fPaused)737 {738 int rc = TMVirtualResume(pVM);739 AssertRC(rc);740 rc = TMCpuTickResume(pVCpu);741 AssertRC(rc);742 }743 744 tmUnlock(pVM);745 return VINF_SUCCESS;746 }747 748 749 /**750 657 * Converts from virtual ticks to nanoseconds. 751 658 * -
trunk/src/VBox/VMM/testcase/tstAnimate.cpp
r19300 r19500 863 863 if (u32WarpDrive != 100) 864 864 { 865 rc = TM VirtualSetWarpDrive(pVM, u32WarpDrive);865 rc = TMR3SetWarpDrive(pVM, u32WarpDrive); 866 866 if (RT_FAILURE(rc)) 867 867 RTPrintf("warning: TMVirtualSetWarpDrive(,%u) -> %Rrc\n", u32WarpDrive, rc); -
trunk/src/VBox/VMM/testcase/tstVMM.cpp
r19467 r19500 105 105 PTMTIMER pTimer = apTimers[i]; 106 106 107 if ( cLeft == RT_ELEMENTS(apTimers) / 2108 && TMTimerIsActive(pTimer))107 if ( cLeft == RT_ELEMENTS(apTimers) / 2 108 && TMTimerIsActive(pTimer)) 109 109 { 110 rc = TMTimerStop(pTimer);111 RTTEST_CHECK_MSG(hTest, RT_SUCCESS(rc), (hTest, "TMTimerStop: %Rrc\n", rc));110 // rc = TMTimerStop(pTimer); 111 // RTTEST_CHECK_MSG(hTest, RT_SUCCESS(rc), (hTest, "TMTimerStop: %Rrc\n", rc)); 112 112 } 113 113 else
Note:
See TracChangeset
for help on using the changeset viewer.