Changeset 20871 in vbox
- Timestamp:
- Jun 24, 2009 1:56:19 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49017
- Location:
- trunk
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r20869 r20871 811 811 * @{ 812 812 */ 813 /** Reason for leaving GC: Calling host function. */813 /** Reason for leaving RZ: Calling host function. */ 814 814 #define VINF_VMM_CALL_HOST 2700 815 815 /** Reason for leaving R0: Hit a ring-0 assertion on EMT. */ … … 817 817 /** The hyper CR3 differs between PGM and CPUM. */ 818 818 #define VERR_VMM_HYPER_CR3_MISMATCH (-2702) 819 /** Reason for leaving RZ: Illegal call to ring-3. */ 820 #define VERR_VMM_RING3_CALL_DISABLED (-2703) 819 821 /** @} */ 820 822 -
trunk/include/VBox/rem.h
r20407 r20871 53 53 VMMDECL(void) REMNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM); 54 54 #endif /* IN_RING0 || IN_RC */ 55 #ifdef IN_RC 56 VMMDECL(void) REMNotifyHandlerPhysicalFlushIfAlmostFull(PVM pVM, PVMCPU pVCpu); 57 #endif 55 58 VMMDECL(void) REMFlushTBs(PVM pVM); 56 59 -
trunk/include/VBox/vmm.h
r20663 r20871 372 372 VMMRCDECL(void) VMMGCGuestToHost(PVM pVM, int rc); 373 373 VMMRCDECL(int) VMMGCCallHost(PVM pVM, VMMCALLHOST enmOperation, uint64_t uArg); 374 VMMRCDECL(bool) VMMGCLogDisable(PVM pVM);375 VMMRCDECL(void) VMMGCLogRestore(PVM pVM, bool fLog);376 374 VMMRCDECL(void) VMMGCLogFlushIfFull(PVM pVM); 377 375 /** @} */ 378 376 #endif /* IN_RC */ 379 377 378 #if defined(IN_RC) || defined(IN_RING0) 379 /** @defgroup grp_vmm_rz The VMM Raw-Mode and Ring-0 Context API 380 * @ingroup grp_vmm 381 * @{ 382 */ 383 VMMRZDECL(int) VMMRZCallRing3(PVM pVM, PVMCPU pVCpu, VMMCALLHOST enmOperation, uint64_t uArg); 384 VMMRZDECL(int) VMMRZCallRing3NoCpu(PVM pVM, VMMCALLHOST enmOperation, uint64_t uArg); 385 VMMRZDECL(void) VMMRZCallRing3Disable(PVMCPU pVCpu); 386 VMMRZDECL(void) VMMRZCallRing3Enable(PVMCPU pVCpu); 387 VMMRZDECL(bool) VMMRZCallRing3IsEnabled(PVMCPU pVCpu); 388 /** @} */ 389 #endif 390 380 391 381 392 /** @} */ -
trunk/src/VBox/VMM/EM.cpp
r20869 r20871 827 827 case VERR_VMM_RING0_ASSERTION: 828 828 case VERR_VMM_HYPER_CR3_MISMATCH: 829 case VERR_VMM_RING3_CALL_DISABLED: 829 830 return rcLast; 830 831 } … … 844 845 case VERR_VMM_RING0_ASSERTION: 845 846 case VERR_VMM_HYPER_CR3_MISMATCH: 847 case VERR_VMM_RING3_CALL_DISABLED: 846 848 case VERR_INTERNAL_ERROR: 847 849 case VERR_INTERNAL_ERROR_2: … … 2574 2576 case VERR_VMM_RING0_ASSERTION: 2575 2577 case VERR_VMM_HYPER_CR3_MISMATCH: 2578 case VERR_VMM_RING3_CALL_DISABLED: 2576 2579 break; 2577 2580 -
trunk/src/VBox/VMM/Makefile.kmk
r20541 r20871 322 322 VMMGC/HWACCMGCA.asm \ 323 323 VMMRZ/DBGFRZ.cpp \ 324 VMMRZ/VMMRZ.cpp \ 324 325 VMMAll/CPUMAllRegs.cpp \ 325 326 VMMAll/CPUMAllA.asm \ … … 415 416 VMMR0/VMMR0.cpp \ 416 417 VMMRZ/DBGFRZ.cpp \ 418 VMMRZ/VMMRZ.cpp \ 417 419 VMMAll/CPUMAllA.asm \ 418 420 VMMAll/CPUMAllRegs.cpp \ -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r20795 r20871 4365 4365 4366 4366 # ifdef IN_RC 4367 /* NOTE: We can't deal with jumps to ring 3 here as we're now in an inconsistent state! */ 4368 bool fLog = VMMGCLogDisable(pVM); 4367 /* 4368 * WARNING! We can't deal with jumps to ring 3 in the code below as the 4369 * state will be inconsistent! Flush important things now while 4370 * we still can and then make sure there are no ring-3 calls. 4371 */ 4372 REMNotifyHandlerPhysicalFlushIfAlmostFull(pVM, pVCpu); 4373 VMMRZCallRing3Disable(pVCpu); 4369 4374 # endif 4370 4375 … … 4401 4406 4402 4407 # ifdef IN_RC 4403 VMMGCLogRestore(pVM, fLog); 4408 /* NOTE: The state is consistent again. */ 4409 VMMRZCallRing3Enable(pVCpu); 4404 4410 # endif 4405 4411 -
trunk/src/VBox/VMM/VMMAll/REMAll.cpp
r20869 r20871 22 22 23 23 /******************************************************************************* 24 * Global Variables*24 * Header Files * 25 25 *******************************************************************************/ 26 26 #define LOG_GROUP LOG_GROUP_REM … … 80 80 81 81 /** 82 * Flushes the handler notifications by calling the host.83 *84 * @param pVM The VM handle.85 */86 static void remFlushHandlerNotifications(PVM pVM)87 {88 #ifdef IN_RC89 VMMGCCallHost(pVM, VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS, 0);90 #elif defined(IN_RING0)91 /** @todo necessary? */92 VMMR0CallHost(pVM, VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS, 0);93 #else94 AssertReleaseMsgFailed(("Ring 3 call????.\n"));95 #endif96 }97 98 99 /**100 82 * Insert pending notification 101 83 * … … 120 102 Assert(cFlushes++ != 128); 121 103 AssertFatal(cFlushes < _1M); 122 remFlushHandlerNotifications(pVM);104 VMMRZCallRing3NoCpu(pVM, VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS, 0); 123 105 idxFree = ASMAtomicUoReadU32(&pVM->rem.s.idxFreeList); 124 106 } while (idxFree == (uint32_t)-1); … … 145 127 146 128 VM_FF_SET(pVM, VM_FF_REM_HANDLER_NOTIFY); 147 148 #if 0 /* Enable this to trigger odd flush bugs. */149 remFlushHandlerNotifications(pVM);150 #endif151 129 } 152 130 … … 222 200 #endif /* !IN_RING3 */ 223 201 202 #ifdef IN_RC 203 /** 204 * Flushes the physical handler notifications if the queue is almost full. 205 * 206 * This is for avoiding trouble in RC when changing CR3. 207 * 208 * @param pVM The VM handle. 209 * @param pVCpu The virtual CPU handle of the calling EMT. 210 */ 211 VMMDECL(void) REMNotifyHandlerPhysicalFlushIfAlmostFull(PVM pVM, PVMCPU pVCpu) 212 { 213 Assert(pVM->cCPUs == 1); 214 215 /* 216 * Less than 10 items means we should flush. 217 */ 218 uint32_t cFree = 0; 219 for (uint32_t idx = pVM->rem.s.idxFreeList; 220 idx != UINT32_MAX; 221 idx = pVM->rem.s.aHandlerNotifications[idx].idxNext) 222 { 223 Assert(idx < RT_ELEMENTS(pVM->rem.s.aHandlerNotifications)); 224 if (++cFree > 10) 225 return; 226 } 227 228 /* Ok, we gotta flush them. */ 229 VMMRZCallRing3NoCpu(pVM, VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS, 0); 230 } 231 #endif /* IN_RC */ 232 233 224 234 /** 225 235 * Make REM flush all translation block upon the next call to REMR3State(). -
trunk/src/VBox/VMM/VMMGC/VMMGC.cpp
r19434 r20871 190 190 && pVM->vmm.s.pRCLoggerRC->offScratch >= (sizeof(pVM->vmm.s.pRCLoggerRC->achScratch)*3/4)) 191 191 { 192 if (pVM->vmm.s.fRCLoggerFlushingDisabled) 193 return; /* fail quietly. */ 192 194 VMMGCCallHost(pVM, VMMCALLHOST_VMM_LOGGER_FLUSH, 0); 193 195 } 194 }195 196 /**197 * Disables the GC logger temporarily, restore with VMMGCLogRestore.198 *199 * @param pVM The VM handle.200 */201 VMMRCDECL(bool) VMMGCLogDisable(PVM pVM)202 {203 bool fLog = pVM->vmm.s.pRCLoggerRC204 && !(pVM->vmm.s.pRCLoggerRC->fFlags & RTLOGFLAGS_DISABLED);205 if (fLog)206 pVM->vmm.s.pRCLoggerRC->fFlags |= RTLOGFLAGS_DISABLED;207 return fLog;208 }209 210 211 /**212 * Restores the GC logger after a call to VMMGCLogDisable.213 *214 * @param pVM The VM handle.215 * @param fLog What VMMGCLogDisable returned.216 */217 VMMRCDECL(void) VMMGCLogRestore(PVM pVM, bool fLog)218 {219 if (fLog && pVM->vmm.s.pRCLoggerRC)220 pVM->vmm.s.pRCLoggerRC->fFlags &= ~RTLOGFLAGS_DISABLED;221 196 } 222 197 … … 241 216 * @param enmOperation The operation. 242 217 * @param uArg The argument to the operation. 218 * 219 * @deprecated Use VMMRZCallRing3. 243 220 */ 244 221 VMMRCDECL(int) VMMGCCallHost(PVM pVM, VMMCALLHOST enmOperation, uint64_t uArg) 245 222 { 246 PVMCPU pVCpu = VMMGetCpu0(pVM); 247 248 /** @todo profile this! */ 249 pVCpu->vmm.s.enmCallHostOperation = enmOperation; 250 pVCpu->vmm.s.u64CallHostArg = uArg; 251 pVCpu->vmm.s.rcCallHost = VERR_INTERNAL_ERROR; 252 pVM->vmm.s.pfnGuestToHostRC(VINF_VMM_CALL_HOST); 253 return pVCpu->vmm.s.rcCallHost; 223 return VMMRZCallRing3(pVM, VMMGetCpu0(pVM), enmOperation, uArg); 254 224 } 255 225 -
trunk/src/VBox/VMM/VMMGuruMeditation.cpp
r20869 r20871 245 245 case VERR_VMM_RING0_ASSERTION: 246 246 case VINF_EM_DBG_HYPER_ASSERTION: 247 case VERR_VMM_RING3_CALL_DISABLED: 247 248 { 248 249 const char *pszMsg1 = VMMR3GetRZAssertMsg1(pVM); -
trunk/src/VBox/VMM/VMMInternal.h
r20854 r20871 254 254 * This may differ from cbRCLogger. */ 255 255 uint32_t cbRCRelLogger; 256 /** Whether log flushing has been disabled or not. */ 257 bool fRCLoggerFlushingDisabled; 258 bool afAlignment[7]; /**< Alignment padding. */ 256 259 /** @} */ 257 260 … … 397 400 #endif 398 401 399 /** @name CallHost 402 /** @name Call Ring-3 403 * Formerly known as host calls. 400 404 * @{ */ 405 /** The disable counter. */ 406 uint32_t cCallRing3Disabled; 401 407 /** The pending operation. */ 402 408 VMMCALLHOST enmCallHostOperation; 403 409 /** The result of the last operation. */ 404 410 int32_t rcCallHost; 405 #if HC_ARCH_BITS == 32411 #if HC_ARCH_BITS == 64 406 412 uint32_t padding; 407 413 #endif -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r20854 r20871 314 314 * @param enmOperation The operation. 315 315 * @param uArg The argument to the operation. 316 * 317 * @deprecated Use VMMRZCallRing3. 316 318 */ 317 319 VMMR0DECL(int) VMMR0CallHost(PVM pVM, VMMCALLHOST enmOperation, uint64_t uArg) 318 320 { 319 PVMCPU pVCpu = VMMGetCpu(pVM); 320 321 /** @todo profile this! */ 322 pVCpu->vmm.s.enmCallHostOperation = enmOperation; 323 pVCpu->vmm.s.u64CallHostArg = uArg; 324 pVCpu->vmm.s.rcCallHost = VERR_INTERNAL_ERROR; 325 int rc = vmmR0CallHostLongJmp(&pVCpu->vmm.s.CallHostR0JmpBuf, VINF_VMM_CALL_HOST); 326 if (rc == VINF_SUCCESS) 327 rc = pVCpu->vmm.s.rcCallHost; 328 return rc; 321 return VMMRZCallRing3(pVM, VMMGetCpu(pVM), enmOperation, uArg); 329 322 } 330 323 -
trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
r20808 r20871 903 903 GEN_CHECK_OFF(VMM, pRCLoggerR3); 904 904 GEN_CHECK_OFF(VMM, cbRCLogger); 905 GEN_CHECK_OFF(VMM, fRCLoggerFlushingDisabled); 905 906 GEN_CHECK_OFF(VMM, pYieldTimer); 906 907 GEN_CHECK_OFF(VMM, cYieldResumeMillies); … … 931 932 GEN_CHECK_OFF(VMMCPU, pR0LoggerR3); 932 933 #endif 934 GEN_CHECK_OFF(VMMCPU, cCallRing3Disabled); 933 935 GEN_CHECK_OFF(VMMCPU, enmCallHostOperation); 934 936 GEN_CHECK_OFF(VMMCPU, rcCallHost);
Note:
See TracChangeset
for help on using the changeset viewer.