- Timestamp:
- Jan 23, 2013 4:20:07 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83296
- Location:
- trunk
- Files:
-
- 2 deleted
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dbggui.h
r28800 r44340 98 98 * 99 99 * @returns VBox status code. 100 * @param p VMThe VM handle.100 * @param pUVM The VM handle. 101 101 * @param ppGui Where to store the pointer to the debugger instance. 102 102 * @param ppGuiVT Where to store the virtual method table pointer. 103 103 * Optional. 104 104 */ 105 DBGDECL(int) DBGGuiCreateForVM(P VM pVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT);105 DBGDECL(int) DBGGuiCreateForVM(PUVM pUVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT); 106 106 /** @copydoc DBGGuiCreateForVM. */ 107 typedef DECLCALLBACK(int) FNDBGGUICREATEFORVM(P VM pVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT);107 typedef DECLCALLBACK(int) FNDBGGUICREATEFORVM(PUVM pUVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT); 108 108 /** Pointer to DBGGuiCreateForVM. */ 109 109 typedef FNDBGGUICREATEFORVM *PFNDBGGUICREATEFORVM; -
trunk/include/VBox/vmm/cfgm.h
r39853 r44340 186 186 */ 187 187 VMMR3DECL(PCFGMNODE) CFGMR3GetRoot(PVM pVM); 188 VMMR3DECL(PCFGMNODE) CFGMR3GetRootU(PUVM pUVM); 188 189 VMMR3DECL(PCFGMNODE) CFGMR3GetParent(PCFGMNODE pNode); 189 190 VMMR3DECL(PCFGMNODE) CFGMR3GetParentEx(PVM pVM, PCFGMNODE pNode); -
trunk/include/VBox/vmm/em.h
r43394 r44340 225 225 * @{ 226 226 */ 227 VMMR3DECL(int) EMR3Init(PVM pVM);228 VMMR3DECL(void) EMR3Relocate(PVM pVM);229 VMMR3DECL(void) EMR3ResetCpu(PVMCPU pVCpu);230 VMMR3DECL(void) EMR3Reset(PVM pVM);231 VMMR3DECL(int) EMR3Term(PVM pVM);227 VMMR3DECL(int) EMR3Init(PVM pVM); 228 VMMR3DECL(void) EMR3Relocate(PVM pVM); 229 VMMR3DECL(void) EMR3ResetCpu(PVMCPU pVCpu); 230 VMMR3DECL(void) EMR3Reset(PVM pVM); 231 VMMR3DECL(int) EMR3Term(PVM pVM); 232 232 VMMR3DECL(DECLNORETURN(void)) EMR3FatalError(PVMCPU pVCpu, int rc); 233 VMMR3DECL(int) EMR3ExecuteVM(PVM pVM, PVMCPU pVCpu); 234 VMMR3DECL(int) EMR3CheckRawForcedActions(PVM pVM, PVMCPU pVCpu); 235 VMMR3DECL(int) EMR3Interpret(PVM pVM); 233 VMMR3DECL(int) EMR3ExecuteVM(PVM pVM, PVMCPU pVCpu); 234 VMMR3DECL(int) EMR3CheckRawForcedActions(PVM pVM, PVMCPU pVCpu); 235 VMMR3DECL(int) EMR3Interpret(PVM pVM); 236 VMMR3_INT_DECL(int) EMR3NotifyResume(PVM pVM); 237 VMMR3_INT_DECL(int) EMR3NotifySuspend(PVM pVM); 238 VMMR3_INT_DECL(bool) EMR3IsExecutionAllowed(PVM pVM, PVMCPU pVCpu); 236 239 237 240 /** -
trunk/include/VBox/vmm/vmapi.h
r43387 r44340 316 316 } VMINITCOMPLETED; 317 317 318 319 VMMR3DECL(int) VMR3Create(uint32_t cCpus, PCVMM2USERMETHODS pVm2UserCbs,320 PFNVMATERROR pfnVMAtError, void *pvUserVM,321 PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM,322 PVM *ppVM);323 VMMR3DECL(int) VMR3PowerOn(PVM pVM);324 VMMR3DECL(int) VMR3Suspend(PVM pVM);325 VMMR3DECL(int) VMR3Resume(PVM pVM);326 VMMR3DECL(int) VMR3Reset(PVM pVM);327 328 318 /** 329 319 * Progress callback. … … 340 330 typedef FNVMPROGRESS *PFNVMPROGRESS; 341 331 342 VMMR3DECL(int) VMR3Save(PVM pVM, const char *pszFilename, bool fContinueAfterwards, PFNVMPROGRESS pfnProgress, void *pvUser, bool *pfSuspended); 343 VMMR3DECL(int) VMR3Teleport(PVM pVM, uint32_t cMsDowntime, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, PFNVMPROGRESS pfnProgress, void *pvProgressUser, bool *pfSuspended); 344 VMMR3DECL(int) VMR3LoadFromFile(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser); 345 VMMR3DECL(int) VMR3LoadFromStream(PVM pVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, 346 PFNVMPROGRESS pfnProgress, void *pvProgressUser); 347 VMMR3DECL(int) VMR3PowerOff(PVM pVM); 348 VMMR3DECL(int) VMR3Destroy(PVM pVM); 349 VMMR3DECL(void) VMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 350 VMMR3DECL(PVM) VMR3EnumVMs(PVM pVMPrev); 332 /** 333 * VM destruction callback. 334 * @param pVM The VM which is about to be destroyed. 335 * @param pvUser The user parameter specified at registration. 336 */ 337 typedef DECLCALLBACK(void) FNVMATDTOR(PVM pVM, void *pvUser); 338 /** Pointer to a VM destruction callback. */ 339 typedef FNVMATDTOR *PFNVMATDTOR; 340 341 342 VMMR3DECL(int) VMR3Create(uint32_t cCpus, PCVMM2USERMETHODS pVm2UserCbs, 343 PFNVMATERROR pfnVMAtError, void *pvUserVM, 344 PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, 345 PVM *ppVM, PUVM *ppUVM); 346 VMMR3DECL(int) VMR3PowerOn(PUVM pUVM); 347 VMMR3DECL(int) VMR3Suspend(PUVM pUVM); 348 VMMR3DECL(int) VMR3Resume(PUVM pUVM); 349 VMMR3DECL(int) VMR3Reset(PUVM pUVM); 350 VMMR3DECL(int) VMR3Save(PUVM pUVM, const char *pszFilename, bool fContinueAfterwards, PFNVMPROGRESS pfnProgress, void *pvUser, bool *pfSuspended); 351 VMMR3_INT_DECL(int) VMR3SaveFT(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, bool *pfSuspended, bool fSkipStateChanges); 352 VMMR3DECL(int) VMR3Teleport(PUVM pUVM, uint32_t cMsDowntime, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, PFNVMPROGRESS pfnProgress, void *pvProgressUser, bool *pfSuspended); 353 VMMR3DECL(int) VMR3LoadFromFile(PUVM pUVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser); 354 VMMR3DECL(int) VMR3LoadFromStream(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, 355 PFNVMPROGRESS pfnProgress, void *pvProgressUser); 356 VMMR3_INT_DECL(int) VMR3LoadFromStreamFT(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser); 357 358 VMMR3DECL(int) VMR3PowerOff(PUVM pUVM); 359 VMMR3DECL(int) VMR3Destroy(PUVM pUVM); 360 VMMR3_INT_DECL(void) VMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 351 361 352 362 VMMR3DECL(PVM) VMR3GetVM(PUVM pUVM); … … 359 369 VMMR3DECL(VMSTATE) VMR3GetStateU(PUVM pUVM); 360 370 VMMR3DECL(const char *) VMR3GetStateName(VMSTATE enmState); 361 362 /** 363 * VM destruction callback. 364 * @param pVM The VM which is about to be destroyed. 365 * @param pvUser The user parameter specified at registration. 366 */ 367 typedef DECLCALLBACK(void) FNVMATDTOR(PVM pVM, void *pvUser); 368 /** Pointer to a VM destruction callback. */ 369 typedef FNVMATDTOR *PFNVMATDTOR; 370 371 VMMR3DECL(int) VMR3AtDtorRegister(PFNVMATDTOR pfnAtDtor, void *pvUser); 372 VMMR3DECL(int) VMR3AtDtorDeregister(PFNVMATDTOR pfnAtDtor); 373 VMMR3DECL(int) VMR3AtStateRegister(PVM pVM, PFNVMATSTATE pfnAtState, void *pvUser); 374 VMMR3DECL(int) VMR3AtStateDeregister(PVM pVM, PFNVMATSTATE pfnAtState, void *pvUser); 375 VMMR3DECL(bool) VMR3TeleportedAndNotFullyResumedYet(PVM pVM); 376 VMMR3DECL(int) VMR3AtErrorRegister(PVM pVM, PFNVMATERROR pfnAtError, void *pvUser); 377 VMMR3DECL(int) VMR3AtErrorRegisterU(PUVM pVM, PFNVMATERROR pfnAtError, void *pvUser); 378 VMMR3DECL(int) VMR3AtErrorDeregister(PVM pVM, PFNVMATERROR pfnAtError, void *pvUser); 379 VMMR3DECL(void) VMR3SetErrorWorker(PVM pVM); 380 VMMR3DECL(uint32_t) VMR3GetErrorCount(PVM pVM); 381 VMMR3DECL(uint32_t) VMR3GetErrorCountU(PUVM pUVM); 382 VMMR3DECL(int) VMR3AtRuntimeErrorRegister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser); 383 VMMR3DECL(int) VMR3AtRuntimeErrorDeregister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser); 384 VMMR3DECL(int) VMR3SetRuntimeErrorWorker(PVM pVM); 385 VMMR3DECL(uint32_t) VMR3GetRuntimeErrorCount(PVM pVM); 386 VMMR3DECL(int) VMR3ReqCall(PVM pVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, ...); 387 VMMR3DECL(int) VMR3ReqCallU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, ...); 388 VMMR3DECL(int) VMR3ReqCallVU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, va_list Args); 389 VMMR3DECL(int) VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 390 VMMR3DECL(int) VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 391 VMMR3DECL(int) VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 392 VMMR3DECL(int) VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 393 VMMR3DECL(int) VMR3ReqPriorityCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 394 VMMR3DECL(int) VMR3ReqPriorityCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 395 VMMR3DECL(int) VMR3ReqAlloc(PVM pVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu); 396 VMMR3DECL(int) VMR3ReqAllocU(PUVM pUVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu); 397 VMMR3DECL(int) VMR3ReqFree(PVMREQ pReq); 398 VMMR3DECL(int) VMR3ReqQueue(PVMREQ pReq, RTMSINTERVAL cMillies); 399 VMMR3DECL(int) VMR3ReqWait(PVMREQ pReq, RTMSINTERVAL cMillies); 400 VMMR3DECL(int) VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu, bool fPriorityOnly); 401 VMMR3DECL(void) VMR3NotifyGlobalFFU(PUVM pUVM, uint32_t fFlags); 402 VMMR3DECL(void) VMR3NotifyCpuFFU(PUVMCPU pUVMCpu, uint32_t fFlags); 371 VMMR3DECL(int) VMR3AtStateRegister(PUVM pUVM, PFNVMATSTATE pfnAtState, void *pvUser); 372 VMMR3DECL(int) VMR3AtStateDeregister(PUVM pUVM, PFNVMATSTATE pfnAtState, void *pvUser); 373 VMMR3_INT_DECL(bool) VMR3TeleportedAndNotFullyResumedYet(PVM pVM); 374 VMMR3DECL(int) VMR3AtErrorRegister(PUVM pUVM, PFNVMATERROR pfnAtError, void *pvUser); 375 VMMR3DECL(int) VMR3AtErrorDeregister(PUVM pUVM, PFNVMATERROR pfnAtError, void *pvUser); 376 VMMR3_INT_DECL(void) VMR3SetErrorWorker(PVM pVM); 377 VMMR3_INT_DECL(uint32_t) VMR3GetErrorCount(PUVM pUVM); 378 VMMR3DECL(int) VMR3AtRuntimeErrorRegister(PUVM pUVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser); 379 VMMR3DECL(int) VMR3AtRuntimeErrorDeregister(PUVM pUVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser); 380 VMMR3_INT_DECL(int) VMR3SetRuntimeErrorWorker(PVM pVM); 381 VMMR3_INT_DECL(uint32_t) VMR3GetRuntimeErrorCount(PUVM pUVM); 382 383 VMMR3DECL(int) VMR3ReqCallU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, ...); 384 VMMR3DECL(int) VMR3ReqCallVU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, va_list Args); 385 VMMR3_INT_DECL(int) VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 386 VMMR3DECL(int) VMR3ReqCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 387 VMMR3DECL(int) VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 388 VMMR3DECL(int) VMR3ReqCallNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 389 VMMR3_INT_DECL(int) VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 390 VMMR3DECL(int) VMR3ReqCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 391 VMMR3DECL(int) VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 392 VMMR3DECL(int) VMR3ReqPriorityCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 393 VMMR3DECL(int) VMR3ReqPriorityCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 394 VMMR3DECL(int) VMR3ReqPriorityCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...); 395 VMMR3DECL(int) VMR3ReqAlloc(PUVM pUVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu); 396 VMMR3DECL(int) VMR3ReqFree(PVMREQ pReq); 397 VMMR3DECL(int) VMR3ReqQueue(PVMREQ pReq, RTMSINTERVAL cMillies); 398 VMMR3DECL(int) VMR3ReqWait(PVMREQ pReq, RTMSINTERVAL cMillies); 399 VMMR3_INT_DECL(int) VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu, bool fPriorityOnly); 400 403 401 /** @name Flags for VMR3NotifyCpuFFU and VMR3NotifyGlobalFFU. 404 402 * @{ */ … … 408 406 #define VMNOTIFYFF_FLAGS_POKE RT_BIT_32(1) 409 407 /** @} */ 410 411 VMMR3DECL(int) VMR3WaitHalted(PVM pVM, PVMCPU pVCpu, bool fIgnoreInterrupts); 412 VMMR3DECL(int) VMR3WaitU(PUVMCPU pUVMCpu); 408 VMMR3_INT_DECL(void) VMR3NotifyGlobalFFU(PUVM pUVM, uint32_t fFlags); 409 VMMR3_INT_DECL(void) VMR3NotifyCpuFFU(PUVMCPU pUVMCpu, uint32_t fFlags); 410 VMMR3_INT_DECL(int) VMR3WaitHalted(PVM pVM, PVMCPU pVCpu, bool fIgnoreInterrupts); 411 VMMR3_INT_DECL(int) VMR3WaitU(PUVMCPU pUVMCpu); 413 412 VMMR3_INT_DECL(int) VMR3AsyncPdmNotificationWaitU(PUVMCPU pUVCpu); 414 413 VMMR3_INT_DECL(void) VMR3AsyncPdmNotificationWakeupU(PUVM pUVM); 415 VMMR3DECL(RTCPUID) VMR3GetVMCPUId(PVM pVM); 416 VMMR3DECL(RTTHREAD) VMR3GetVMCPUThread(PVM pVM); 417 VMMR3DECL(RTTHREAD) VMR3GetVMCPUThreadU(PUVM pUVM); 414 VMMR3_INT_DECL(RTCPUID) VMR3GetVMCPUId(PVM pVM); 415 VMMR3DECL(RTTHREAD) VMR3GetVMCPUThread(PUVM pUVM); 418 416 VMMR3DECL(RTNATIVETHREAD) VMR3GetVMCPUNativeThread(PVM pVM); 419 417 VMMR3DECL(RTNATIVETHREAD) VMR3GetVMCPUNativeThreadU(PUVM pUVM); 420 VMMR3DECL(int) VMR3GetCpuCoreAndPackageIdFromCpuId(P VM pVM, VMCPUID idCpu, uint32_t *pidCpuCore, uint32_t *pidCpuPackage);421 VMMR3DECL(int) VMR3HotUnplugCpu(P VM pVM, VMCPUID idCpu);422 VMMR3DECL(int) VMR3HotPlugCpu(P VM pVM, VMCPUID idCpu);423 VMMR3DECL(int) VMR3SetCpuExecutionCap(P VM pVM, uint32_t uCpuExecutionCap);418 VMMR3DECL(int) VMR3GetCpuCoreAndPackageIdFromCpuId(PUVM pUVM, VMCPUID idCpu, uint32_t *pidCpuCore, uint32_t *pidCpuPackage); 419 VMMR3DECL(int) VMR3HotUnplugCpu(PUVM pUVM, VMCPUID idCpu); 420 VMMR3DECL(int) VMR3HotPlugCpu(PUVM pUVM, VMCPUID idCpu); 421 VMMR3DECL(int) VMR3SetCpuExecutionCap(PUVM pUVM, uint32_t uCpuExecutionCap); 424 422 /** @} */ 425 423 #endif /* IN_RING3 */ -
trunk/src/VBox/Debugger/VBoxDbg.cpp
r35346 r44340 72 72 * @returns VBox status code. 73 73 * @param pSession The ISession interface. (DBGGuiCreate) 74 * @param p VMThe VM handle. (DBGGuiCreateForVM)74 * @param pUVM The VM handle. (DBGGuiCreateForVM) 75 75 * @param ppGui See DBGGuiCreate. 76 76 * @param ppGuiVT See DBGGuiCreate. 77 77 */ 78 static int dbgGuiCreate(ISession *pSession, P VM pVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT)78 static int dbgGuiCreate(ISession *pSession, PUVM pUVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT) 79 79 { 80 80 /* … … 91 91 rc = pGui->pVBoxDbgGui->init(pSession); 92 92 else 93 rc = pGui->pVBoxDbgGui->init(p VM);93 rc = pGui->pVBoxDbgGui->init(pUVM); 94 94 if (RT_SUCCESS(rc)) 95 95 { … … 135 135 * 136 136 * @returns VBox status code. 137 * @param p VMThe VM handle.137 * @param pUVM The VM handle. 138 138 * @param ppGui Where to store the pointer to the debugger instance. 139 139 * @param ppGuiVT Where to store the virtual method table pointer. 140 140 * Optional. 141 141 */ 142 DBGDECL(int) DBGGuiCreateForVM(PVM pVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT) 143 { 144 AssertPtrReturn(pVM, VERR_INVALID_POINTER); 145 return dbgGuiCreate(NULL, pVM, ppGui, ppGuiVT); 142 DBGDECL(int) DBGGuiCreateForVM(PUVM pUVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT) 143 { 144 AssertPtrReturn(pUVM, VERR_INVALID_POINTER); 145 AssertPtrReturn(VMR3RetainUVM(pUVM) != UINT32_MAX, VERR_INVALID_POINTER); 146 147 int rc = dbgGuiCreate(NULL, pUVM, ppGui, ppGuiVT); 148 149 VMR3ReleaseUVM(pUVM); 150 return rc; 146 151 } 147 152 -
trunk/src/VBox/Debugger/VBoxDbgBase.cpp
r38812 r44340 33 33 34 34 VBoxDbgBase::VBoxDbgBase(VBoxDbgGui *a_pDbgGui) 35 : m_pDbgGui(a_pDbgGui), m_p VM(NULL), m_hGUIThread(RTThreadNativeSelf())35 : m_pDbgGui(a_pDbgGui), m_pUVM(NULL), m_hGUIThread(RTThreadNativeSelf()) 36 36 { 37 37 /* 38 38 * Register 39 39 */ 40 PVM pVM = a_pDbgGui->getVMHandle(); 41 if (pVM) 42 { 43 m_pVM = pVM; 44 int rc = VMR3AtStateRegister(pVM, atStateChange, this); 40 m_pUVM = a_pDbgGui->getUvmHandle(); 41 if (m_pUVM) 42 { 43 VMR3RetainUVM(m_pUVM); 44 45 int rc = VMR3AtStateRegister(m_pUVM, atStateChange, this); 45 46 AssertRC(rc); 46 47 } … … 54 55 */ 55 56 /** @todo need to do some locking here? */ 56 P VM pVM = ASMAtomicXchgPtrT(&m_pVM, NULL, PVM);57 if (p VM)58 { 59 int rc = VMR3AtStateDeregister(p VM, atStateChange, this);57 PUVM pUVM = ASMAtomicXchgPtrT(&m_pUVM, NULL, PUVM); 58 if (pUVM) 59 { 60 int rc = VMR3AtStateDeregister(pUVM, atStateChange, this); 60 61 AssertRC(rc); 62 63 VMR3ReleaseUVM(pUVM); 61 64 } 62 65 } … … 68 71 QByteArray Utf8Array = rPat.toUtf8(); 69 72 const char *pszPat = !rPat.isEmpty() ? Utf8Array.constData() : NULL; 70 P VM pVM = m_pVM;71 if ( p VM72 && VMR3GetState (pVM) < VMSTATE_DESTROYING)73 return STAMR3Reset( pVM, pszPat);73 PUVM pUVM = m_pUVM; 74 if ( pUVM 75 && VMR3GetStateU(pUVM) < VMSTATE_DESTROYING) 76 return STAMR3Reset(VMR3GetVM(pUVM), pszPat); 74 77 return VERR_INVALID_HANDLE; 75 78 } … … 81 84 QByteArray Utf8Array = rPat.toUtf8(); 82 85 const char *pszPat = !rPat.isEmpty() ? Utf8Array.constData() : NULL; 83 P VM pVM = m_pVM;84 if ( p VM85 && VMR3GetState (pVM) < VMSTATE_DESTROYING)86 return STAMR3Enum( pVM, pszPat, pfnEnum, pvUser);86 PUVM pUVM = m_pUVM; 87 if ( pUVM 88 && VMR3GetStateU(pUVM) < VMSTATE_DESTROYING) 89 return STAMR3Enum(VMR3GetVM(pUVM), pszPat, pfnEnum, pvUser); 87 90 return VERR_INVALID_HANDLE; 88 91 } … … 92 95 VBoxDbgBase::dbgcCreate(PDBGCBACK pBack, unsigned fFlags) 93 96 { 94 P VM pVM = m_pVM;95 if ( p VM96 && VMR3GetState (pVM) < VMSTATE_DESTROYING)97 return DBGCCreate( pVM, pBack, fFlags);97 PUVM pUVM = m_pUVM; 98 if ( pUVM 99 && VMR3GetStateU(pUVM) < VMSTATE_DESTROYING) 100 return DBGCCreate(VMR3GetVM(pUVM), pBack, fFlags); 98 101 return VERR_INVALID_HANDLE; 99 102 } … … 107 110 { 108 111 case VMSTATE_TERMINATED: 112 { 109 113 /** @todo need to do some locking here? */ 110 if (ASMAtomicCmpXchgPtr(&pThis->m_pVM, NULL, pVM)) 114 PUVM pUVM = ASMAtomicXchgPtrT(&m_pUVM, NULL, PUVM); 115 if (pUVM) 116 { 111 117 pThis->sigTerminated(); 118 VMR3ReleaseUVM(pUVM); 119 } 112 120 break; 121 } 113 122 114 123 case VMSTATE_DESTROYING: -
trunk/src/VBox/Debugger/VBoxDbgBase.h
r35346 r44340 60 60 bool isVMOk() const 61 61 { 62 return m_p VM != NULL;62 return m_pUVM != NULL; 63 63 } 64 64 … … 120 120 /** Pointer to the debugger GUI object. */ 121 121 VBoxDbgGui *m_pDbgGui; 122 /** The VM handle. */123 P VM volatile m_pVM;122 /** The user mode VM handle. */ 123 PUVM volatile m_pUVM; 124 124 /** The handle of the GUI thread. */ 125 125 RTNATIVETHREAD m_hGUIThread; -
trunk/src/VBox/Debugger/VBoxDbgGui.cpp
r35346 r44340 33 33 VBoxDbgGui::VBoxDbgGui() : 34 34 m_pDbgStats(NULL), m_pDbgConsole(NULL), m_pSession(NULL), m_pConsole(NULL), 35 m_pMachineDebugger(NULL), m_pMachine(NULL), m_p VM(NULL),35 m_pMachineDebugger(NULL), m_pMachine(NULL), m_pUVM(NULL), 36 36 m_pParent(NULL), m_pMenu(NULL), 37 37 m_x(0), m_y(0), m_cx(0), m_cy(0), m_xDesktop(0), m_yDesktop(0), m_cxDesktop(0), m_cyDesktop(0) … … 41 41 42 42 43 int VBoxDbgGui::init(P VM pVM)43 int VBoxDbgGui::init(PUVM pUVM) 44 44 { 45 45 /* 46 46 * Set the VM handle and update the desktop size. 47 47 */ 48 m_p VM = pVM;48 m_pUVM = pUVM; /* Note! This eats the incoming reference to the handle! */ 49 49 updateDesktopSize(); 50 50 … … 79 79 if (SUCCEEDED(hrc)) 80 80 { 81 rc = init((PVM)(intptr_t)llVM); 81 PUVM pUVM = (PUVM)(intptr_t)llVM; 82 rc = init(pUVM); 82 83 if (RT_SUCCESS(rc)) 83 84 return rc; 85 86 VMR3ReleaseUVM(pUVM); 84 87 } 85 88 … … 137 140 } 138 141 139 m_pVM = NULL; 142 if (m_pUVM) 143 { 144 VMR3ReleaseUVM(m_pUVM); 145 m_pUVM = NULL; 146 } 140 147 } 141 148 -
trunk/src/VBox/Debugger/VBoxDbgGui.h
r33540 r44340 58 58 * 59 59 * @returns VBox status code. 60 * @param pVM The VM handle. 60 * @param pUVM The user mode VM handle. The caller's reference will be 61 * consumed on success. 61 62 */ 62 int init(P VM pVM);63 int init(PUVM pUVM); 63 64 64 65 /** … … 129 130 130 131 /** 131 * Gets the VM handle.132 * @returns The VM handle.132 * Gets the user mode VM handle. 133 * @returns The UVM handle. 133 134 */ 134 P VM getVMHandle() const135 PUVM getUvmHandle() const 135 136 { 136 return m_p VM;137 return m_pUVM; 137 138 } 138 139 … … 162 163 /** The VM instance. */ 163 164 PVM m_pVM; 165 /** The user mode VM handle. */ 166 PUVM m_pUVM; 164 167 165 168 /** The parent widget. */ -
trunk/src/VBox/Debugger/testcase/tstVBoxDbg.cpp
r38636 r44340 46 46 */ 47 47 PVM pVM; 48 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 48 PUVM pUVM; 49 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM, &pUVM); 49 50 if (RT_SUCCESS(rc)) 50 51 { … … 55 56 PDBGGUI pGui; 56 57 PCDBGGUIVT pGuiVT; 57 rc = DBGGuiCreateForVM(p VM, &pGui, &pGuiVT);58 rc = DBGGuiCreateForVM(pUVM, &pGui, &pGuiVT); 58 59 if (RT_SUCCESS(rc)) 59 60 { … … 93 94 * Cleanup. 94 95 */ 95 rc = VMR3Destroy(p VM);96 rc = VMR3Destroy(pUVM); 96 97 if (!RT_SUCCESS(rc)) 97 98 { … … 99 100 cErrors++; 100 101 } 102 VMR3ReleaseUVM(pUVM); 101 103 } 102 104 else -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r44322 r44340 15424 15424 <attribute name="VM" type="long long" readonly="yes" wsmap="suppress"> 15425 15425 <desc> 15426 Gets the VM handle. This is only for internal use while 15427 we carve the details of this interface. 15426 Gets the user-mode VM handle, with a reference. Must be passed to 15427 VMR3ReleaseUVM when done. This is only for internal use while we carve 15428 the details of this interface. 15428 15429 </desc> 15429 15430 </attribute> -
trunk/src/VBox/Main/include/ConsoleImpl.h
r44191 r44340 544 544 bool fForceUnmount, 545 545 bool fHotplug, 546 P VM pVM,546 PUVM pUVM, 547 547 DeviceType_T *paLedDevType); 548 548 int configMedium(PCFGMNODE pLunL0, … … 560 560 HRESULT *phrc); 561 561 static DECLCALLBACK(int) reconfigureMediumAttachment(Console *pConsole, 562 P VM pVM,562 PUVM pUVM, 563 563 const char *pcszDevice, 564 564 unsigned uInstance, … … 573 573 HRESULT *phrc); 574 574 static DECLCALLBACK(int) changeRemovableMedium(Console *pThis, 575 P VM pVM,575 PUVM pUVM, 576 576 const char *pcszDevice, 577 577 unsigned uInstance, … … 592 592 bool fAttachDetach, bool fIgnoreConnectFailure); 593 593 594 static DECLCALLBACK(int) configGuestProperties(void *pvConsole, P VM pVM);594 static DECLCALLBACK(int) configGuestProperties(void *pvConsole, PUVM pUVM); 595 595 static DECLCALLBACK(int) configGuestControl(void *pvConsole); 596 596 static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState, … … 598 598 static DECLCALLBACK(int) unplugCpu(Console *pThis, PVM pVM, unsigned uCpu); 599 599 static DECLCALLBACK(int) plugCpu(Console *pThis, PVM pVM, unsigned uCpu); 600 HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, P VM pVM);600 HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM); 601 601 HRESULT doCPURemove(ULONG aCpu, PVM pVM); 602 602 HRESULT doCPUAdd(ULONG aCpu, PVM pVM); 603 603 604 HRESULT doNetworkAdapterChange(P VM pVM, const char *pszDevice, unsigned uInstance,604 HRESULT doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance, 605 605 unsigned uLun, INetworkAdapter *aNetworkAdapter); 606 static DECLCALLBACK(int) changeNetworkAttachment(Console *pThis, P VM pVM, const char *pszDevice,606 static DECLCALLBACK(int) changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice, 607 607 unsigned uInstance, unsigned uLun, 608 608 INetworkAdapter *aNetworkAdapter); … … 615 615 HRESULT detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice); 616 616 617 static DECLCALLBACK(int) usbAttachCallback(Console *that, P VM pVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,617 static DECLCALLBACK(int) usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid, 618 618 bool aRemote, const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs); 619 static DECLCALLBACK(int) usbDetachCallback(Console *that, P VM pVM, PCRTUUID aUuid);619 static DECLCALLBACK(int) usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid); 620 620 #endif 621 621 622 622 static DECLCALLBACK(int) attachStorageDevice(Console *pThis, 623 P VM pVM,623 PUVM pUVM, 624 624 const char *pcszDevice, 625 625 unsigned uInstance, … … 628 628 IMediumAttachment *aMediumAtt); 629 629 static DECLCALLBACK(int) detachStorageDevice(Console *pThis, 630 P VM pVM,630 PUVM pUVM, 631 631 const char *pcszDevice, 632 632 unsigned uInstance, 633 633 StorageBus_T enmBus, 634 634 IMediumAttachment *aMediumAtt); 635 HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, P VM pVM);636 HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, P VM pVM);635 HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM); 636 HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM); 637 637 638 638 static DECLCALLBACK(int) fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser); … … 648 648 const char *pszErrorId, const char *pszFormat, va_list va); 649 649 650 HRESULT captureUSBDevices(P VM pVM);650 HRESULT captureUSBDevices(PUVM pUVM); 651 651 void detachAllUSBDevices(bool aDone); 652 652 -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r44288 r44340 157 157 mServerProgress(aServerProgress), 158 158 mpVM(NULL), 159 mpUVM(NULL), 159 160 mRC(E_FAIL), 160 161 mpSafeVMPtr(NULL) … … 168 169 mpSafeVMPtr = new Console::SafeVMPtr(aConsole); 169 170 if (mpSafeVMPtr->isOk()) 171 { 170 172 mpVM = mpSafeVMPtr->raw(); 173 mpUVM = mpSafeVMPtr->rawUVM(); 174 } 171 175 else 172 176 mRC = mpSafeVMPtr->rc(); … … 198 202 const ComPtr<IProgress> mServerProgress; 199 203 PVM mpVM; 204 PUVM mpUVM; 200 205 201 206 private: … … 2229 2234 alock.release(); 2230 2235 2231 int vrc = VMR3Reset(ptrVM );2236 int vrc = VMR3Reset(ptrVM.rawUVM()); 2232 2237 2233 2238 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : … … 2255 2260 HRESULT Console::doCPURemove(ULONG aCpu, PVM pVM) 2256 2261 { 2262 PUVM pUVM = VMR3GetUVM(pVM); 2257 2263 HRESULT rc = S_OK; 2258 2264 … … 2297 2303 /* Notify the guest if possible. */ 2298 2304 uint32_t idCpuCore, idCpuPackage; 2299 vrc = VMR3GetCpuCoreAndPackageIdFromCpuId(p VM, aCpu, &idCpuCore, &idCpuPackage); AssertRC(vrc);2305 vrc = VMR3GetCpuCoreAndPackageIdFromCpuId(pUVM, aCpu, &idCpuCore, &idCpuPackage); AssertRC(vrc); 2300 2306 if (RT_SUCCESS(vrc)) 2301 2307 vrc = pVmmDevPort->pfnCpuHotUnplug(pVmmDevPort, idCpuCore, idCpuPackage); … … 2329 2335 */ 2330 2336 PVMREQ pReq; 2331 vrc = VMR3ReqCall (pVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,2332 (PFNRT)Console::unplugCpu, 3,2333 this, pVM, aCpu);2337 vrc = VMR3ReqCallU(pUVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 2338 (PFNRT)Console::unplugCpu, 3, 2339 this, pVM, aCpu); 2334 2340 if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc)) 2335 2341 { … … 2344 2350 { 2345 2351 /* Detach it from the VM */ 2346 vrc = VMR3HotUnplugCpu(p VM, aCpu);2352 vrc = VMR3HotUnplugCpu(pUVM, aCpu); 2347 2353 AssertRC(vrc); 2348 2354 } … … 2362 2368 /*static*/ DECLCALLBACK(int) Console::plugCpu(Console *pThis, PVM pVM, unsigned uCpu) 2363 2369 { 2370 PUVM pUVM = VMR3GetUVM(pVM); 2364 2371 LogFlowFunc(("pThis=%p uCpu=%u\n", pThis, uCpu)); 2365 2372 2366 2373 AssertReturn(pThis, VERR_INVALID_PARAMETER); 2367 2374 2368 int rc = VMR3HotPlugCpu(p VM, uCpu);2375 int rc = VMR3HotPlugCpu(pUVM, uCpu); 2369 2376 AssertRC(rc); 2370 2377 2371 PCFGMNODE pInst = CFGMR3GetChild(CFGMR3GetRoot (pVM), "Devices/acpi/0/");2378 PCFGMNODE pInst = CFGMR3GetChild(CFGMR3GetRootU(pUVM), "Devices/acpi/0/"); 2372 2379 AssertRelease(pInst); 2373 2380 /* nuke anything which might have been left behind. */ … … 2399 2406 HRESULT Console::doCPUAdd(ULONG aCpu, PVM pVM) 2400 2407 { 2408 PUVM pUVM = VMR3GetUVM(pVM); 2401 2409 HRESULT rc = S_OK; 2402 2410 … … 2435 2443 */ 2436 2444 PVMREQ pReq; 2437 int vrc = VMR3ReqCall (pVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,2438 (PFNRT)Console::plugCpu, 3,2439 this, pVM, aCpu);2445 int vrc = VMR3ReqCallU(pUVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 2446 (PFNRT)Console::plugCpu, 3, 2447 this, pVM, aCpu); 2440 2448 2441 2449 /* release the lock before a VMR3* call (EMT will call us back)! */ … … 2460 2468 /* Notify the guest if possible. */ 2461 2469 uint32_t idCpuCore, idCpuPackage; 2462 vrc = VMR3GetCpuCoreAndPackageIdFromCpuId(p VM, aCpu, &idCpuCore, &idCpuPackage); AssertRC(vrc);2470 vrc = VMR3GetCpuCoreAndPackageIdFromCpuId(pUVM, aCpu, &idCpuCore, &idCpuPackage); AssertRC(vrc); 2463 2471 if (RT_SUCCESS(vrc)) 2464 2472 vrc = pDevPort->pfnCpuHotPlug(pDevPort, idCpuCore, idCpuPackage); … … 2506 2514 alock.release(); 2507 2515 2508 int vrc = VMR3Suspend(ptrVM );2516 int vrc = VMR3Suspend(ptrVM.rawUVM()); 2509 2517 2510 2518 HRESULT hrc = S_OK; … … 2548 2556 if (RT_SUCCESS(vrc)) 2549 2557 { 2550 if (VMR3GetState (ptrVM) == VMSTATE_CREATED)2551 vrc = VMR3PowerOn(ptrVM ); /* (PowerUpPaused) */2558 if (VMR3GetStateU(ptrVM.rawUVM()) == VMSTATE_CREATED) 2559 vrc = VMR3PowerOn(ptrVM.rawUVM()); /* (PowerUpPaused) */ 2552 2560 else 2553 vrc = VMR3Resume(ptrVM );2561 vrc = VMR3Resume(ptrVM.rawUVM()); 2554 2562 } 2555 2563 … … 2785 2793 /* release the lock before a VMR3* call (EMT will call us back)! */ 2786 2794 alock.release(); 2787 int vrc = VMR3Suspend(ptrVM );2795 int vrc = VMR3Suspend(ptrVM.rawUVM()); 2788 2796 alock.acquire(); 2789 2797 … … 2893 2901 { 2894 2902 alock.release(); 2895 VMR3Resume(ptrVM );2903 VMR3Resume(ptrVM.rawUVM()); 2896 2904 alock.acquire(); 2897 2905 } … … 3660 3668 * @param aMediumAttachment The medium attachment with the new medium state. 3661 3669 * @param fForce Force medium chance, if it is locked or not. 3662 * @param p VMSafe VM handle.3670 * @param pUVM Safe VM handle. 3663 3671 * 3664 3672 * @note Locks this object for writing. 3665 3673 */ 3666 HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, P VM pVM)3674 HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM) 3667 3675 { 3668 3676 AutoCaller autoCaller(this); … … 3728 3736 */ 3729 3737 PVMREQ pReq; 3730 int vrc = VMR3ReqCall (pVM,3731 VMCPUID_ANY,3732 &pReq,3733 0 /* no wait! */,3734 VMREQFLAGS_VBOX_STATUS,3735 (PFNRT)Console::changeRemovableMedium,3736 8,3737 this,3738 pVM,3739 pszDevice,3740 uInstance,3741 enmBus,3742 fUseHostIOCache,3743 aMediumAttachment,3744 fForce);3738 int vrc = VMR3ReqCallU(pUVM, 3739 VMCPUID_ANY, 3740 &pReq, 3741 0 /* no wait! */, 3742 VMREQFLAGS_VBOX_STATUS, 3743 (PFNRT)Console::changeRemovableMedium, 3744 8, 3745 this, 3746 pUVM, 3747 pszDevice, 3748 uInstance, 3749 enmBus, 3750 fUseHostIOCache, 3751 aMediumAttachment, 3752 fForce); 3745 3753 3746 3754 /* release the lock before waiting for a result (EMT will call us back!) */ … … 3778 3786 * 3779 3787 * @param pThis Pointer to the Console object. 3780 * @param p VMThe VM handle.3788 * @param pUVM The VM handle. 3781 3789 * @param pcszDevice The PDM device name. 3782 3790 * @param uInstance The PDM device instance. … … 3793 3801 */ 3794 3802 DECLCALLBACK(int) Console::changeRemovableMedium(Console *pConsole, 3795 P VM pVM,3803 PUVM pUVM, 3796 3804 const char *pcszDevice, 3797 3805 unsigned uInstance, … … 3816 3824 */ 3817 3825 bool fResume; 3818 VMSTATE enmVMState = VMR3GetState (pVM);3826 VMSTATE enmVMState = VMR3GetStateU(pUVM); 3819 3827 switch (enmVMState) 3820 3828 { … … 3825 3833 /* disable the callback to prevent Console-level state change */ 3826 3834 pConsole->mVMStateChangeCallbackDisabled = true; 3827 int rc = VMR3Suspend(p VM);3835 int rc = VMR3Suspend(pUVM); 3828 3836 pConsole->mVMStateChangeCallbackDisabled = false; 3829 3837 AssertRCReturn(rc, rc); … … 3853 3861 /* Determine the base path for the device instance. */ 3854 3862 PCFGMNODE pCtlInst; 3855 pCtlInst = CFGMR3GetChildF(CFGMR3GetRoot (pVM), "Devices/%s/%u/", pcszDevice, uInstance);3863 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 3856 3864 AssertReturn(pCtlInst, VERR_INTERNAL_ERROR); 3857 3865 … … 3874 3882 fForce /* fForceUnmount */, 3875 3883 false /* fHotplug */, 3876 p VM,3884 pUVM, 3877 3885 NULL /* paLedDevType */); 3878 3886 /** @todo this dumps everything attached to this device instance, which … … 3888 3896 /* disable the callback to prevent Console-level state change */ 3889 3897 pConsole->mVMStateChangeCallbackDisabled = true; 3890 rc = VMR3Resume(p VM);3898 rc = VMR3Resume(pUVM); 3891 3899 pConsole->mVMStateChangeCallbackDisabled = false; 3892 3900 AssertRC(rc); … … 3894 3902 { 3895 3903 /* too bad, we failed. try to sync the console state with the VMM state */ 3896 vmstateChangeCallback( pVM, VMSTATE_SUSPENDED, enmVMState, pConsole);3904 vmstateChangeCallback(VMR3GetVM(pUVM), VMSTATE_SUSPENDED, enmVMState, pConsole); 3897 3905 } 3898 3906 /// @todo (r=dmik) if we failed with drive mount, then the VMR3Resume … … 3914 3922 * 3915 3923 * @param aMediumAttachment The medium attachment which is added. 3916 * @param p VMSafe VM handle.3924 * @param pUVM Safe VM handle. 3917 3925 * 3918 3926 * @note Locks this object for writing. 3919 3927 */ 3920 HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, P VM pVM)3928 HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM) 3921 3929 { 3922 3930 AutoCaller autoCaller(this); … … 3982 3990 */ 3983 3991 PVMREQ pReq; 3984 int vrc = VMR3ReqCall (pVM,3985 VMCPUID_ANY,3986 &pReq,3987 0 /* no wait! */,3988 VMREQFLAGS_VBOX_STATUS,3989 (PFNRT)Console::attachStorageDevice,3990 7,3991 this,3992 pVM,3993 pszDevice,3994 uInstance,3995 enmBus,3996 fUseHostIOCache,3997 aMediumAttachment);3992 int vrc = VMR3ReqCallU(pUVM, 3993 VMCPUID_ANY, 3994 &pReq, 3995 0 /* no wait! */, 3996 VMREQFLAGS_VBOX_STATUS, 3997 (PFNRT)Console::attachStorageDevice, 3998 7, 3999 this, 4000 pUVM, 4001 pszDevice, 4002 uInstance, 4003 enmBus, 4004 fUseHostIOCache, 4005 aMediumAttachment); 3998 4006 3999 4007 /* release the lock before waiting for a result (EMT will call us back!) */ … … 4032 4040 * 4033 4041 * @param pThis Pointer to the Console object. 4034 * @param p VMThe VM handle.4042 * @param pUVM The VM handle. 4035 4043 * @param pcszDevice The PDM device name. 4036 4044 * @param uInstance The PDM device instance. … … 4039 4047 */ 4040 4048 DECLCALLBACK(int) Console::attachStorageDevice(Console *pConsole, 4041 P VM pVM,4049 PUVM pUVM, 4042 4050 const char *pcszDevice, 4043 4051 unsigned uInstance, … … 4061 4069 */ 4062 4070 bool fResume; 4063 VMSTATE enmVMState = VMR3GetState (pVM);4071 VMSTATE enmVMState = VMR3GetStateU(pUVM); 4064 4072 switch (enmVMState) 4065 4073 { … … 4070 4078 /* disable the callback to prevent Console-level state change */ 4071 4079 pConsole->mVMStateChangeCallbackDisabled = true; 4072 int rc = VMR3Suspend(p VM);4080 int rc = VMR3Suspend(pUVM); 4073 4081 pConsole->mVMStateChangeCallbackDisabled = false; 4074 4082 AssertRCReturn(rc, rc); … … 4098 4106 /* Determine the base path for the device instance. */ 4099 4107 PCFGMNODE pCtlInst; 4100 pCtlInst = CFGMR3GetChildF(CFGMR3GetRoot (pVM), "Devices/%s/%u/", pcszDevice, uInstance);4108 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 4101 4109 AssertReturn(pCtlInst, VERR_INTERNAL_ERROR); 4102 4110 … … 4119 4127 false /* fForceUnmount */, 4120 4128 true /* fHotplug */, 4121 p VM,4129 pUVM, 4122 4130 NULL /* paLedDevType */); 4123 4131 /** @todo this dumps everything attached to this device instance, which … … 4133 4141 /* disable the callback to prevent Console-level state change */ 4134 4142 pConsole->mVMStateChangeCallbackDisabled = true; 4135 rc = VMR3Resume(p VM);4143 rc = VMR3Resume(pUVM); 4136 4144 pConsole->mVMStateChangeCallbackDisabled = false; 4137 4145 AssertRC(rc); … … 4139 4147 { 4140 4148 /* too bad, we failed. try to sync the console state with the VMM state */ 4141 vmstateChangeCallback( pVM, VMSTATE_SUSPENDED, enmVMState, pConsole);4149 vmstateChangeCallback(VMR3GetVM(pUVM), VMSTATE_SUSPENDED, enmVMState, pConsole); 4142 4150 } 4143 4151 /** @todo: if we failed with drive mount, then the VMR3Resume … … 4159 4167 * 4160 4168 * @param aMediumAttachment The medium attachment which is added. 4161 * @param p VMSafe VM handle.4169 * @param pUVM Safe VM handle. 4162 4170 * 4163 4171 * @note Locks this object for writing. 4164 4172 */ 4165 HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, P VM pVM)4173 HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM) 4166 4174 { 4167 4175 AutoCaller autoCaller(this); … … 4224 4232 */ 4225 4233 PVMREQ pReq; 4226 int vrc = VMR3ReqCall (pVM,4227 VMCPUID_ANY,4228 &pReq,4229 0 /* no wait! */,4230 VMREQFLAGS_VBOX_STATUS,4231 (PFNRT)Console::detachStorageDevice,4232 6,4233 this,4234 pVM,4235 pszDevice,4236 uInstance,4237 enmBus,4238 aMediumAttachment);4234 int vrc = VMR3ReqCallU(pUVM, 4235 VMCPUID_ANY, 4236 &pReq, 4237 0 /* no wait! */, 4238 VMREQFLAGS_VBOX_STATUS, 4239 (PFNRT)Console::detachStorageDevice, 4240 6, 4241 this, 4242 pUVM, 4243 pszDevice, 4244 uInstance, 4245 enmBus, 4246 aMediumAttachment); 4239 4247 4240 4248 /* release the lock before waiting for a result (EMT will call us back!) */ … … 4272 4280 * 4273 4281 * @param pThis Pointer to the Console object. 4274 * @param p VMThe VM handle.4282 * @param pUVM The VM handle. 4275 4283 * @param pcszDevice The PDM device name. 4276 4284 * @param uInstance The PDM device instance. … … 4279 4287 */ 4280 4288 DECLCALLBACK(int) Console::detachStorageDevice(Console *pConsole, 4281 P VM pVM,4289 PUVM pUVM, 4282 4290 const char *pcszDevice, 4283 4291 unsigned uInstance, … … 4300 4308 */ 4301 4309 bool fResume; 4302 VMSTATE enmVMState = VMR3GetState (pVM);4310 VMSTATE enmVMState = VMR3GetStateU(pUVM); 4303 4311 switch (enmVMState) 4304 4312 { … … 4309 4317 /* disable the callback to prevent Console-level state change */ 4310 4318 pConsole->mVMStateChangeCallbackDisabled = true; 4311 int rc = VMR3Suspend(p VM);4319 int rc = VMR3Suspend(pUVM); 4312 4320 pConsole->mVMStateChangeCallbackDisabled = false; 4313 4321 AssertRCReturn(rc, rc); … … 4337 4345 /* Determine the base path for the device instance. */ 4338 4346 PCFGMNODE pCtlInst; 4339 pCtlInst = CFGMR3GetChildF(CFGMR3GetRoot (pVM), "Devices/%s/%u/", pcszDevice, uInstance);4347 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 4340 4348 AssertReturn(pCtlInst, VERR_INTERNAL_ERROR); 4341 4349 … … 4363 4371 if (pLunL0) 4364 4372 { 4365 rc = PDMR3DeviceDetach( pVM, pcszDevice, uInstance, uLUN, 0);4373 rc = PDMR3DeviceDetach(VMR3GetVM(pUVM), pcszDevice, uInstance, uLUN, 0); 4366 4374 if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN) 4367 4375 rc = VINF_SUCCESS; … … 4386 4394 /* disable the callback to prevent Console-level state change */ 4387 4395 pConsole->mVMStateChangeCallbackDisabled = true; 4388 rc = VMR3Resume(p VM);4396 rc = VMR3Resume(pUVM); 4389 4397 pConsole->mVMStateChangeCallbackDisabled = false; 4390 4398 AssertRC(rc); … … 4392 4400 { 4393 4401 /* too bad, we failed. try to sync the console state with the VMM state */ 4394 vmstateChangeCallback( pVM, VMSTATE_SUSPENDED, enmVMState, pConsole);4402 vmstateChangeCallback(VMR3GetVM(pUVM), VMSTATE_SUSPENDED, enmVMState, pConsole); 4395 4403 } 4396 4404 /** @todo: if we failed with drive mount, then the VMR3Resume … … 4474 4482 if (RT_SUCCESS(vrc) && changeAdapter) 4475 4483 { 4476 VMSTATE enmVMState = VMR3GetState (ptrVM);4484 VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM()); 4477 4485 if ( enmVMState == VMSTATE_RUNNING /** @todo LiveMigration: Forbid or deal correctly with the _LS variants */ 4478 4486 || enmVMState == VMSTATE_SUSPENDED) … … 4484 4492 } 4485 4493 4486 rc = doNetworkAdapterChange(ptrVM , pszAdapterName, ulInstance, 0, aNetworkAdapter);4494 rc = doNetworkAdapterChange(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, aNetworkAdapter); 4487 4495 4488 4496 if (fTraceEnabled && fCableConnected && pINetCfg) … … 4615 4623 * @returns COM status code. 4616 4624 * 4617 * @parma p VMThe VM handle (caller hold this safely).4625 * @parma pUVM The VM handle (caller hold this safely). 4618 4626 * @param pszDevice The PDM device name. 4619 4627 * @param uInstance The PDM device instance. … … 4621 4629 * @param aNetworkAdapter The network adapter whose attachment needs to be changed 4622 4630 */ 4623 HRESULT Console::doNetworkAdapterChange(P VM pVM,4631 HRESULT Console::doNetworkAdapterChange(PUVM pUVM, 4624 4632 const char *pszDevice, 4625 4633 unsigned uInstance, … … 4632 4640 AutoCaller autoCaller(this); 4633 4641 AssertComRCReturnRC(autoCaller.rc()); 4634 4635 /* Get the VM handle. */4636 SafeVMPtr ptrVM(this);4637 if (!ptrVM.isOk())4638 return ptrVM.rc();4639 4642 4640 4643 /* … … 4644 4647 */ 4645 4648 PVMREQ pReq; 4646 int vrc = VMR3ReqCall (pVM, 0 /*idDstCpu*/, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,4647 (PFNRT)Console::changeNetworkAttachment, 6,4648 this, ptrVM.raw(), pszDevice, uInstance, uLun, aNetworkAdapter);4649 int vrc = VMR3ReqCallU(pUVM, 0 /*idDstCpu*/, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 4650 (PFNRT)Console::changeNetworkAttachment, 6, 4651 this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter); 4649 4652 4650 4653 if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc)) … … 4675 4678 * 4676 4679 * @param pThis Pointer to the Console object. 4677 * @param p VMThe VM handle.4680 * @param pUVM The VM handle. 4678 4681 * @param pszDevice The PDM device name. 4679 4682 * @param uInstance The PDM device instance. … … 4685 4688 */ 4686 4689 DECLCALLBACK(int) Console::changeNetworkAttachment(Console *pThis, 4687 P VM pVM,4690 PUVM pUVM, 4688 4691 const char *pszDevice, 4689 4692 unsigned uInstance, … … 4724 4727 */ 4725 4728 bool fResume; 4726 VMSTATE enmVMState = VMR3GetState (pVM);4729 VMSTATE enmVMState = VMR3GetStateU(pUVM); 4727 4730 switch (enmVMState) 4728 4731 { … … 4733 4736 /* disable the callback to prevent Console-level state change */ 4734 4737 pThis->mVMStateChangeCallbackDisabled = true; 4735 int rc = VMR3Suspend(p VM);4738 int rc = VMR3Suspend(pUVM); 4736 4739 pThis->mVMStateChangeCallbackDisabled = false; 4737 4740 AssertRCReturn(rc, rc); … … 4755 4758 PCFGMNODE pCfg = NULL; /* /Devices/Dev/.../Config/ */ 4756 4759 PCFGMNODE pLunL0 = NULL; /* /Devices/Dev/0/LUN#0/ */ 4757 PCFGMNODE pInst = CFGMR3GetChildF(CFGMR3GetRoot (pVM), "Devices/%s/%d/", pszDevice, uInstance);4760 PCFGMNODE pInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%d/", pszDevice, uInstance); 4758 4761 AssertRelease(pInst); 4759 4762 … … 4769 4772 /* disable the callback to prevent Console-level state change */ 4770 4773 pThis->mVMStateChangeCallbackDisabled = true; 4771 rc = VMR3Resume(p VM);4774 rc = VMR3Resume(pUVM); 4772 4775 pThis->mVMStateChangeCallbackDisabled = false; 4773 4776 AssertRC(rc); … … 4775 4778 { 4776 4779 /* too bad, we failed. try to sync the console state with the VMM state */ 4777 vmstateChangeCallback( pVM, VMSTATE_SUSPENDED, enmVMState, pThis);4780 vmstateChangeCallback(VMR3GetVM(pUVM), VMSTATE_SUSPENDED, enmVMState, pThis); 4778 4781 } 4779 4782 /// @todo (r=dmik) if we failed with drive mount, then the VMR3Resume … … 4855 4858 if (ptrVM.isOk()) 4856 4859 { 4857 rc = doMediumChange(aMediumAttachment, !!aForce, ptrVM );4860 rc = doMediumChange(aMediumAttachment, !!aForce, ptrVM.rawUVM()); 4858 4861 ptrVM.release(); 4859 4862 } … … 4926 4929 { 4927 4930 /* No need to call in the EMT thread. */ 4928 rc = VMR3SetCpuExecutionCap(ptrVM , aExecutionCap);4931 rc = VMR3SetCpuExecutionCap(ptrVM.rawUVM(), aExecutionCap); 4929 4932 } 4930 4933 else … … 5389 5392 { 5390 5393 if (aRemove) 5391 rc = doStorageDeviceDetach(aMediumAttachment, ptrVM );5394 rc = doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM()); 5392 5395 else 5393 rc = doStorageDeviceAttach(aMediumAttachment, ptrVM );5396 rc = doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM()); 5394 5397 ptrVM.release(); 5395 5398 } … … 5712 5715 5713 5716 /* Pause the VM, as it might have pending IO on this drive */ 5714 VMSTATE enmVMState = VMR3GetState (ptrVM);5717 VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM()); 5715 5718 if (mMachineState == MachineState_DeletingSnapshotOnline) 5716 5719 { … … 5718 5721 /* disable the callback to prevent Console-level state change */ 5719 5722 mVMStateChangeCallbackDisabled = true; 5720 int vrc2 = VMR3Suspend(ptrVM );5723 int vrc2 = VMR3Suspend(ptrVM.rawUVM()); 5721 5724 mVMStateChangeCallbackDisabled = false; 5722 5725 AssertRCReturn(vrc2, E_FAIL); 5723 5726 } 5724 5727 5725 vrc = VMR3ReqCallWait (ptrVM,5726 VMCPUID_ANY,5727 (PFNRT)reconfigureMediumAttachment,5728 13,5729 this,5730 ptrVM.raw(),5731 pcszDevice,5732 uInstance,5733 enmBus,5734 fUseHostIOCache,5735 fBuiltinIOCache,5736 true /* fSetupMerge */,5737 aSourceIdx,5738 aTargetIdx,5739 aMediumAttachment,5740 mMachineState,5741 &rc);5728 vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 5729 VMCPUID_ANY, 5730 (PFNRT)reconfigureMediumAttachment, 5731 13, 5732 this, 5733 ptrVM.rawUVM(), 5734 pcszDevice, 5735 uInstance, 5736 enmBus, 5737 fUseHostIOCache, 5738 fBuiltinIOCache, 5739 true /* fSetupMerge */, 5740 aSourceIdx, 5741 aTargetIdx, 5742 aMediumAttachment, 5743 mMachineState, 5744 &rc); 5742 5745 /* error handling is after resuming the VM */ 5743 5746 … … 5747 5750 /* disable the callback to prevent Console-level state change */ 5748 5751 mVMStateChangeCallbackDisabled = true; 5749 int vrc2 = VMR3Resume(ptrVM );5752 int vrc2 = VMR3Resume(ptrVM.rawUVM()); 5750 5753 mVMStateChangeCallbackDisabled = false; 5751 5754 if (RT_FAILURE(vrc2)) … … 5783 5786 5784 5787 /* Pause the VM, as it might have pending IO on this drive */ 5785 enmVMState = VMR3GetState (ptrVM);5788 enmVMState = VMR3GetStateU(ptrVM.rawUVM()); 5786 5789 if (mMachineState == MachineState_DeletingSnapshotOnline) 5787 5790 { … … 5789 5792 /* disable the callback to prevent Console-level state change */ 5790 5793 mVMStateChangeCallbackDisabled = true; 5791 int vrc2 = VMR3Suspend(ptrVM );5794 int vrc2 = VMR3Suspend(ptrVM.rawUVM()); 5792 5795 mVMStateChangeCallbackDisabled = false; 5793 5796 AssertRCReturn(vrc2, E_FAIL); … … 5799 5802 ComSafeArrayInArg(aChildrenToReparent)); 5800 5803 5801 vrc = VMR3ReqCallWait (ptrVM,5802 VMCPUID_ANY,5803 (PFNRT)reconfigureMediumAttachment,5804 13,5805 this,5806 ptrVM.raw(),5807 pcszDevice,5808 uInstance,5809 enmBus,5810 fUseHostIOCache,5811 fBuiltinIOCache,5812 false /* fSetupMerge */,5813 0 /* uMergeSource */,5814 0 /* uMergeTarget */,5815 aMediumAttachment,5816 mMachineState,5817 &rc);5804 vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 5805 VMCPUID_ANY, 5806 (PFNRT)reconfigureMediumAttachment, 5807 13, 5808 this, 5809 ptrVM.rawUVM(), 5810 pcszDevice, 5811 uInstance, 5812 enmBus, 5813 fUseHostIOCache, 5814 fBuiltinIOCache, 5815 false /* fSetupMerge */, 5816 0 /* uMergeSource */, 5817 0 /* uMergeTarget */, 5818 aMediumAttachment, 5819 mMachineState, 5820 &rc); 5818 5821 /* error handling is after resuming the VM */ 5819 5822 … … 5823 5826 /* disable the callback to prevent Console-level state change */ 5824 5827 mVMStateChangeCallbackDisabled = true; 5825 int vrc2 = VMR3Resume(ptrVM );5828 int vrc2 = VMR3Resume(ptrVM.rawUVM()); 5826 5829 mVMStateChangeCallbackDisabled = false; 5827 5830 AssertRC(vrc2); … … 6198 6201 return a_Quiet 6199 6202 ? E_ACCESSDENIED 6200 : setError(E_ACCESSDENIED, tr("The virtual machine is waspowered off"));6203 : setError(E_ACCESSDENIED, tr("The virtual machine is powered off")); 6201 6204 6202 6205 /* … … 6207 6210 return a_Quiet 6208 6211 ? E_ACCESSDENIED 6209 : setError(E_ACCESSDENIED, tr("The virtual machine is waspowered off"));6212 : setError(E_ACCESSDENIED, tr("The virtual machine is powered off")); 6210 6213 6211 6214 PVM pVM = VMR3GetVM(pUVM); … … 6215 6218 return a_Quiet 6216 6219 ? E_ACCESSDENIED 6217 : setError(E_ACCESSDENIED, tr("The virtual machine is waspowered off"));6220 : setError(E_ACCESSDENIED, tr("The virtual machine is powered off")); 6218 6221 } 6219 6222 … … 6936 6939 LogFlowThisFunc(("Powering off the VM...\n")); 6937 6940 alock.release(); 6938 vrc = VMR3PowerOff( VMR3GetVM(pUVM));6941 vrc = VMR3PowerOff(pUVM); 6939 6942 #ifdef VBOX_WITH_EXTPACK 6940 6943 mptrExtPackManager->callAllVmPowerOffHooks(this, VMR3GetVM(pUVM)); … … 7004 7007 alock.release(); 7005 7008 7006 vrc = VMR3Destroy( VMR3GetVM(pUVM));7009 vrc = VMR3Destroy(pUVM); 7007 7010 7008 7011 /* take the lock again */ … … 7958 7961 Assert(portVersion == 1 || portVersion == 2); 7959 7962 7960 int vrc = VMR3ReqCallWait(ptrVM, 0 /* idDstCpu (saved state, see #6232) */, 7961 (PFNRT)usbAttachCallback, 9, 7962 this, ptrVM.raw(), aHostDevice, uuid.raw(), fRemote, Address.c_str(), pvRemoteBackend, portVersion, aMaskedIfs); 7963 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */, 7964 (PFNRT)usbAttachCallback, 9, 7965 this, ptrVM.rawUVM(), aHostDevice, uuid.raw(), fRemote, 7966 Address.c_str(), pvRemoteBackend, portVersion, aMaskedIfs); 7963 7967 7964 7968 if (RT_SUCCESS(vrc)) … … 7986 7990 { 7987 7991 case VERR_VUSB_NO_PORTS: 7988 hrc = setError(E_FAIL, 7989 tr("Failed to attach the USB device. (No available ports on the USB controller).")); 7992 hrc = setError(E_FAIL, tr("Failed to attach the USB device. (No available ports on the USB controller).")); 7990 7993 break; 7991 7994 case VERR_VUSB_USBFS_PERMISSION: 7992 hrc = setError(E_FAIL, 7993 tr("Not permitted to open the USB device, check usbfs options")); 7995 hrc = setError(E_FAIL, tr("Not permitted to open the USB device, check usbfs options")); 7994 7996 break; 7995 7997 default: 7996 hrc = setError(E_FAIL, 7997 tr("Failed to create a proxy device for the USB device. (Error: %Rrc)"), 7998 vrc); 7998 hrc = setError(E_FAIL, tr("Failed to create a proxy device for the USB device. (Error: %Rrc)"), vrc); 7999 7999 break; 8000 8000 } … … 8015 8015 //static 8016 8016 DECLCALLBACK(int) 8017 Console::usbAttachCallback(Console *that, PVM pVM, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs) 8017 Console::usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, 8018 const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs) 8018 8019 { 8019 8020 LogFlowFuncEnter(); … … 8023 8024 AssertReturn(!that->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 8024 8025 8025 int vrc = PDMR3USBCreateProxyDevice( pVM, aUuid, aRemote, aAddress, pvRemoteBackend,8026 int vrc = PDMR3USBCreateProxyDevice(VMR3GetVM(pUVM), aUuid, aRemote, aAddress, pvRemoteBackend, 8026 8027 aPortVersion == 1 ? VUSB_STDVER_11 : VUSB_STDVER_20, aMaskedIfs); 8027 8028 LogFlowFunc(("vrc=%Rrc\n", vrc)); … … 8073 8074 8074 8075 alock.release(); 8075 int vrc = VMR3ReqCallWait (ptrVM, 0 /* idDstCpu (saved state, see #6232) */,8076 (PFNRT)usbDetachCallback, 5,8077 this, ptrVM.raw(), pUuid);8076 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */, 8077 (PFNRT)usbDetachCallback, 5, 8078 this, ptrVM.rawUVM(), pUuid); 8078 8079 if (RT_SUCCESS(vrc)) 8079 8080 { … … 8091 8092 /** 8092 8093 * USB device detach callback used by DetachUSBDevice(). 8094 * 8093 8095 * Note that DetachUSBDevice() doesn't return until this callback is executed, 8094 8096 * so we don't use AutoCaller and don't care about reference counters of … … 8099 8101 //static 8100 8102 DECLCALLBACK(int) 8101 Console::usbDetachCallback(Console *that, P VM pVM, PCRTUUID aUuid)8103 Console::usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid) 8102 8104 { 8103 8105 LogFlowFuncEnter(); … … 8107 8109 AssertReturn(!that->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 8108 8110 8109 int vrc = PDMR3USBDetachDevice( pVM, aUuid);8111 int vrc = PDMR3USBDetachDevice(VMR3GetVM(pUVM), aUuid); 8110 8112 8111 8113 LogFlowFunc(("vrc=%Rrc\n", vrc)); … … 8493 8495 * Called at VM startup. 8494 8496 * 8495 * @param p VMThe VM handle.8497 * @param pUVM The VM handle. 8496 8498 */ 8497 HRESULT Console::captureUSBDevices(P VM pVM)8499 HRESULT Console::captureUSBDevices(PUVM pUVM) 8498 8500 { 8499 8501 LogFlowThisFunc(("\n")); … … 8506 8508 * capture devices */ 8507 8509 PPDMIBASE pBase; 8508 int vrc = PDMR3QueryLun( pVM, "usb-ohci", 0, 0, &pBase);8510 int vrc = PDMR3QueryLun(VMR3GetVM(pUVM), "usb-ohci", 0, 0, &pBase); 8509 8511 if (RT_SUCCESS(vrc)) 8510 8512 { … … 8871 8873 /* 8872 8874 * Create the VM 8873 */ 8874 PVM pVM; 8875 /* 8876 * release the lock since EMT will call Console. It's safe because 8877 * mMachineState is either Starting or Restoring state here. 8875 * 8876 * Note! Release the lock since EMT will call Console. It's safe because 8877 * mMachineState is either Starting or Restoring state here. 8878 8878 */ 8879 8879 alock.release(); 8880 8880 8881 PVM pVM; 8881 8882 vrc = VMR3Create(cCpus, 8882 8883 pConsole->mpVmm2UserMethods, … … 8885 8886 task->mConfigConstructor, 8886 8887 static_cast<Console *>(pConsole), 8887 &pVM );8888 &pVM, NULL); 8888 8889 8889 8890 alock.acquire(); … … 8955 8956 * Capture USB devices. 8956 8957 */ 8957 rc = pConsole->captureUSBDevices(pVM); 8958 if (FAILED(rc)) break; 8958 rc = pConsole->captureUSBDevices(pConsole->mpUVM); 8959 if (FAILED(rc)) 8960 break; 8959 8961 8960 8962 /* Load saved state? */ … … 8964 8966 task->mSavedStateFile.c_str())); 8965 8967 8966 vrc = VMR3LoadFromFile(p VM,8968 vrc = VMR3LoadFromFile(pConsole->mpUVM, 8967 8969 task->mSavedStateFile.c_str(), 8968 8970 Console::stateProgressCallback, … … 8981 8983 #endif 8982 8984 if (RT_SUCCESS(vrc)) 8983 vrc = VMR3Resume(p VM);8985 vrc = VMR3Resume(pConsole->mpUVM); 8984 8986 AssertLogRelRC(vrc); 8985 8987 } … … 8989 8991 if (RT_FAILURE(vrc)) 8990 8992 { 8991 int vrc2 = VMR3PowerOff(p VM); AssertLogRelRC(vrc2);8993 int vrc2 = VMR3PowerOff(pConsole->mpUVM); AssertLogRelRC(vrc2); 8992 8994 #ifdef VBOX_WITH_EXTPACK 8993 8995 pConsole->mptrExtPackManager->callAllVmPowerOffHooks(pConsole, pVM); … … 8999 9001 /* -> ConsoleImplTeleporter.cpp */ 9000 9002 bool fPowerOffOnFailure; 9001 rc = pConsole->teleporterTrg( VMR3GetUVM(pVM), pMachine, &task->mErrorMsg, task->mStartPaused,9003 rc = pConsole->teleporterTrg(pConsole->mpUVM, pMachine, &task->mErrorMsg, task->mStartPaused, 9002 9004 task->mProgress, &fPowerOffOnFailure); 9003 9005 if (FAILED(rc) && fPowerOffOnFailure) 9004 9006 { 9005 9007 ErrorInfoKeeper eik; 9006 int vrc2 = VMR3PowerOff(p VM); AssertLogRelRC(vrc2);9008 int vrc2 = VMR3PowerOff(pConsole->mpUVM); AssertLogRelRC(vrc2); 9007 9009 #ifdef VBOX_WITH_EXTPACK 9008 9010 pConsole->mptrExtPackManager->callAllVmPowerOffHooks(pConsole, pVM); … … 9065 9067 #endif 9066 9068 if (RT_SUCCESS(vrc)) 9067 vrc = VMR3PowerOn(p VM);9069 vrc = VMR3PowerOn(pConsole->mpUVM); 9068 9070 AssertLogRelRC(vrc); 9069 9071 } … … 9095 9097 */ 9096 9098 alock.release(); 9097 VMR3AtErrorDeregister(p VM, Console::genericVMSetErrorCallback, &task->mErrorMsg);9099 VMR3AtErrorDeregister(pConsole->mpUVM, Console::genericVMSetErrorCallback, &task->mErrorMsg); 9098 9100 /** @todo register another VMSetError callback? */ 9099 9101 alock.acquire(); … … 9196 9198 * 9197 9199 * @param pConsole Reference to the console object. 9198 * @param p VMThe VM handle.9200 * @param pUVM The VM handle. 9199 9201 * @param lInstance The instance of the controller. 9200 9202 * @param pcszDevice The name of the controller type. … … 9210 9212 /* static */ 9211 9213 DECLCALLBACK(int) Console::reconfigureMediumAttachment(Console *pConsole, 9212 P VM pVM,9214 PUVM pUVM, 9213 9215 const char *pcszDevice, 9214 9216 unsigned uInstance, … … 9223 9225 HRESULT *phrc) 9224 9226 { 9225 LogFlowFunc(("p VM=%p aMediumAtt=%p phrc=%p\n", pVM, aMediumAtt, phrc));9227 LogFlowFunc(("pUVM=%p aMediumAtt=%p phrc=%p\n", pUVM, aMediumAtt, phrc)); 9226 9228 9227 9229 int rc; … … 9241 9243 /* Determine the base path for the device instance. */ 9242 9244 PCFGMNODE pCtlInst; 9243 pCtlInst = CFGMR3GetChildF(CFGMR3GetRoot (pVM), "Devices/%s/%u/", pcszDevice, uInstance);9245 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 9244 9246 AssertReturn(pCtlInst, VERR_INTERNAL_ERROR); 9245 9247 … … 9260 9262 false /* fForceUnmount */, 9261 9263 false /* fHotplug */, 9262 p VM,9264 pUVM, 9263 9265 NULL /* paLedDevType */); 9264 9266 /** @todo this dumps everything attached to this device instance, which … … 9368 9370 alock.release(); 9369 9371 LogFlowFunc(("VMR3Save...\n")); 9370 vrc = VMR3Save(ptrVM ,9372 vrc = VMR3Save(ptrVM.rawUVM(), 9371 9373 strSavedStateFile.c_str(), 9372 9374 true /*fContinueAfterwards*/, … … 9449 9451 * isn't going to need the Console lock. 9450 9452 */ 9451 vrc = VMR3ReqCallWait (ptrVM,9452 VMCPUID_ANY,9453 (PFNRT)reconfigureMediumAttachment,9454 13,9455 that,9456 ptrVM.raw(),9457 pcszDevice,9458 lInstance,9459 enmBus,9460 fUseHostIOCache,9461 fBuiltinIOCache,9462 false /* fSetupMerge */,9463 0 /* uMergeSource */,9464 0 /* uMergeTarget */,9465 atts[i],9466 that->mMachineState,9467 &rc);9453 vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 9454 VMCPUID_ANY, 9455 (PFNRT)reconfigureMediumAttachment, 9456 13, 9457 that, 9458 ptrVM.rawUVM(), 9459 pcszDevice, 9460 lInstance, 9461 enmBus, 9462 fUseHostIOCache, 9463 fBuiltinIOCache, 9464 false /* fSetupMerge */, 9465 0 /* uMergeSource */, 9466 0 /* uMergeTarget */, 9467 atts[i], 9468 that->mMachineState, 9469 &rc); 9468 9470 if (RT_FAILURE(vrc)) 9469 9471 throw setErrorStatic(E_FAIL, Console::tr("%Rrc"), vrc); … … 9522 9524 SafeVMPtr ptrVM(that); 9523 9525 alock.release(); 9524 int vrc = VMR3Resume(ptrVM );9526 int vrc = VMR3Resume(ptrVM.rawUVM()); 9525 9527 alock.acquire(); 9526 9528 if (RT_FAILURE(vrc)) … … 9580 9582 SafeVMPtr ptrVM(that); 9581 9583 alock.release(); 9582 int vrc = VMR3Resume(ptrVM ); AssertLogRelRC(vrc);9584 int vrc = VMR3Resume(ptrVM.rawUVM()); AssertLogRelRC(vrc); 9583 9585 alock.acquire(); 9584 9586 if (RT_FAILURE(vrc)) … … 9640 9642 9641 9643 bool fSuspenededBySave; 9642 int vrc = VMR3Save(task->mp VM,9644 int vrc = VMR3Save(task->mpUVM, 9643 9645 task->mSavedStateFile.c_str(), 9644 9646 false, /*fContinueAfterwards*/ -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r44191 r44340 707 707 int Console::configConstructorInner(PVM pVM, AutoWriteLock *pAlock) 708 708 { 709 VMMDev *pVMMDev = m_pVMMDev; 710 Assert(pVMMDev); 711 709 PUVM pUVM = VMR3GetUVM(pVM); 710 VMMDev *pVMMDev = m_pVMMDev; Assert(pVMMDev); 712 711 ComPtr<IMachine> pMachine = machine(); 713 712 … … 1795 1794 false /* fForceUnmount */, 1796 1795 false /* fHotplug */, 1797 p VM,1796 pUVM, 1798 1797 paLedDevType); 1799 1798 if (RT_FAILURE(rc)) … … 2659 2658 */ 2660 2659 2661 rc = configGuestProperties(this, p VM);2660 rc = configGuestProperties(this, pUVM); 2662 2661 #endif /* VBOX_WITH_GUEST_PROPS defined */ 2663 2662 … … 2835 2834 * Register VM state change handler. 2836 2835 */ 2837 int rc2 = VMR3AtStateRegister(p VM, Console::vmstateChangeCallback, this);2836 int rc2 = VMR3AtStateRegister(pUVM, Console::vmstateChangeCallback, this); 2838 2837 AssertRC(rc2); 2839 2838 if (RT_SUCCESS(rc)) … … 2843 2842 * Register VM runtime error handler. 2844 2843 */ 2845 rc2 = VMR3AtRuntimeErrorRegister(p VM, Console::setVMRuntimeErrorCallback, this);2844 rc2 = VMR3AtRuntimeErrorRegister(pUVM, Console::setVMRuntimeErrorCallback, this); 2846 2845 AssertRC(rc2); 2847 2846 if (RT_SUCCESS(rc)) … … 3120 3119 bool fForceUnmount, 3121 3120 bool fHotplug, 3122 P VM pVM,3121 PUVM pUVM, 3123 3122 DeviceType_T *paLedDevType) 3124 3123 { … … 3158 3157 /* Unmount existing media only for floppy and DVD drives. */ 3159 3158 PPDMIBASE pBase; 3160 rc = PDMR3QueryLun( pVM, pcszDevice, uInstance, uLUN, &pBase);3159 rc = PDMR3QueryLun(VMR3GetVM(pUVM), pcszDevice, uInstance, uLUN, &pBase); 3161 3160 if (RT_FAILURE(rc)) 3162 3161 { … … 3180 3179 } 3181 3180 3182 rc = PDMR3DeviceDetach( pVM, pcszDevice, uInstance, uLUN, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG);3181 rc = PDMR3DeviceDetach(VMR3GetVM(pUVM), pcszDevice, uInstance, uLUN, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 3183 3182 if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN) 3184 3183 rc = VINF_SUCCESS; … … 3284 3283 const char *pszUnit; 3285 3284 uint64_t u64Print = formatDiskSize((uint64_t)i64Size, &pszUnit); 3286 setVMRuntimeErrorCallbackF( pVM, this, 0,3285 setVMRuntimeErrorCallbackF(VMR3GetVM(pUVM), this, 0, 3287 3286 "FatPartitionDetected", 3288 3287 N_("The medium '%ls' has a logical size of %RU64%s " … … 3316 3315 uint64_t u64PrintSiz = formatDiskSize((LONG64)i64Size, &pszUnitSiz); 3317 3316 uint64_t u64PrintMax = formatDiskSize(maxSize, &pszUnitMax); 3318 setVMRuntimeErrorCallbackF( pVM, this, 0,3317 setVMRuntimeErrorCallbackF(VMR3GetVM(pUVM), this, 0, 3319 3318 "FatPartitionDetected", /* <= not exact but ... */ 3320 3319 N_("The medium '%ls' has a logical size of %RU64%s " … … 3340 3339 const char *pszUnit; 3341 3340 uint64_t u64Print = formatDiskSize(i64Size, &pszUnit); 3342 setVMRuntimeErrorCallbackF( pVM, this, 0,3341 setVMRuntimeErrorCallbackF(VMR3GetVM(pUVM), this, 0, 3343 3342 "FatPartitionDetected", 3344 3343 #ifdef RT_OS_WINDOWS … … 3382 3381 || enmFsTypeFile == RTFSTYPE_XFS) 3383 3382 { 3384 setVMRuntimeErrorCallbackF( pVM, this, 0,3383 setVMRuntimeErrorCallbackF(VMR3GetVM(pUVM), this, 0, 3385 3384 "Ext4PartitionDetected", 3386 3385 N_("The host I/O cache for at least one controller is disabled " … … 3400 3399 && !mfSnapshotFolderExt4WarningShown) 3401 3400 { 3402 setVMRuntimeErrorCallbackF( pVM, this, 0,3401 setVMRuntimeErrorCallbackF(VMR3GetVM(pUVM), this, 0, 3403 3402 "Ext4PartitionDetected", 3404 3403 N_("The host I/O cache for at least one controller is disabled " … … 3475 3474 { 3476 3475 /* Attach the new driver. */ 3477 rc = PDMR3DeviceAttach( pVM, pcszDevice, uInstance, uLUN,3478 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/);3476 rc = PDMR3DeviceAttach(VMR3GetVM(pUVM), pcszDevice, uInstance, uLUN, 3477 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); 3479 3478 AssertRCReturn(rc, rc); 3480 3479 … … 3849 3848 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3850 3849 3851 PVM pVM = VMR3GetVM(mpUVM); /* We're on an EMT, so this is safe. */3852 3853 3850 ComPtr<IMachine> pMachine = machine(); 3854 3851 … … 3875 3872 if (fAttachDetach) 3876 3873 { 3877 rc = PDMR3DeviceDetach( pVM, pszDevice, uInstance, uLun, 0 /*fFlags*/);3874 rc = PDMR3DeviceDetach(VMR3GetVM(mpUVM), pszDevice, uInstance, uLun, 0 /*fFlags*/); 3878 3875 if (rc == VINF_PDM_NO_DRIVER_ATTACHED_TO_LUN) 3879 3876 rc = VINF_SUCCESS; … … 4081 4078 { 4082 4079 case VERR_ACCESS_DENIED: 4083 return VMSetError( pVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(4080 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( 4084 4081 "Failed to open '/dev/net/tun' for read/write access. Please check the " 4085 4082 "permissions of that node. Either run 'chmod 0666 /dev/net/tun' or " … … 4089 4086 default: 4090 4087 AssertMsgFailed(("Could not attach to host interface! Bad!\n")); 4091 return VMSetError( pVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(4088 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( 4092 4089 "Failed to initialize Host Interface Networking")); 4093 4090 } … … 4132 4129 // * hrc = aNetworkAdapter->Detach(); H(); 4133 4130 // */ 4134 // return VMSetError( pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,4131 // return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 4135 4132 // N_("Malformed host interface networking name '%ls'"), 4136 4133 // BridgedIfName.raw()); … … 4168 4165 { 4169 4166 AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: FindByName failed, rc=%Rhrc (0x%x)", hrc, hrc)); 4170 return VMSetError( pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,4167 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 4171 4168 N_("Nonexistent host networking interface, name '%ls'"), 4172 4169 BridgedIfName.raw()); … … 4183 4180 if (eIfType != HostNetworkInterfaceType_Bridged) 4184 4181 { 4185 return VMSetError( pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,4182 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 4186 4183 N_("Interface ('%ls') is not a Bridged Adapter interface"), 4187 4184 BridgedIfName.raw()); … … 4280 4277 { 4281 4278 case VERR_ACCESS_DENIED: 4282 return VMSetError( pVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(4279 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( 4283 4280 "Failed to open '/dev/%s' for read/write access. Please check the " 4284 4281 "permissions of that node, and that the net.link.tap.user_open " … … 4288 4285 default: 4289 4286 AssertMsgFailed(("Could not attach to tap interface! Bad!\n")); 4290 return VMSetError( pVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(4287 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( 4291 4288 "Failed to initialize Host Interface Networking")); 4292 4289 } … … 4316 4313 if (ioctl(iSock, SIOCGIFFLAGS, &Req) >= 0) 4317 4314 if ((Req.ifr_flags & IFF_UP) == 0) 4318 setVMRuntimeErrorCallbackF( pVM, this, 0, "BridgedInterfaceDown",4315 setVMRuntimeErrorCallbackF(VMR3GetVM(mpUVM), this, 0, "BridgedInterfaceDown", 4319 4316 "Bridged interface %s is down. Guest will not be able to use this interface", 4320 4317 pszBridgedIfName); … … 4539 4536 { 4540 4537 LogRel(("NetworkAttachmentType_HostOnly: FindByName failed, rc (0x%x)\n", rc)); 4541 return VMSetError( pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,4538 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 4542 4539 N_("Nonexistent host networking interface, name '%ls'"), 4543 4540 HostOnlyName.raw()); … … 4564 4561 4565 4562 if (eIfType != HostNetworkInterfaceType_HostOnly) 4566 return VMSetError( pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,4563 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 4567 4564 N_("Interface ('%ls') is not a Host-Only Adapter interface"), 4568 4565 HostOnlyName.raw()); … … 4763 4760 if (fAttachDetach) 4764 4761 { 4765 rc = PDMR3DriverAttach( pVM, pszDevice, uInstance, uLun, 0 /*fFlags*/, NULL /* ppBase */);4762 rc = PDMR3DriverAttach(VMR3GetVM(mpUVM), pszDevice, uInstance, uLun, 0 /*fFlags*/, NULL /* ppBase */); 4766 4763 //AssertRC(rc); 4767 4764 } … … 4915 4912 * the machine XML and set a couple of initial properties. 4916 4913 */ 4917 /* static */ int Console::configGuestProperties(void *pvConsole, P VM pVM)4914 /* static */ int Console::configGuestProperties(void *pvConsole, PUVM pUVM) 4918 4915 { 4919 4916 #ifdef VBOX_WITH_GUEST_PROPS … … 4947 4944 PFNDBGFHANDLEREXT pfnHandler = (PFNDBGFHANDLEREXT)(uintptr_t)Params[0].u.pointer.addr; 4948 4945 void *pService = (void*)Params[1].u.pointer.addr; 4949 DBGFR3InfoRegisterExternal( pVM, "guestprops", "Display the guest properties", pfnHandler, pService);4946 DBGFR3InfoRegisterExternal(VMR3GetVM(pUVM), "guestprops", "Display the guest properties", pfnHandler, pService); 4950 4947 } 4951 4948 } -
trunk/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
r40257 r44340 686 686 RTSocketRetain(pState->mhSocket); 687 687 void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState)); 688 vrc = VMR3Teleport( VMR3GetVM(pState->mpUVM),688 vrc = VMR3Teleport(pState->mpUVM, 689 689 pState->mcMsMaxDowntime, 690 690 &g_teleporterTcpOps, pvUser, … … 887 887 { 888 888 autoLock.release(); 889 int rc = VMR3Resume( VMR3GetVM(pState->mpUVM));889 int rc = VMR3Resume(pState->mpUVM); 890 890 AssertLogRelMsgRC(rc, ("VMR3Resume -> %Rrc\n", rc)); 891 891 autoLock.acquire(); … … 1338 1338 break; 1339 1339 1340 int vrc2 = VMR3AtErrorRegister U(pState->mpUVM,1341 1340 int vrc2 = VMR3AtErrorRegister(pState->mpUVM, 1341 Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2); 1342 1342 RTSocketRetain(pState->mhSocket); /* For concurrent access by I/O thread and EMT. */ 1343 1343 pState->moffStream = 0; 1344 1344 1345 1345 void *pvUser2 = static_cast<void *>(static_cast<TeleporterState *>(pState)); 1346 vrc = VMR3LoadFromStream( VMR3GetVM(pState->mpUVM),1346 vrc = VMR3LoadFromStream(pState->mpUVM, 1347 1347 &g_teleporterTcpOps, pvUser2, 1348 1348 teleporterProgressCallback, pvUser2); 1349 1349 1350 1350 RTSocketRelease(pState->mhSocket); 1351 vrc2 = VMR3AtErrorDeregister( VMR3GetVM(pState->mpUVM), Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2);1351 vrc2 = VMR3AtErrorDeregister(pState->mpUVM, Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2); 1352 1352 1353 1353 if (RT_FAILURE(vrc)) … … 1412 1412 { 1413 1413 if (!strcmp(szCmd, "hand-over-resume")) 1414 vrc = VMR3Resume( VMR3GetVM(pState->mpUVM));1414 vrc = VMR3Resume(pState->mpUVM); 1415 1415 else 1416 1416 pState->mptrConsole->setMachineState(MachineState_Paused); -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r44130 r44340 223 223 uint32_t cyPNG = 0; 224 224 225 Console::SafeVMPtr p VM(that->mParent);226 if ( SUCCEEDED(pVM.rc()))225 Console::SafeVMPtr ptrVM(that->mParent); 226 if (ptrVM.isOk()) 227 227 { 228 228 /* Query RGB bitmap. */ … … 264 264 else 265 265 { 266 LogFunc(("Failed to get VM pointer 0x%x\n", p VM.rc()));266 LogFunc(("Failed to get VM pointer 0x%x\n", ptrVM.rc())); 267 267 } 268 268 … … 859 859 { 860 860 /* protect mpVM */ 861 Console::SafeVMPtr p VM (mParent);862 AssertComRC (p VM.rc());863 864 STAM_REG(p VM, &StatDisplayRefresh, STAMTYPE_PROFILE, "/PROF/Display/Refresh", STAMUNIT_TICKS_PER_CALL, "Time spent in EMT for display updates.");861 Console::SafeVMPtr ptrVM (mParent); 862 AssertComRC (ptrVM.rc()); 863 864 STAM_REG(ptrVM.raw(), &StatDisplayRefresh, STAMTYPE_PROFILE, "/PROF/Display/Refresh", STAMUNIT_TICKS_PER_CALL, "Time spent in EMT for display updates."); 865 865 stam = 1; 866 866 } … … 2069 2069 } 2070 2070 2071 STDMETHODIMP Display::SetFramebuffer (ULONG aScreenId, 2072 IFramebuffer *aFramebuffer) 2071 STDMETHODIMP Display::SetFramebuffer(ULONG aScreenId, IFramebuffer *aFramebuffer) 2073 2072 { 2074 2073 LogRelFlowFunc (("\n")); … … 2078 2077 2079 2078 AutoCaller autoCaller(this); 2080 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2079 if (FAILED(autoCaller.rc())) 2080 return autoCaller.rc(); 2081 2081 2082 2082 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2083 2083 2084 Console::SafeVMPtrQuiet p VM(mParent);2085 if (p VM.isOk())2084 Console::SafeVMPtrQuiet ptrVM(mParent); 2085 if (ptrVM.isOk()) 2086 2086 { 2087 2087 /* Must release the lock here because the changeFramebuffer will … … 2090 2090 2091 2091 /* send request to the EMT thread */ 2092 int vrc = VMR3ReqCallWait (pVM, VMCPUID_ANY,2093 (PFNRT) 2092 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, 2093 (PFNRT)changeFramebuffer, 3, this, aFramebuffer, aScreenId); 2094 2094 2095 2095 alock.acquire(); … … 2323 2323 } 2324 2324 2325 static int displayTakeScreenshot(PVM pVM, Display *pDisplay, struct DRVMAINDISPLAY *pDrv, ULONG aScreenId, BYTE *address, ULONG width, ULONG height) 2325 static int displayTakeScreenshot(PUVM pUVM, Display *pDisplay, struct DRVMAINDISPLAY *pDrv, ULONG aScreenId, 2326 BYTE *address, ULONG width, ULONG height) 2326 2327 { 2327 2328 uint8_t *pu8Data = NULL; … … 2338 2339 it would be nice to have an accurate screenshot for the bug 2339 2340 report if the VM deadlocks. */ 2340 vrc = VMR3ReqPriorityCallWait (pVM, VMCPUID_ANY, (PFNRT)Display::displayTakeScreenshotEMT, 6,2341 pDisplay, aScreenId, &pu8Data, &cbData, &cx, &cy);2341 vrc = VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)Display::displayTakeScreenshotEMT, 6, 2342 pDisplay, aScreenId, &pu8Data, &cbData, &cx, &cy); 2342 2343 if (vrc != VERR_TRY_AGAIN) 2343 2344 { … … 2417 2418 CHECK_CONSOLE_DRV(mpDrv); 2418 2419 2419 Console::SafeVMPtr pVM(mParent); 2420 if (FAILED(pVM.rc())) return pVM.rc(); 2420 Console::SafeVMPtr ptrVM(mParent); 2421 if (!ptrVM.isOk()) 2422 return ptrVM.rc(); 2421 2423 2422 2424 HRESULT rc = S_OK; … … 2431 2433 alock.release(); 2432 2434 2433 int vrc = displayTakeScreenshot(p VM, this, mpDrv, aScreenId, address, width, height);2435 int vrc = displayTakeScreenshot(ptrVM.rawUVM(), this, mpDrv, aScreenId, address, width, height); 2434 2436 2435 2437 if (vrc == VERR_NOT_IMPLEMENTED) … … 2469 2471 CHECK_CONSOLE_DRV(mpDrv); 2470 2472 2471 Console::SafeVMPtr pVM(mParent); 2472 if (FAILED(pVM.rc())) return pVM.rc(); 2473 Console::SafeVMPtr ptrVM(mParent); 2474 if (!ptrVM.isOk()) 2475 return ptrVM.rc(); 2473 2476 2474 2477 HRESULT rc = S_OK; … … 2489 2492 return E_OUTOFMEMORY; 2490 2493 2491 int vrc = displayTakeScreenshot(p VM, this, mpDrv, aScreenId, pu8Data, width, height);2494 int vrc = displayTakeScreenshot(ptrVM.rawUVM(), this, mpDrv, aScreenId, pu8Data, width, height); 2492 2495 2493 2496 if (RT_SUCCESS(vrc)) … … 2545 2548 CHECK_CONSOLE_DRV(mpDrv); 2546 2549 2547 Console::SafeVMPtr pVM(mParent); 2548 if (FAILED(pVM.rc())) return pVM.rc(); 2550 Console::SafeVMPtr ptrVM(mParent); 2551 if (!ptrVM.isOk()) 2552 return ptrVM.rc(); 2549 2553 2550 2554 HRESULT rc = S_OK; … … 2565 2569 return E_OUTOFMEMORY; 2566 2570 2567 int vrc = displayTakeScreenshot(p VM, this, mpDrv, aScreenId, pu8Data, width, height);2571 int vrc = displayTakeScreenshot(ptrVM.rawUVM(), this, mpDrv, aScreenId, pu8Data, width, height); 2568 2572 2569 2573 if (RT_SUCCESS(vrc)) … … 2732 2736 CHECK_CONSOLE_DRV (mpDrv); 2733 2737 2734 Console::SafeVMPtr pVM(mParent); 2735 if (FAILED(pVM.rc())) return pVM.rc(); 2738 Console::SafeVMPtr ptrVM(mParent); 2739 if (!ptrVM.isOk()) 2740 return ptrVM.rc(); 2736 2741 2737 2742 /* Release lock because the call scheduled on EMT may also try to take it. */ … … 2742 2747 * dirty conversion work. 2743 2748 */ 2744 int rcVBox = VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)Display::drawToScreenEMT, 7,2745 this, aScreenId, address, x, y, width, height);2749 int rcVBox = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::drawToScreenEMT, 7, 2750 this, aScreenId, address, x, y, width, height); 2746 2751 2747 2752 /* … … 2852 2857 CHECK_CONSOLE_DRV (mpDrv); 2853 2858 2854 Console::SafeVMPtr pVM(mParent); 2855 if (FAILED(pVM.rc())) return pVM.rc(); 2859 Console::SafeVMPtr ptrVM(mParent); 2860 if (!ptrVM.isOk()) 2861 return ptrVM.rc(); 2856 2862 2857 2863 HRESULT rc = S_OK; … … 2863 2869 2864 2870 /* pdm.h says that this has to be called from the EMT thread */ 2865 int rcVBox = VMR3ReqCallVoidWait (pVM, VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT,2866 1, this);2871 int rcVBox = VMR3ReqCallVoidWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT, 2872 1, this); 2867 2873 alock.acquire(); 2868 2874 … … 2979 2985 * time-critical method. 2980 2986 */ 2981 Console::SafeVMPtrQuiet p VM (mParent);2982 if (p VM.isOk())2983 VM_ASSERT_EMT (pVM.raw());2987 Console::SafeVMPtrQuiet ptrVM (mParent); 2988 if (ptrVM.isOk()) 2989 Assert(VM_IS_EMT(ptrVM.raw())); 2984 2990 #endif 2985 2991 -
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r43387 r44340 28 28 #include <VBox/vmm/csam.h> 29 29 #include <VBox/vmm/vm.h> 30 #include <VBox/vmm/uvm.h> 30 31 #include <VBox/vmm/tm.h> 31 32 #include <VBox/vmm/hm.h> … … 826 827 827 828 /** 828 * Hack for getting the VM handle.829 * Hack for getting the user mode VM handle (UVM). 829 830 * 830 831 * This is only temporary (promise) while prototyping the debugger. … … 834 835 * uintptr_t in COM, we're using the max integer. 835 836 * (No, ULONG is not pointer sized!) 836 */ 837 STDMETHODIMP MachineDebugger::COMGETTER(VM)(LONG64 *a_u64Vm) 838 { 839 CheckComArgOutPointerValid(a_u64Vm); 837 * @remarks The returned handle must be passed to VMR3ReleaseUVM()! 838 * @remarks Prior to 4.3 this returned PVM. 839 */ 840 STDMETHODIMP MachineDebugger::COMGETTER(VM)(LONG64 *a_i64Vm) 841 { 842 CheckComArgOutPointerValid(a_i64Vm); 840 843 841 844 AutoCaller autoCaller(this); … … 848 851 hrc = ptrVM.rc(); 849 852 if (SUCCEEDED(hrc)) 850 *a_u64Vm = (intptr_t)ptrVM.raw(); 853 { 854 VMR3RetainUVM(ptrVM.rawUVM()); 855 *a_i64Vm = (intptr_t)ptrVM.rawUVM(); 856 } 851 857 852 858 /* -
trunk/src/VBox/VMM/VMMR3/CFGM.cpp
r41975 r44340 61 61 #include "CFGMInternal.h" 62 62 #include <VBox/vmm/vm.h> 63 #include <VBox/vmm/uvm.h> 63 64 #include <VBox/err.h> 64 65 65 66 #include <VBox/log.h> 66 67 #include <iprt/assert.h> 68 #include <iprt/param.h> 67 69 #include <iprt/string.h> 68 70 #include <iprt/uuid.h> … … 159 161 VMMR3DECL(PCFGMNODE) CFGMR3GetRoot(PVM pVM) 160 162 { 163 return pVM->cfgm.s.pRoot; 164 } 165 166 167 /** 168 * Gets the root node for the VM. 169 * 170 * @returns Pointer to root node. 171 * @param pVM Pointer to the VM. 172 */ 173 VMMR3DECL(PCFGMNODE) CFGMR3GetRootU(PUVM pUVM) 174 { 175 UVM_ASSERT_VALID_EXT_RETURN(pUVM, NULL); 176 PVM pVM = pUVM->pVM; 177 AssertReturn(pVM, NULL); 161 178 return pVM->cfgm.s.pRoot; 162 179 } -
trunk/src/VBox/VMM/VMMR3/DBGFOS.cpp
r41965 r44340 442 442 */ 443 443 void *pvIf = NULL; 444 VMR3ReqPriorityCallVoidWait (pVM, VMCPUID_ANY, (PFNRT)dbgfR3OSQueryInterface, 3, pVM, enmIf, &pvIf);444 VMR3ReqPriorityCallVoidWaitU(pVM->pUVM, VMCPUID_ANY, (PFNRT)dbgfR3OSQueryInterface, 3, pVM, enmIf, &pvIf); 445 445 return pvIf; 446 446 } -
trunk/src/VBox/VMM/VMMR3/EM.cpp
r44195 r44340 62 62 #endif 63 63 #include "EMInternal.h" 64 #include "internal/em.h"65 64 #include <VBox/vmm/vm.h> 66 65 #include <VBox/vmm/cpumdis.h> … … 1516 1515 if (VM_FF_TESTANDCLEAR(pVM, VM_FF_RESET)) 1517 1516 { 1518 rc2 = VMR3Reset(pVM );1517 rc2 = VMR3Reset(pVM->pUVM); 1519 1518 UPDATE_RC(); 1520 1519 } … … 1861 1860 * 1862 1861 */ 1863 VMMR3 DECL(bool) EMR3IsExecutionAllowed(PVM pVM, PVMCPU pVCpu)1862 VMMR3_INT_DECL(bool) EMR3IsExecutionAllowed(PVM pVM, PVMCPU pVCpu) 1864 1863 { 1865 1864 uint64_t u64UserTime, u64KernelTime; … … 2382 2381 * @param pVM Pointer to the VM. 2383 2382 */ 2384 VMMR3 DECL(int) EMR3NotifySuspend(PVM pVM)2383 VMMR3_INT_DECL(int) EMR3NotifySuspend(PVM pVM) 2385 2384 { 2386 2385 PVMCPU pVCpu = VMMGetCpu(pVM); … … 2397 2396 * @param pVM Pointer to the VM. 2398 2397 */ 2399 VMMR3 DECL(int) EMR3NotifyResume(PVM pVM)2398 VMMR3_INT_DECL(int) EMR3NotifyResume(PVM pVM) 2400 2399 { 2401 2400 PVMCPU pVCpu = VMMGetCpu(pVM); -
trunk/src/VBox/VMM/VMMR3/EMHM.cpp
r43394 r44340 40 40 #include <VBox/vmm/hm.h> 41 41 #include "EMInternal.h" 42 #include "internal/em.h"43 42 #include <VBox/vmm/vm.h> 44 43 #include <VBox/vmm/cpumdis.h> -
trunk/src/VBox/VMM/VMMR3/EMRaw.cpp
r42772 r44340 42 42 #include <VBox/vmm/patm.h> 43 43 #include "EMInternal.h" 44 #include "internal/em.h"45 44 #include <VBox/vmm/vm.h> 46 45 #include <VBox/vmm/cpumdis.h> -
trunk/src/VBox/VMM/VMMR3/FTM.cpp
r41801 r44340 21 21 *******************************************************************************/ 22 22 #define LOG_GROUP LOG_GROUP_FTM 23 #include <VBox/vmm/ftm.h> 24 #include <VBox/vmm/em.h> 25 #include <VBox/vmm/pdm.h> 26 #include <VBox/vmm/pgm.h> 27 #include <VBox/vmm/ssm.h> 28 #include <VBox/vmm/vmm.h> 23 29 #include "FTMInternal.h" 24 30 #include <VBox/vmm/vm.h> 25 #include <VBox/vmm/vmm.h>26 31 #include <VBox/err.h> 27 32 #include <VBox/param.h> 28 #include <VBox/vmm/ssm.h>29 33 #include <VBox/log.h> 30 #include <VBox/vmm/pgm.h>31 #include <VBox/vmm/pdm.h>32 34 33 35 #include <iprt/assert.h> … … 40 42 #include <iprt/asm.h> 41 43 42 #include "internal/vm.h"43 #include "internal/em.h"44 44 #include "internal/pgm.h" 45 45 46 46 47 /******************************************************************************* … … 636 637 bool fSuspended = false; 637 638 638 int rc = VMR3Suspend(pVM );639 int rc = VMR3Suspend(pVM->pUVM); 639 640 AssertRCReturn(rc, rc); 640 641 … … 654 655 655 656 pVM->ftm.s.fDeltaLoadSaveActive = false; 656 rc = VMR3SaveFT(pVM , &g_ftmR3TcpOps, pVM, &fSuspended, false /* fSkipStateChanges */);657 rc = VMR3SaveFT(pVM->pUVM, &g_ftmR3TcpOps, pVM, &fSuspended, false /* fSkipStateChanges */); 657 658 AssertRC(rc); 658 659 … … 666 667 AssertRCReturn(rc, rc); 667 668 668 rc = VMR3Resume(pVM );669 rc = VMR3Resume(pVM->pUVM); 669 670 AssertRC(rc); 670 671 … … 1089 1090 1090 1091 pVM->ftm.s.fDeltaLoadSaveActive = (fFullSync == false); 1091 rc = VMR3LoadFromStreamFT(pVM , &g_ftmR3TcpOps, pVM);1092 rc = VMR3LoadFromStreamFT(pVM->pUVM, &g_ftmR3TcpOps, pVM); 1092 1093 pVM->ftm.s.fDeltaLoadSaveActive = false; 1093 1094 RTSocketRelease(pVM->ftm.s.hSocket); … … 1175 1176 /** @todo might need to disable page fusion as well */ 1176 1177 1177 return VMR3PowerOn(pVM); 1178 } 1179 else 1180 { 1181 /* standby */ 1182 rc = RTThreadCreate(NULL, ftmR3StandbyThread, pVM, 1183 0, RTTHREADTYPE_DEFAULT, 0, "ftmStandby"); 1184 if (RT_FAILURE(rc)) 1185 return rc; 1186 1187 rc = RTTcpServerCreateEx(pszAddress, uPort, &pVM->ftm.s.standby.hServer); 1188 if (RT_FAILURE(rc)) 1189 return rc; 1190 pVM->ftm.s.fIsStandbyNode = true; 1191 1192 rc = RTTcpServerListen(pVM->ftm.s.standby.hServer, ftmR3StandbyServeConnection, pVM); 1193 /** @todo deal with the exit code to check if we should activate this standby VM. */ 1194 if (pVM->ftm.s.fActivateStandby) 1195 { 1196 /** @todo fallover. */ 1197 } 1198 1199 if (pVM->ftm.s.standby.hServer) 1200 { 1201 RTTcpServerDestroy(pVM->ftm.s.standby.hServer); 1202 pVM->ftm.s.standby.hServer = NULL; 1203 } 1204 if (rc == VERR_TCP_SERVER_SHUTDOWN) 1205 rc = VINF_SUCCESS; /* ignore this error; the standby process was cancelled. */ 1206 } 1178 return VMR3PowerOn(pVM->pUVM); 1179 } 1180 1181 1182 /* standby */ 1183 rc = RTThreadCreate(NULL, ftmR3StandbyThread, pVM, 1184 0, RTTHREADTYPE_DEFAULT, 0, "ftmStandby"); 1185 if (RT_FAILURE(rc)) 1186 return rc; 1187 1188 rc = RTTcpServerCreateEx(pszAddress, uPort, &pVM->ftm.s.standby.hServer); 1189 if (RT_FAILURE(rc)) 1190 return rc; 1191 pVM->ftm.s.fIsStandbyNode = true; 1192 1193 rc = RTTcpServerListen(pVM->ftm.s.standby.hServer, ftmR3StandbyServeConnection, pVM); 1194 /** @todo deal with the exit code to check if we should activate this standby VM. */ 1195 if (pVM->ftm.s.fActivateStandby) 1196 { 1197 /** @todo fallover. */ 1198 } 1199 1200 if (pVM->ftm.s.standby.hServer) 1201 { 1202 RTTcpServerDestroy(pVM->ftm.s.standby.hServer); 1203 pVM->ftm.s.standby.hServer = NULL; 1204 } 1205 if (rc == VERR_TCP_SERVER_SHUTDOWN) 1206 rc = VINF_SUCCESS; /* ignore this error; the standby process was cancelled. */ 1207 1207 return rc; 1208 1208 } … … 1267 1267 1268 1268 pVM->ftm.s.fDeltaLoadSaveActive = true; 1269 rc = VMR3SaveFT(pVM , &g_ftmR3TcpOps, pVM, &fSuspended, true /* fSkipStateChanges */);1269 rc = VMR3SaveFT(pVM->pUVM, &g_ftmR3TcpOps, pVM, &fSuspended, true /* fSkipStateChanges */); 1270 1270 pVM->ftm.s.fDeltaLoadSaveActive = false; 1271 1271 AssertRC(rc); -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r43765 r44340 3164 3164 { 3165 3165 /* We own the IOM lock here and could cause a deadlock by waiting for a VCPU that is blocking on the IOM lock. */ 3166 rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3Suspend, 1, pVM );3166 rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3Suspend, 1, pVM->pUVM); 3167 3167 AssertRC(rc); 3168 3168 rc = VINF_EM_SUSPEND; 3169 3169 } 3170 3170 else 3171 rc = VMR3Suspend(pVM );3171 rc = VMR3Suspend(pVM->pUVM); 3172 3172 3173 3173 LogFlow(("pdmR3DevHlp_VMSuspend: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); … … 3189 3189 * Suspend the VM first then do the saving. 3190 3190 */ 3191 int rc = VMR3Suspend(pVM );3191 int rc = VMR3Suspend(pVM->pUVM); 3192 3192 if (RT_SUCCESS(rc)) 3193 3193 { … … 3200 3200 if (RT_SUCCESS(rc)) 3201 3201 { 3202 rc = VMR3PowerOff(pVM );3202 rc = VMR3PowerOff(pVM->pUVM); 3203 3203 if (RT_FAILURE(rc)) 3204 3204 LogRel(("%s/SSP: VMR3PowerOff failed: %Rrc\n", pDevIns->pReg->szName, rc)); … … 3255 3255 { 3256 3256 /* We own the IOM lock here and could cause a deadlock by waiting for a VCPU that is blocking on the IOM lock. */ 3257 rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3PowerOff, 1, pVM );3257 rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3PowerOff, 1, pVM->pUVM); 3258 3258 AssertRC(rc); 3259 3259 /* Set the VCPU state to stopped here as well to make sure no … … 3264 3264 } 3265 3265 else 3266 rc = VMR3PowerOff(pVM );3266 rc = VMR3PowerOff(pVM->pUVM); 3267 3267 3268 3268 LogFlow(("pdmR3DevHlp_VMPowerOff: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); -
trunk/src/VBox/VMM/VMMR3/PGM.cpp
r43387 r44340 1369 1369 */ 1370 1370 #ifdef VBOX_STRICT 1371 VMR3AtStateRegister(pVM , pgmR3ResetNoMorePhysWritesFlag, NULL);1371 VMR3AtStateRegister(pVM->pUVM, pgmR3ResetNoMorePhysWritesFlag, NULL); 1372 1372 #endif 1373 1373 PGMRegisterStringFormatTypes(); -
trunk/src/VBox/VMM/VMMR3/VM.cpp
r43657 r44340 91 91 92 92 /******************************************************************************* 93 * Structures and Typedefs *94 *******************************************************************************/95 /**96 * VM destruction callback registration record.97 */98 typedef struct VMATDTOR99 {100 /** Pointer to the next record in the list. */101 struct VMATDTOR *pNext;102 /** Pointer to the callback function. */103 PFNVMATDTOR pfnAtDtor;104 /** The user argument. */105 void *pvUser;106 } VMATDTOR;107 /** Pointer to a VM destruction callback registration record. */108 typedef VMATDTOR *PVMATDTOR;109 110 111 /*******************************************************************************112 93 * Global Variables * 113 94 *******************************************************************************/ 114 95 /** Pointer to the list of VMs. */ 115 96 static PUVM g_pUVMsHead = NULL; 116 117 /** Pointer to the list of at VM destruction callbacks. */118 static PVMATDTOR g_pVMAtDtorHead = NULL;119 /** Lock the g_pVMAtDtorHead list. */120 #define VM_ATDTOR_LOCK() do { } while (0)121 /** Unlock the g_pVMAtDtorHead list. */122 #define VM_ATDTOR_UNLOCK() do { } while (0)123 97 124 98 … … 194 168 * This is called in the context of an EMT0. 195 169 * @param pvUserCFGM The user argument passed to pfnCFGMConstructor. 196 * @param ppVM Where to store the 'handle' of the created VM. 170 * @param ppVM Where to optionally store the 'handle' of the 171 * created VM. 172 * @param ppUVM Where to optionally store the user 'handle' of 173 * the created VM, this includes one reference as 174 * if VMR3RetainUVM() was called. The caller 175 * *MUST* remember to pass the returned value to 176 * VMR3ReleaseUVM() once done with the handle. 197 177 */ 198 178 VMMR3DECL(int) VMR3Create(uint32_t cCpus, PCVMM2USERMETHODS pVmm2UserMethods, 199 179 PFNVMATERROR pfnVMAtError, void *pvUserVM, 200 180 PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, 201 PVM *ppVM )202 { 203 LogFlow(("VMR3Create: cCpus=%RU32 pVmm2UserMethods=%p pfnVMAtError=%p pvUserVM=%p pfnCFGMConstructor=%p pvUserCFGM=%p ppVM=%p \n",204 cCpus, pVmm2UserMethods, pfnVMAtError, pvUserVM, pfnCFGMConstructor, pvUserCFGM, ppVM ));181 PVM *ppVM, PUVM *ppUVM) 182 { 183 LogFlow(("VMR3Create: cCpus=%RU32 pVmm2UserMethods=%p pfnVMAtError=%p pvUserVM=%p pfnCFGMConstructor=%p pvUserCFGM=%p ppVM=%p ppUVM=%p\n", 184 cCpus, pVmm2UserMethods, pfnVMAtError, pvUserVM, pfnCFGMConstructor, pvUserCFGM, ppVM, ppUVM)); 205 185 206 186 if (pVmm2UserMethods) … … 218 198 AssertPtrNullReturn(pfnVMAtError, VERR_INVALID_POINTER); 219 199 AssertPtrNullReturn(pfnCFGMConstructor, VERR_INVALID_POINTER); 220 AssertPtrReturn(ppVM, VERR_INVALID_POINTER); 200 AssertPtrNullReturn(ppVM, VERR_INVALID_POINTER); 201 AssertPtrNullReturn(ppUVM, VERR_INVALID_POINTER); 202 AssertReturn(ppVM || ppUVM, VERR_INVALID_PARAMETER); 221 203 222 204 /* … … 248 230 return rc; 249 231 if (pfnVMAtError) 250 rc = VMR3AtErrorRegister U(pUVM, pfnVMAtError, pvUserVM);232 rc = VMR3AtErrorRegister(pUVM, pfnVMAtError, pvUserVM); 251 233 if (RT_SUCCESS(rc)) 252 234 { … … 277 259 * Success! 278 260 */ 279 *ppVM = pUVM->pVM; 280 LogFlow(("VMR3Create: returns VINF_SUCCESS *ppVM=%p\n", *ppVM)); 261 if (ppVM) 262 *ppVM = pUVM->pVM; 263 if (ppUVM) 264 { 265 VMR3RetainUVM(pUVM); 266 *ppUVM = pUVM; 267 } 268 LogFlow(("VMR3Create: returns VINF_SUCCESS (pVM=%p, pUVM=%p\n", pUVM->pVM, pUVM)); 281 269 return VINF_SUCCESS; 282 270 } … … 364 352 365 353 default: 366 if (VMR3GetErrorCount U(pUVM) == 0)354 if (VMR3GetErrorCount(pUVM) == 0) 367 355 pszError = RTErrGetFull(rc); 368 356 else … … 761 749 { 762 750 /* 763 * Set the state and link into the global list.751 * Set the state and we're done. 764 752 */ 765 753 vmR3SetState(pVM, VMSTATE_CREATED, VMSTATE_CREATING); 766 pUVM->pNext = g_pUVMsHead;767 g_pUVMsHead = pUVM;768 754 769 755 #ifdef LOG_ENABLED … … 1177 1163 * @param offDelta Relocation delta relative to old location. 1178 1164 */ 1179 VMMR3 DECL(void)VMR3Relocate(PVM pVM, RTGCINTPTR offDelta)1165 VMMR3_INT_DECL(void) VMR3Relocate(PVM pVM, RTGCINTPTR offDelta) 1180 1166 { 1181 1167 LogFlow(("VMR3Relocate: offDelta=%RGv\n", offDelta)); … … 1259 1245 * @returns VBox status code. 1260 1246 * 1261 * @param p VMThe VM to power on.1247 * @param pUVM The VM to power on. 1262 1248 * 1263 1249 * @thread Any thread. … … 1265 1251 * @vmstateto PoweringOn+Running 1266 1252 */ 1267 VMMR3DECL(int) VMR3PowerOn(PVM pVM) 1268 { 1269 LogFlow(("VMR3PowerOn: pVM=%p\n", pVM)); 1253 VMMR3DECL(int) VMR3PowerOn(PUVM pUVM) 1254 { 1255 LogFlow(("VMR3PowerOn: pUVM=%p\n", pUVM)); 1256 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1257 PVM pVM = pUVM->pVM; 1270 1258 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1271 1259 … … 1353 1341 * code that has to be propagated up the call stack. 1354 1342 * 1355 * @param p VMThe VM to suspend.1343 * @param pUVM The VM to suspend. 1356 1344 * 1357 1345 * @thread Any thread. … … 1359 1347 * @vmstateto Suspending + Suspended or SuspendingExtLS + SuspendedExtLS 1360 1348 */ 1361 VMMR3DECL(int) VMR3Suspend(P VM pVM)1362 { 1363 LogFlow(("VMR3Suspend: p VM=%p\n", pVM));1364 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);1349 VMMR3DECL(int) VMR3Suspend(PUVM pUVM) 1350 { 1351 LogFlow(("VMR3Suspend: pUVM=%p\n", pUVM)); 1352 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1365 1353 1366 1354 /* … … 1368 1356 * changing the VM state. 1369 1357 */ 1370 int rc = VMMR3EmtRendezvous(p VM, VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING | VMMEMTRENDEZVOUS_FLAGS_STOP_ON_ERROR,1358 int rc = VMMR3EmtRendezvous(pUVM->pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING | VMMEMTRENDEZVOUS_FLAGS_STOP_ON_ERROR, 1371 1359 vmR3Suspend, NULL); 1372 1360 LogFlow(("VMR3Suspend: returns %Rrc\n", rc)); … … 1440 1428 * @vmstateto Running 1441 1429 */ 1442 VMMR3DECL(int) VMR3Resume(PVM pVM) 1443 { 1444 LogFlow(("VMR3Resume: pVM=%p\n", pVM)); 1430 VMMR3DECL(int) VMR3Resume(PUVM pUVM) 1431 { 1432 LogFlow(("VMR3Resume: pUVM=%p\n", pUVM)); 1433 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1434 PVM pVM = pUVM->pVM; 1445 1435 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1446 1436 … … 1818 1808 * @returns VBox status code. 1819 1809 * 1820 * @param p VMThe VM which state should be saved.1810 * @param pUVM The VM which state should be saved. 1821 1811 * @param pszFilename The name of the save state file. 1822 1812 * @param pStreamOps The stream methods. … … 1833 1823 * RunningLS+SuspendingLS+SuspendedLS+Saving+Suspended. 1834 1824 */ 1835 VMMR3DECL(int) VMR3Save(P VM pVM, const char *pszFilename, bool fContinueAfterwards, PFNVMPROGRESS pfnProgress, void *pvUser, bool *pfSuspended)1836 { 1837 LogFlow(("VMR3Save: p VM=%p pszFilename=%p:{%s} fContinueAfterwards=%RTbool pfnProgress=%p pvUser=%p pfSuspended=%p\n",1838 p VM, pszFilename, pszFilename, fContinueAfterwards, pfnProgress, pvUser, pfSuspended));1825 VMMR3DECL(int) VMR3Save(PUVM pUVM, const char *pszFilename, bool fContinueAfterwards, PFNVMPROGRESS pfnProgress, void *pvUser, bool *pfSuspended) 1826 { 1827 LogFlow(("VMR3Save: pUVM=%p pszFilename=%p:{%s} fContinueAfterwards=%RTbool pfnProgress=%p pvUser=%p pfSuspended=%p\n", 1828 pUVM, pszFilename, pszFilename, fContinueAfterwards, pfnProgress, pvUser, pfSuspended)); 1839 1829 1840 1830 /* … … 1843 1833 AssertPtr(pfSuspended); 1844 1834 *pfSuspended = false; 1835 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1836 PVM pVM = pUVM->pVM; 1845 1837 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1846 1838 VM_ASSERT_OTHER_THREAD(pVM); … … 1864 1856 * Save current VM state (used by FTM) 1865 1857 * 1866 * Can be used for both saving the state and creating snapshots.1867 *1868 * When called for a VM in the Running state, the saved state is created live1869 * and the VM is only suspended when the final part of the saving is preformed.1870 * The VM state will not be restored to Running in this case and it's up to the1871 * caller to call VMR3Resume if this is desirable. (The rational is that the1872 * caller probably wish to reconfigure the disks before resuming the VM.)1873 1858 * 1874 1859 * @returns VBox status code. … … 1885 1870 * RunningLS+SuspendingLS+SuspendedLS+Saving+Suspended. 1886 1871 */ 1887 VMMR3DECL(int) VMR3SaveFT(PVM pVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, bool *pfSuspended, 1888 bool fSkipStateChanges) 1889 { 1890 LogFlow(("VMR3SaveFT: pVM=%p pStreamOps=%p pvSteamOpsUser=%p pfSuspended=%p\n", 1891 pVM, pStreamOps, pvStreamOpsUser, pfSuspended)); 1872 VMMR3_INT_DECL(int) VMR3SaveFT(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, bool *pfSuspended, bool fSkipStateChanges) 1873 { 1874 LogFlow(("VMR3SaveFT: pUVM=%p pStreamOps=%p pvSteamOpsUser=%p pfSuspended=%p\n", 1875 pUVM, pStreamOps, pvStreamOpsUser, pfSuspended)); 1892 1876 1893 1877 /* … … 1896 1880 AssertPtr(pfSuspended); 1897 1881 *pfSuspended = false; 1882 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1883 PVM pVM = pUVM->pVM; 1898 1884 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1899 1885 AssertReturn(pStreamOps, VERR_INVALID_PARAMETER); … … 1916 1902 * @returns VBox status code. 1917 1903 * 1918 * @param p VMThe VM which state should be saved.1904 * @param pUVM The VM which state should be saved. 1919 1905 * @param cMsMaxDowntime The maximum downtime given as milliseconds. 1920 1906 * @param pStreamOps The stream methods. … … 1929 1915 * RunningLS+SuspendingLS+SuspendedLS+Saving+Suspended. 1930 1916 */ 1931 VMMR3DECL(int) VMR3Teleport(P VM pVM, uint32_t cMsMaxDowntime, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser,1917 VMMR3DECL(int) VMR3Teleport(PUVM pUVM, uint32_t cMsMaxDowntime, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, 1932 1918 PFNVMPROGRESS pfnProgress, void *pvProgressUser, bool *pfSuspended) 1933 1919 { 1934 LogFlow(("VMR3Teleport: p VM=%p cMsMaxDowntime=%u pStreamOps=%p pvStreamOps=%p pfnProgress=%p pvProgressUser=%p\n",1935 p VM, cMsMaxDowntime, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser));1920 LogFlow(("VMR3Teleport: pUVM=%p cMsMaxDowntime=%u pStreamOps=%p pvStreamOps=%p pfnProgress=%p pvProgressUser=%p\n", 1921 pUVM, cMsMaxDowntime, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser)); 1936 1922 1937 1923 /* … … 1940 1926 AssertPtr(pfSuspended); 1941 1927 *pfSuspended = false; 1928 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1929 PVM pVM = pUVM->pVM; 1942 1930 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1943 1931 VM_ASSERT_OTHER_THREAD(pVM); … … 1963 1951 * @returns VBox status code. 1964 1952 * 1965 * @param p VMPointer to the VM.1953 * @param pUVM Pointer to the VM. 1966 1954 * @param pszFilename The name of the file. NULL if pStreamOps is used. 1967 1955 * @param pStreamOps The stream methods. NULL if pszFilename is used. … … 1974 1962 * @thread EMT. 1975 1963 */ 1976 static DECLCALLBACK(int) vmR3Load(P VM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser,1964 static DECLCALLBACK(int) vmR3Load(PUVM pUVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, 1977 1965 PFNVMPROGRESS pfnProgress, void *pvProgressUser, bool fTeleporting, 1978 1966 bool fSkipStateChanges) … … 1980 1968 int rc = VINF_SUCCESS; 1981 1969 1982 LogFlow(("vmR3Load: p VM=%p pszFilename=%p:{%s} pStreamOps=%p pvStreamOpsUser=%p pfnProgress=%p pvProgressUser=%p fTeleporting=%RTbool\n",1983 p VM, pszFilename, pszFilename, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser, fTeleporting));1970 LogFlow(("vmR3Load: pUVM=%p pszFilename=%p:{%s} pStreamOps=%p pvStreamOpsUser=%p pfnProgress=%p pvProgressUser=%p fTeleporting=%RTbool\n", 1971 pUVM, pszFilename, pszFilename, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser, fTeleporting)); 1984 1972 1985 1973 /* 1986 1974 * Validate input (paranoia). 1987 1975 */ 1988 AssertPtr(pVM); 1976 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1977 PVM pVM = pUVM->pVM; 1978 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1989 1979 AssertPtrNull(pszFilename); 1990 1980 AssertPtrNull(pStreamOps); … … 2000 1990 */ 2001 1991 rc = vmR3TrySetState(pVM, "VMR3Load", 2, 2002 2003 1992 VMSTATE_LOADING, VMSTATE_CREATED, 1993 VMSTATE_LOADING, VMSTATE_SUSPENDED); 2004 1994 if (RT_FAILURE(rc)) 2005 1995 return rc; … … 2007 1997 pVM->vm.s.fTeleportedAndNotFullyResumedYet = fTeleporting; 2008 1998 2009 uint32_t cErrorsPriorToSave = VMR3GetErrorCount(p VM);1999 uint32_t cErrorsPriorToSave = VMR3GetErrorCount(pUVM); 2010 2000 rc = SSMR3Load(pVM, pszFilename, pStreamOps, pvStreamOpsUser, SSMAFTER_RESUME, pfnProgress, pvProgressUser); 2011 2001 if (RT_SUCCESS(rc)) … … 2021 2011 vmR3SetState(pVM, VMSTATE_LOAD_FAILURE, VMSTATE_LOADING); 2022 2012 2023 if (cErrorsPriorToSave == VMR3GetErrorCount(p VM))2013 if (cErrorsPriorToSave == VMR3GetErrorCount(pUVM)) 2024 2014 rc = VMSetError(pVM, rc, RT_SRC_POS, 2025 2015 N_("Unable to restore the virtual machine's saved state from '%s'. " … … 2050 2040 * @vmstateto Loading+Suspended 2051 2041 */ 2052 VMMR3DECL(int) VMR3LoadFromFile(P VM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser)2053 { 2054 LogFlow(("VMR3LoadFromFile: p VM=%p pszFilename=%p:{%s} pfnProgress=%p pvUser=%p\n",2055 p VM, pszFilename, pszFilename, pfnProgress, pvUser));2042 VMMR3DECL(int) VMR3LoadFromFile(PUVM pUVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser) 2043 { 2044 LogFlow(("VMR3LoadFromFile: pUVM=%p pszFilename=%p:{%s} pfnProgress=%p pvUser=%p\n", 2045 pUVM, pszFilename, pszFilename, pfnProgress, pvUser)); 2056 2046 2057 2047 /* 2058 2048 * Validate input. 2059 2049 */ 2060 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);2050 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 2061 2051 AssertPtrReturn(pszFilename, VERR_INVALID_POINTER); 2062 2052 … … 2065 2055 * since there is no execution taking place when this call is allowed. 2066 2056 */ 2067 int rc = VMR3ReqCallWait (pVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,2068 pVM, pszFilename, (uintptr_t)NULL /*pStreamOps*/, (uintptr_t)NULL /*pvStreamOpsUser*/, pfnProgress, pvUser,2069 false /*fTeleporting*/, false /* fSkipStateChanges */);2057 int rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8, 2058 pUVM, pszFilename, (uintptr_t)NULL /*pStreamOps*/, (uintptr_t)NULL /*pvStreamOpsUser*/, pfnProgress, pvUser, 2059 false /*fTeleporting*/, false /* fSkipStateChanges */); 2070 2060 LogFlow(("VMR3LoadFromFile: returns %Rrc\n", rc)); 2071 2061 return rc; … … 2078 2068 * @returns VBox status code. 2079 2069 * 2080 * @param p VMPointer to the VM.2070 * @param pUVM Pointer to the VM. 2081 2071 * @param pStreamOps The stream methods. 2082 2072 * @param pvStreamOpsUser The user argument to the stream methods. … … 2088 2078 * @vmstateto Loading+Suspended 2089 2079 */ 2090 VMMR3DECL(int) VMR3LoadFromStream(P VM pVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser,2080 VMMR3DECL(int) VMR3LoadFromStream(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, 2091 2081 PFNVMPROGRESS pfnProgress, void *pvProgressUser) 2092 2082 { 2093 LogFlow(("VMR3LoadFromStream: p VM=%p pStreamOps=%p pvStreamOpsUser=%p pfnProgress=%p pvProgressUser=%p\n",2094 p VM, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser));2083 LogFlow(("VMR3LoadFromStream: pUVM=%p pStreamOps=%p pvStreamOpsUser=%p pfnProgress=%p pvProgressUser=%p\n", 2084 pUVM, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser)); 2095 2085 2096 2086 /* 2097 2087 * Validate input. 2098 2088 */ 2099 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);2089 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 2100 2090 AssertPtrReturn(pStreamOps, VERR_INVALID_POINTER); 2101 2091 … … 2104 2094 * since there is no execution taking place when this call is allowed. 2105 2095 */ 2106 int rc = VMR3ReqCallWait (pVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,2107 pVM, (uintptr_t)NULL /*pszFilename*/, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser,2108 true /*fTeleporting*/, false /* fSkipStateChanges */);2096 int rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8, 2097 pUVM, (uintptr_t)NULL /*pszFilename*/, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser, 2098 true /*fTeleporting*/, false /* fSkipStateChanges */); 2109 2099 LogFlow(("VMR3LoadFromStream: returns %Rrc\n", rc)); 2110 2100 return rc; … … 2113 2103 2114 2104 /** 2115 * VMR3LoadFromFileFT for arbitrary file streams.2105 * Special version for the FT component, it skips state changes. 2116 2106 * 2117 2107 * @returns VBox status code. 2118 2108 * 2119 * @param p VM Pointer to the VM.2109 * @param pUVM The VM handle. 2120 2110 * @param pStreamOps The stream methods. 2121 2111 * @param pvStreamOpsUser The user argument to the stream methods. … … 2127 2117 * @vmstateto Loading+Suspended 2128 2118 */ 2129 VMMR3DECL(int) VMR3LoadFromStreamFT(PVM pVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser) 2130 { 2131 LogFlow(("VMR3LoadFromStreamFT: pVM=%p pStreamOps=%p pvStreamOpsUser=%p\n", 2132 pVM, pStreamOps, pvStreamOpsUser)); 2119 VMMR3_INT_DECL(int) VMR3LoadFromStreamFT(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser) 2120 { 2121 LogFlow(("VMR3LoadFromStreamFT: pUVM=%p pStreamOps=%p pvStreamOpsUser=%p\n", pUVM, pStreamOps, pvStreamOpsUser)); 2133 2122 2134 2123 /* 2135 2124 * Validate input. 2136 2125 */ 2137 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);2126 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 2138 2127 AssertPtrReturn(pStreamOps, VERR_INVALID_POINTER); 2139 2128 … … 2142 2131 * since there is no execution taking place when this call is allowed. 2143 2132 */ 2144 int rc = VMR3ReqCallWait (pVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,2145 pVM, (uintptr_t)NULL /*pszFilename*/, pStreamOps, pvStreamOpsUser, NULL, NULL,2146 true /*fTeleporting*/, true /* fSkipStateChanges */);2133 int rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8, 2134 pUVM, (uintptr_t)NULL /*pszFilename*/, pStreamOps, pvStreamOpsUser, NULL, NULL, 2135 true /*fTeleporting*/, true /* fSkipStateChanges */); 2147 2136 LogFlow(("VMR3LoadFromStream: returns %Rrc\n", rc)); 2148 2137 return rc; … … 2288 2277 * code that has to be propagated up the call stack. 2289 2278 * 2290 * @param p VMThe handle of the VM to be powered off.2279 * @param pUVM The handle of the VM to be powered off. 2291 2280 * 2292 2281 * @thread Any thread. … … 2294 2283 * @vmstateto Off or OffLS 2295 2284 */ 2296 VMMR3DECL(int) VMR3PowerOff(PVM pVM) 2297 { 2298 LogFlow(("VMR3PowerOff: pVM=%p\n", pVM)); 2285 VMMR3DECL(int) VMR3PowerOff(PUVM pUVM) 2286 { 2287 LogFlow(("VMR3PowerOff: pUVM=%p\n", pUVM)); 2288 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 2289 PVM pVM = pUVM->pVM; 2299 2290 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 2300 2291 … … 2325 2316 * @vmstateto N/A 2326 2317 */ 2327 VMMR3DECL(int) VMR3Destroy(P VM pVM)2328 { 2329 LogFlow(("VMR3Destroy: p VM=%p\n", pVM));2318 VMMR3DECL(int) VMR3Destroy(PUVM pUVM) 2319 { 2320 LogFlow(("VMR3Destroy: pUVM=%p\n", pUVM)); 2330 2321 2331 2322 /* 2332 2323 * Validate input. 2333 2324 */ 2334 if (!p VM)2325 if (!pUVM) 2335 2326 return VERR_INVALID_VM_HANDLE; 2327 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 2328 PVM pVM = pUVM->pVM; 2336 2329 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 2337 2330 AssertLogRelReturn(!VM_IS_EMT(pVM), VERR_VM_THREAD_IS_EMT); 2338 2331 2339 2332 /* 2340 * Change VM state to destroying and unlink the VM. 2333 * Change VM state to destroying and aall vmR3Destroy on each of the EMTs 2334 * ending with EMT(0) doing the bulk of the cleanup. 2341 2335 */ 2342 2336 int rc = vmR3TrySetState(pVM, "VMR3Destroy", 1, VMSTATE_DESTROYING, VMSTATE_OFF); … … 2344 2338 return rc; 2345 2339 2346 /** @todo lock this when we start having multiple machines in a process... */2347 PUVM pUVM = pVM->pUVM; AssertPtr(pUVM);2348 if (g_pUVMsHead == pUVM)2349 g_pUVMsHead = pUVM->pNext;2350 else2351 {2352 PUVM pPrev = g_pUVMsHead;2353 while (pPrev && pPrev->pNext != pUVM)2354 pPrev = pPrev->pNext;2355 AssertMsgReturn(pPrev, ("pUVM=%p / pVM=%p is INVALID!\n", pUVM, pVM), VERR_INVALID_PARAMETER);2356 2357 pPrev->pNext = pUVM->pNext;2358 }2359 pUVM->pNext = NULL;2360 2361 /*2362 * Notify registered at destruction listeners.2363 */2364 vmR3AtDtor(pVM);2365 2366 /*2367 * Call vmR3Destroy on each of the EMTs ending with EMT(0) doing the bulk2368 * of the cleanup.2369 */2370 /* vmR3Destroy on all EMTs, ending with EMT(0). */2371 2340 rc = VMR3ReqCallWait(pVM, VMCPUID_ALL_REVERSE, (PFNRT)vmR3Destroy, 1, pVM); 2372 2341 AssertLogRelRC(rc); 2373 2342 2374 /* Wait for EMTs and destroy the UVM. */ 2343 /* 2344 * Wait for EMTs to quit and destroy the UVM. 2345 */ 2375 2346 vmR3DestroyUVM(pUVM, 30000); 2376 2347 … … 2640 2611 2641 2612 /** 2642 * Enumerates the VMs in this process.2643 *2644 * @returns Pointer to the next VM.2645 * @returns NULL when no more VMs.2646 * @param pVMPrev The previous VM2647 * Use NULL to start the enumeration.2648 */2649 VMMR3DECL(PVM) VMR3EnumVMs(PVM pVMPrev)2650 {2651 /*2652 * This is quick and dirty. It has issues with VM being2653 * destroyed during the enumeration.2654 */2655 PUVM pNext;2656 if (pVMPrev)2657 pNext = pVMPrev->pUVM->pNext;2658 else2659 pNext = g_pUVMsHead;2660 return pNext ? pNext->pVM : NULL;2661 }2662 2663 2664 /**2665 * Registers an at VM destruction callback.2666 *2667 * @returns VBox status code.2668 * @param pfnAtDtor Pointer to callback.2669 * @param pvUser User argument.2670 */2671 VMMR3DECL(int) VMR3AtDtorRegister(PFNVMATDTOR pfnAtDtor, void *pvUser)2672 {2673 /*2674 * Check if already registered.2675 */2676 VM_ATDTOR_LOCK();2677 PVMATDTOR pCur = g_pVMAtDtorHead;2678 while (pCur)2679 {2680 if (pfnAtDtor == pCur->pfnAtDtor)2681 {2682 VM_ATDTOR_UNLOCK();2683 AssertMsgFailed(("Already registered at destruction callback %p!\n", pfnAtDtor));2684 return VERR_INVALID_PARAMETER;2685 }2686 2687 /* next */2688 pCur = pCur->pNext;2689 }2690 VM_ATDTOR_UNLOCK();2691 2692 /*2693 * Allocate new entry.2694 */2695 PVMATDTOR pVMAtDtor = (PVMATDTOR)RTMemAlloc(sizeof(*pVMAtDtor));2696 if (!pVMAtDtor)2697 return VERR_NO_MEMORY;2698 2699 VM_ATDTOR_LOCK();2700 pVMAtDtor->pfnAtDtor = pfnAtDtor;2701 pVMAtDtor->pvUser = pvUser;2702 pVMAtDtor->pNext = g_pVMAtDtorHead;2703 g_pVMAtDtorHead = pVMAtDtor;2704 VM_ATDTOR_UNLOCK();2705 2706 return VINF_SUCCESS;2707 }2708 2709 2710 /**2711 * Deregisters an at VM destruction callback.2712 *2713 * @returns VBox status code.2714 * @param pfnAtDtor Pointer to callback.2715 */2716 VMMR3DECL(int) VMR3AtDtorDeregister(PFNVMATDTOR pfnAtDtor)2717 {2718 /*2719 * Find it, unlink it and free it.2720 */2721 VM_ATDTOR_LOCK();2722 PVMATDTOR pPrev = NULL;2723 PVMATDTOR pCur = g_pVMAtDtorHead;2724 while (pCur)2725 {2726 if (pfnAtDtor == pCur->pfnAtDtor)2727 {2728 if (pPrev)2729 pPrev->pNext = pCur->pNext;2730 else2731 g_pVMAtDtorHead = pCur->pNext;2732 pCur->pNext = NULL;2733 VM_ATDTOR_UNLOCK();2734 2735 RTMemFree(pCur);2736 return VINF_SUCCESS;2737 }2738 2739 /* next */2740 pPrev = pCur;2741 pCur = pCur->pNext;2742 }2743 VM_ATDTOR_UNLOCK();2744 2745 return VERR_INVALID_PARAMETER;2746 }2747 2748 2749 /**2750 * Walks the list of at VM destructor callbacks.2751 * @param pVM The VM which is about to be destroyed.2752 */2753 static void vmR3AtDtor(PVM pVM)2754 {2755 /*2756 * Find it, unlink it and free it.2757 */2758 VM_ATDTOR_LOCK();2759 for (PVMATDTOR pCur = g_pVMAtDtorHead; pCur; pCur = pCur->pNext)2760 pCur->pfnAtDtor(pVM, pCur->pvUser);2761 VM_ATDTOR_UNLOCK();2762 }2763 2764 2765 /**2766 2613 * Worker which checks integrity of some internal structures. 2767 2614 * This is yet another attempt to track down that AVL tree crash. … … 2914 2761 * 2915 2762 * @returns VBox status code. 2916 * @param p VMVM to reset.2917 */ 2918 VMMR3DECL(int) VMR3Reset(P VM pVM)2763 * @param pUVM The VM to reset. 2764 */ 2765 VMMR3DECL(int) VMR3Reset(PUVM pUVM) 2919 2766 { 2920 2767 LogFlow(("VMR3Reset:\n")); 2768 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 2769 PVM pVM = pUVM->pVM; 2921 2770 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 2922 2771 … … 3550 3399 * @thread Any thread. 3551 3400 */ 3552 VMMR3 DECL(bool) VMR3TeleportedAndNotFullyResumedYet(PVM pVM)3401 VMMR3_INT_DECL(bool) VMR3TeleportedAndNotFullyResumedYet(PVM pVM) 3553 3402 { 3554 3403 VM_ASSERT_VALID_EXT_RETURN(pVM, false); … … 3564 3413 * 3565 3414 * @returns VBox status code. 3566 * @param p VM Pointer to the VM.3415 * @param pUVM The VM handle. 3567 3416 * @param pfnAtState Pointer to callback. 3568 3417 * @param pvUser User argument. 3569 3418 * @thread Any. 3570 3419 */ 3571 VMMR3DECL(int) VMR3AtStateRegister(P VM pVM, PFNVMATSTATE pfnAtState, void *pvUser)3420 VMMR3DECL(int) VMR3AtStateRegister(PUVM pUVM, PFNVMATSTATE pfnAtState, void *pvUser) 3572 3421 { 3573 3422 LogFlow(("VMR3AtStateRegister: pfnAtState=%p pvUser=%p\n", pfnAtState, pvUser)); … … 3577 3426 */ 3578 3427 AssertPtrReturn(pfnAtState, VERR_INVALID_PARAMETER); 3579 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);3428 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 3580 3429 3581 3430 /* 3582 3431 * Allocate a new record. 3583 3432 */ 3584 PUVM pUVM = pVM->pUVM;3585 3433 PVMATSTATE pNew = (PVMATSTATE)MMR3HeapAllocU(pUVM, MM_TAG_VM, sizeof(*pNew)); 3586 3434 if (!pNew) … … 3606 3454 * 3607 3455 * @returns VBox status code. 3608 * @param p VM Pointer to the VM.3456 * @param pUVM The VM handle. 3609 3457 * @param pfnAtState Pointer to callback. 3610 3458 * @param pvUser User argument. 3611 3459 * @thread Any. 3612 3460 */ 3613 VMMR3DECL(int) VMR3AtStateDeregister(P VM pVM, PFNVMATSTATE pfnAtState, void *pvUser)3461 VMMR3DECL(int) VMR3AtStateDeregister(PUVM pUVM, PFNVMATSTATE pfnAtState, void *pvUser) 3614 3462 { 3615 3463 LogFlow(("VMR3AtStateDeregister: pfnAtState=%p pvUser=%p\n", pfnAtState, pvUser)); … … 3619 3467 */ 3620 3468 AssertPtrReturn(pfnAtState, VERR_INVALID_PARAMETER); 3621 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 3622 3623 PUVM pUVM = pVM->pUVM; 3469 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 3470 3624 3471 RTCritSectEnter(&pUVM->vm.s.AtStateCritSect); 3625 3472 … … 3676 3523 * 3677 3524 * @returns VBox status code. 3678 * @param p VM Pointer to the VM.3525 * @param pUVM The VM handle. 3679 3526 * @param pfnAtError Pointer to callback. 3680 3527 * @param pvUser User argument. 3681 3528 * @thread Any. 3682 3529 */ 3683 VMMR3DECL(int) VMR3AtErrorRegister(PVM pVM, PFNVMATERROR pfnAtError, void *pvUser) 3684 { 3685 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 3686 return VMR3AtErrorRegisterU(pVM->pUVM, pfnAtError, pvUser); 3687 } 3688 3689 3690 /** 3691 * Registers a VM error callback. 3692 * 3693 * @returns VBox status code. 3694 * @param pUVM Pointer to the VM. 3695 * @param pfnAtError Pointer to callback. 3696 * @param pvUser User argument. 3697 * @thread Any. 3698 */ 3699 VMMR3DECL(int) VMR3AtErrorRegisterU(PUVM pUVM, PFNVMATERROR pfnAtError, void *pvUser) 3530 VMMR3DECL(int) VMR3AtErrorRegister(PUVM pUVM, PFNVMATERROR pfnAtError, void *pvUser) 3700 3531 { 3701 3532 LogFlow(("VMR3AtErrorRegister: pfnAtError=%p pvUser=%p\n", pfnAtError, pvUser)); … … 3733 3564 * 3734 3565 * @returns VBox status code. 3735 * @param p VM Pointer to the VM.3566 * @param pUVM The VM handle. 3736 3567 * @param pfnAtError Pointer to callback. 3737 3568 * @param pvUser User argument. 3738 3569 * @thread Any. 3739 3570 */ 3740 VMMR3DECL(int) VMR3AtErrorDeregister(P VM pVM, PFNVMATERROR pfnAtError, void *pvUser)3571 VMMR3DECL(int) VMR3AtErrorDeregister(PUVM pUVM, PFNVMATERROR pfnAtError, void *pvUser) 3741 3572 { 3742 3573 LogFlow(("VMR3AtErrorDeregister: pfnAtError=%p pvUser=%p\n", pfnAtError, pvUser)); … … 3746 3577 */ 3747 3578 AssertPtrReturn(pfnAtError, VERR_INVALID_PARAMETER); 3748 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 3749 3750 PUVM pUVM = pVM->pUVM; 3579 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 3580 3751 3581 RTCritSectEnter(&pUVM->vm.s.AtErrorCritSect); 3752 3582 … … 3818 3648 * @thread EMT. 3819 3649 */ 3820 VMMR3 DECL(void) VMR3SetErrorWorker(PVM pVM)3650 VMMR3_INT_DECL(void) VMR3SetErrorWorker(PVM pVM) 3821 3651 { 3822 3652 VM_ASSERT_EMT(pVM); … … 3866 3696 * 3867 3697 * @returns The error count. 3868 * @param pVM Pointer to the VM. 3869 */ 3870 VMMR3DECL(uint32_t) VMR3GetErrorCount(PVM pVM) 3871 { 3872 AssertPtrReturn(pVM, 0); 3873 return VMR3GetErrorCountU(pVM->pUVM); 3874 } 3875 3876 3877 /** 3878 * Gets the number of errors raised via VMSetError. 3879 * 3880 * This can be used avoid double error messages. 3881 * 3882 * @returns The error count. 3883 * @param pVM Pointer to the VM. 3884 */ 3885 VMMR3DECL(uint32_t) VMR3GetErrorCountU(PUVM pUVM) 3698 * @param pUVM The VM handle. 3699 */ 3700 VMMR3_INT_DECL(uint32_t) VMR3GetErrorCount(PUVM pUVM) 3886 3701 { 3887 3702 AssertPtrReturn(pUVM, 0); … … 3977 3792 * @thread Any. 3978 3793 */ 3979 VMMR3DECL(int) VMR3AtRuntimeErrorRegister(P VM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser)3794 VMMR3DECL(int) VMR3AtRuntimeErrorRegister(PUVM pUVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser) 3980 3795 { 3981 3796 LogFlow(("VMR3AtRuntimeErrorRegister: pfnAtRuntimeError=%p pvUser=%p\n", pfnAtRuntimeError, pvUser)); … … 3985 3800 */ 3986 3801 AssertPtrReturn(pfnAtRuntimeError, VERR_INVALID_PARAMETER); 3987 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);3802 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 3988 3803 3989 3804 /* 3990 3805 * Allocate a new record. 3991 3806 */ 3992 PUVM pUVM = pVM->pUVM;3993 3807 PVMATRUNTIMEERROR pNew = (PVMATRUNTIMEERROR)MMR3HeapAllocU(pUVM, MM_TAG_VM, sizeof(*pNew)); 3994 3808 if (!pNew) … … 4014 3828 * 4015 3829 * @returns VBox status code. 4016 * @param p VM Pointer to the VM.3830 * @param pUVM The user mode VM handle. 4017 3831 * @param pfnAtRuntimeError Pointer to callback. 4018 3832 * @param pvUser User argument. 4019 3833 * @thread Any. 4020 3834 */ 4021 VMMR3DECL(int) VMR3AtRuntimeErrorDeregister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser)3835 VMMR3DECL(int) VMR3AtRuntimeErrorDeregister(PUVM pUVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser) 4022 3836 { 4023 3837 LogFlow(("VMR3AtRuntimeErrorDeregister: pfnAtRuntimeError=%p pvUser=%p\n", pfnAtRuntimeError, pvUser)); … … 4027 3841 */ 4028 3842 AssertPtrReturn(pfnAtRuntimeError, VERR_INVALID_PARAMETER); 4029 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 4030 4031 PUVM pUVM = pVM->pUVM; 3843 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 3844 4032 3845 RTCritSectEnter(&pUVM->vm.s.AtErrorCritSect); 4033 3846 … … 4142 3955 vmR3SetRuntimeErrorChangeState, NULL); 4143 3956 else if (fFlags & VMSETRTERR_FLAGS_SUSPEND) 4144 rc = VMR3Suspend(pVM );3957 rc = VMR3Suspend(pVM->pUVM); 4145 3958 else 4146 3959 rc = VINF_SUCCESS; … … 4188 4001 * @thread EMT. 4189 4002 */ 4190 VMMR3 DECL(int) VMR3SetRuntimeErrorWorker(PVM pVM)4003 VMMR3_INT_DECL(int) VMR3SetRuntimeErrorWorker(PVM pVM) 4191 4004 { 4192 4005 VM_ASSERT_EMT(pVM); … … 4286 4099 * 4287 4100 * @returns The runtime error count. 4101 * @param pUVM The user mode VM handle. 4102 */ 4103 VMMR3_INT_DECL(uint32_t) VMR3GetRuntimeErrorCount(PUVM pUVM) 4104 { 4105 return pUVM->vm.s.cRuntimeErrors; 4106 } 4107 4108 4109 /** 4110 * Gets the ID virtual of the virtual CPU associated with the calling thread. 4111 * 4112 * @returns The CPU ID. NIL_VMCPUID if the thread isn't an EMT. 4113 * 4288 4114 * @param pVM Pointer to the VM. 4289 4115 */ 4290 VMMR3DECL(uint32_t) VMR3GetRuntimeErrorCount(PVM pVM) 4291 { 4292 return pVM->pUVM->vm.s.cRuntimeErrors; 4293 } 4294 4295 4296 /** 4297 * Gets the ID virtual of the virtual CPU associated with the calling thread. 4298 * 4299 * @returns The CPU ID. NIL_VMCPUID if the thread isn't an EMT. 4300 * 4301 * @param pVM Pointer to the VM. 4302 */ 4303 VMMR3DECL(RTCPUID) VMR3GetVMCPUId(PVM pVM) 4116 VMMR3_INT_DECL(RTCPUID) VMR3GetVMCPUId(PVM pVM) 4304 4117 { 4305 4118 PUVMCPU pUVCpu = (PUVMCPU)RTTlsGet(pVM->pUVM->vm.s.idxTLS); … … 4350 4163 * 4351 4164 * @returns Handle if this is an EMT thread; NIL_RTNATIVETHREAD otherwise 4352 * @param p VM Pointer to the VM.4165 * @param pUVM The user mode VM handle. 4353 4166 * @thread EMT 4354 4167 */ 4355 VMMR3DECL(RTTHREAD) VMR3GetVMCPUThread(P VM pVM)4356 { 4357 PUVMCPU pUVCpu = (PUVMCPU)RTTlsGet(p VM->pUVM->vm.s.idxTLS);4168 VMMR3DECL(RTTHREAD) VMR3GetVMCPUThread(PUVM pUVM) 4169 { 4170 PUVMCPU pUVCpu = (PUVMCPU)RTTlsGet(pUVM->vm.s.idxTLS); 4358 4171 4359 4172 if (!pUVCpu) … … 4365 4178 4366 4179 /** 4367 * Returns the handle of the current EMT VMCPU thread. 4368 * 4369 * @returns Handle if this is an EMT thread; NIL_RTNATIVETHREAD otherwise 4370 * @param pVM Pointer to the VM. 4371 * @thread EMT 4372 */ 4373 VMMR3DECL(RTTHREAD) VMR3GetVMCPUThreadU(PUVM pUVM) 4374 { 4375 PUVMCPU pUVCpu = (PUVMCPU)RTTlsGet(pUVM->vm.s.idxTLS); 4376 4377 if (!pUVCpu) 4378 return NIL_RTTHREAD; 4379 4380 return pUVCpu->vm.s.ThreadEMT; 4381 } 4382 4383 4384 /** 4385 * Return the package and core id of a CPU. 4180 * Return the package and core ID of a CPU. 4386 4181 * 4387 4182 * @returns VBOX status code. 4388 * @param p VM Pointer to the VM.4183 * @param pUVM The user mode VM handle. 4389 4184 * @param idCpu Virtual CPU to get the ID from. 4390 4185 * @param pidCpuCore Where to store the core ID of the virtual CPU. … … 4392 4187 * 4393 4188 */ 4394 VMMR3DECL(int) VMR3GetCpuCoreAndPackageIdFromCpuId(P VM pVM, VMCPUID idCpu, uint32_t *pidCpuCore, uint32_t *pidCpuPackage)4189 VMMR3DECL(int) VMR3GetCpuCoreAndPackageIdFromCpuId(PUVM pUVM, VMCPUID idCpu, uint32_t *pidCpuCore, uint32_t *pidCpuPackage) 4395 4190 { 4396 4191 /* 4397 4192 * Validate input. 4398 4193 */ 4194 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 4195 PVM pVM = pUVM->pVM; 4399 4196 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 4400 4197 AssertPtrReturn(pidCpuCore, VERR_INVALID_POINTER); … … 4452 4249 * 4453 4250 * @returns VBox status code. 4454 * @param p VM Pointer to the VM.4251 * @param pUVM The user mode VM handle. 4455 4252 * @param idCpu Virtual CPU to perform the hot unplugging operation on. 4456 4253 */ 4457 VMMR3DECL(int) VMR3HotUnplugCpu(PVM pVM, VMCPUID idCpu) 4458 { 4254 VMMR3DECL(int) VMR3HotUnplugCpu(PUVM pUVM, VMCPUID idCpu) 4255 { 4256 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 4257 PVM pVM = pUVM->pVM; 4459 4258 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 4460 4259 AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID); … … 4464 4263 * offline and send it to SPIP wait. Maybe modify VMCPUSTATE and push 4465 4264 * it out of the EM loops when offline. */ 4466 return VMR3ReqCallNoWait (pVM, idCpu, (PFNRT)vmR3HotUnplugCpu, 2, pVM, idCpu);4265 return VMR3ReqCallNoWaitU(pUVM, idCpu, (PFNRT)vmR3HotUnplugCpu, 2, pVM, idCpu); 4467 4266 } 4468 4267 … … 4472 4271 * 4473 4272 * @returns VBox status code. 4474 * @param p VM Pointer to the VM.4273 * @param pUVM The user mode VM handle. 4475 4274 * @param idCpu Virtual CPU to perform the hot plugging operation on. 4476 4275 */ 4477 VMMR3DECL(int) VMR3HotPlugCpu(PVM pVM, VMCPUID idCpu) 4478 { 4276 VMMR3DECL(int) VMR3HotPlugCpu(PUVM pUVM, VMCPUID idCpu) 4277 { 4278 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 4279 PVM pVM = pUVM->pVM; 4479 4280 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 4480 4281 AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID); … … 4493 4294 * 100 is max performance (default). 4494 4295 */ 4495 VMMR3DECL(int) VMR3SetCpuExecutionCap(PVM pVM, uint32_t uCpuExecutionCap) 4496 { 4296 VMMR3DECL(int) VMR3SetCpuExecutionCap(PUVM pUVM, uint32_t uCpuExecutionCap) 4297 { 4298 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 4299 PVM pVM = pUVM->pVM; 4497 4300 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 4498 4301 AssertReturn(uCpuExecutionCap > 0 && uCpuExecutionCap <= 100, VERR_INVALID_PARAMETER); -
trunk/src/VBox/VMM/VMMR3/VMEmt.cpp
r41965 r44340 195 195 * Service a delayed reset request. 196 196 */ 197 rc = VMR3Reset(pVM );197 rc = VMR3Reset(pVM->pUVM); 198 198 VM_FF_CLEAR(pVM, VM_FF_RESET); 199 199 Log(("vmR3EmulationThread: Reset rc=%Rrc, VM state %s -> %s\n", rc, VMR3GetStateName(enmBefore), VMR3GetStateName(pVM->enmVMState))); … … 1002 1002 * @param pUVM Pointer to the user mode VM structure. 1003 1003 * @param fFlags Notification flags, VMNOTIFYFF_FLAGS_*. 1004 */ 1005 VMMR3DECL(void) VMR3NotifyGlobalFFU(PUVM pUVM, uint32_t fFlags) 1004 * @internal 1005 */ 1006 VMMR3_INT_DECL(void) VMR3NotifyGlobalFFU(PUVM pUVM, uint32_t fFlags) 1006 1007 { 1007 1008 LogFlow(("VMR3NotifyGlobalFFU:\n")); … … 1024 1025 * @param pUVM Pointer to the user mode VM structure. 1025 1026 * @param fFlags Notification flags, VMNOTIFYFF_FLAGS_*. 1026 */ 1027 VMMR3DECL(void) VMR3NotifyCpuFFU(PUVMCPU pUVCpu, uint32_t fFlags) 1027 * @internal 1028 */ 1029 VMMR3_INT_DECL(void) VMR3NotifyCpuFFU(PUVMCPU pUVCpu, uint32_t fFlags) 1028 1030 { 1029 1031 PUVM pUVM = pUVCpu->pUVM; … … 1044 1046 * @param fIgnoreInterrupts If set the VM_FF_INTERRUPT flags is ignored. 1045 1047 * @thread The emulation thread. 1046 */ 1047 VMMR3DECL(int) VMR3WaitHalted(PVM pVM, PVMCPU pVCpu, bool fIgnoreInterrupts) 1048 * @internal 1049 */ 1050 VMMR3_INT_DECL(int) VMR3WaitHalted(PVM pVM, PVMCPU pVCpu, bool fIgnoreInterrupts) 1048 1051 { 1049 1052 LogFlow(("VMR3WaitHalted: fIgnoreInterrupts=%d\n", fIgnoreInterrupts)); … … 1123 1126 * @param pUVCpu Pointer to the user mode VMCPU structure. 1124 1127 * @thread The emulation thread. 1125 */ 1126 VMMR3DECL(int) VMR3WaitU(PUVMCPU pUVCpu) 1128 * @internal 1129 */ 1130 VMMR3_INT_DECL(int) VMR3WaitU(PUVMCPU pUVCpu) 1127 1131 { 1128 1132 LogFlow(("VMR3WaitU:\n")); -
trunk/src/VBox/VMM/VMMR3/VMM.cpp
r44078 r44340 1680 1680 * Validate input. 1681 1681 */ 1682 AssertReturn(pVM, VERR_INVALID_VM_HANDLE); 1682 1683 AssertMsg( (fFlags & VMMEMTRENDEZVOUS_FLAGS_TYPE_MASK) != VMMEMTRENDEZVOUS_FLAGS_TYPE_INVALID 1683 1684 && (fFlags & VMMEMTRENDEZVOUS_FLAGS_TYPE_MASK) <= VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING -
trunk/src/VBox/VMM/VMMR3/VMReq.cpp
r41965 r44340 45 45 46 46 /** 47 * Allocate and queue a call request.48 *49 * If it's desired to poll on the completion of the request set cMillies50 * to 0 and use VMR3ReqWait() to check for completion. In the other case51 * use RT_INDEFINITE_WAIT.52 * The returned request packet must be freed using VMR3ReqFree().53 *54 * @returns VBox status code.55 * Will not return VERR_INTERRUPTED.56 * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.57 *58 * @param pVM Pointer to the VM.59 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or60 * one of the following special values:61 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.62 * @param ppReq Where to store the pointer to the request.63 * This will be NULL or a valid request pointer not matter what happens.64 * @param cMillies Number of milliseconds to wait for the request to65 * be completed. Use RT_INDEFINITE_WAIT to only66 * wait till it's completed.67 * @param fFlags A combination of the VMREQFLAGS values.68 * @param pfnFunction Pointer to the function to call.69 * @param cArgs Number of arguments following in the ellipsis.70 * @param ... Function arguments.71 *72 * @remarks See remarks on VMR3ReqCallVU.73 */74 VMMR3DECL(int) VMR3ReqCall(PVM pVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags,75 PFNRT pfnFunction, unsigned cArgs, ...)76 {77 va_list va;78 va_start(va, cArgs);79 int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, ppReq, cMillies, fFlags, pfnFunction, cArgs, va);80 va_end(va);81 return rc;82 }83 84 85 /**86 47 * Convenience wrapper for VMR3ReqCallU. 87 48 * … … 103 64 * 104 65 * @remarks See remarks on VMR3ReqCallVU. 105 */ 106 VMMR3DECL(int) VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 66 * @internal 67 */ 68 VMMR3_INT_DECL(int) VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 107 69 { 108 70 PVMREQ pReq; … … 122 84 * Convenience wrapper for VMR3ReqCallU. 123 85 * 124 * This assumes (1) you're calling a function that returns an VBox status code 125 * and that you do not wish to wait for it to complete. 126 * 127 * @returns VBox status code returned by VMR3ReqCallVU. 86 * This assumes (1) you're calling a function that returns an VBox status code, 87 * (2) that you want it's return code on success, and (3) that you wish to wait 88 * for ever for it to return. 89 * 90 * @returns VBox status code. In the unlikely event that VMR3ReqCallVU fails, 91 * its status code is return. Otherwise, the status of pfnFunction is 92 * returned. 128 93 * 129 94 * @param pVM Pointer to the VM. … … 136 101 * 137 102 * @remarks See remarks on VMR3ReqCallVU. 138 */ 139 VMMR3DECL(int) VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 140 { 103 * @internal 104 */ 105 VMMR3DECL(int) VMR3ReqCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 106 { 107 PVMREQ pReq; 141 108 va_list va; 142 109 va_start(va, cArgs); 143 int rc = VMR3ReqCallVU(p VM->pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT,110 int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS, 144 111 pfnFunction, cArgs, va); 145 112 va_end(va); 113 if (RT_SUCCESS(rc)) 114 rc = pReq->iStatus; 115 VMR3ReqFree(pReq); 146 116 return rc; 147 117 } … … 151 121 * Convenience wrapper for VMR3ReqCallU. 152 122 * 153 * This assumes (1) you're calling a function that returns void, and (2) that154 * you wish to wait for ever for it to return.155 * 156 * @returns VBox status code ofVMR3ReqCallVU.123 * This assumes (1) you're calling a function that returns an VBox status code 124 * and that you do not wish to wait for it to complete. 125 * 126 * @returns VBox status code returned by VMR3ReqCallVU. 157 127 * 158 128 * @param pVM Pointer to the VM. … … 165 135 * 166 136 * @remarks See remarks on VMR3ReqCallVU. 167 */ 168 VMMR3DECL(int) VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 137 * @internal 138 */ 139 VMMR3DECL(int) VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 140 { 141 va_list va; 142 va_start(va, cArgs); 143 int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT, 144 pfnFunction, cArgs, va); 145 va_end(va); 146 return rc; 147 } 148 149 150 /** 151 * Convenience wrapper for VMR3ReqCallU. 152 * 153 * This assumes (1) you're calling a function that returns an VBox status code 154 * and that you do not wish to wait for it to complete. 155 * 156 * @returns VBox status code returned by VMR3ReqCallVU. 157 * 158 * @param pUVM Pointer to the VM. 159 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 160 * one of the following special values: 161 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 162 * @param pfnFunction Pointer to the function to call. 163 * @param cArgs Number of arguments following in the ellipsis. 164 * @param ... Function arguments. 165 * 166 * @remarks See remarks on VMR3ReqCallVU. 167 */ 168 VMMR3DECL(int) VMR3ReqCallNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 169 { 170 va_list va; 171 va_start(va, cArgs); 172 int rc = VMR3ReqCallVU(pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT, 173 pfnFunction, cArgs, va); 174 va_end(va); 175 return rc; 176 } 177 178 179 /** 180 * Convenience wrapper for VMR3ReqCallU. 181 * 182 * This assumes (1) you're calling a function that returns void, and (2) that 183 * you wish to wait for ever for it to return. 184 * 185 * @returns VBox status code of VMR3ReqCallVU. 186 * 187 * @param pVM Pointer to the VM. 188 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 189 * one of the following special values: 190 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 191 * @param pfnFunction Pointer to the function to call. 192 * @param cArgs Number of arguments following in the ellipsis. 193 * @param ... Function arguments. 194 * 195 * @remarks See remarks on VMR3ReqCallVU. 196 * @internal 197 */ 198 VMMR3_INT_DECL(int) VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 169 199 { 170 200 PVMREQ pReq; … … 183 213 * 184 214 * This assumes (1) you're calling a function that returns void, and (2) that 215 * you wish to wait for ever for it to return. 216 * 217 * @returns VBox status code of VMR3ReqCallVU. 218 * 219 * @param pUVM Pointer to the VM. 220 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 221 * one of the following special values: 222 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 223 * @param pfnFunction Pointer to the function to call. 224 * @param cArgs Number of arguments following in the ellipsis. 225 * @param ... Function arguments. 226 * 227 * @remarks See remarks on VMR3ReqCallVU. 228 */ 229 VMMR3DECL(int) VMR3ReqCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 230 { 231 PVMREQ pReq; 232 va_list va; 233 va_start(va, cArgs); 234 int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID, 235 pfnFunction, cArgs, va); 236 va_end(va); 237 VMR3ReqFree(pReq); 238 return rc; 239 } 240 241 242 /** 243 * Convenience wrapper for VMR3ReqCallU. 244 * 245 * This assumes (1) you're calling a function that returns void, and (2) that 185 246 * you do not wish to wait for it to complete. 186 247 * … … 196 257 * 197 258 * @remarks See remarks on VMR3ReqCallVU. 259 * @internal 198 260 */ 199 261 VMMR3DECL(int) VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) … … 231 293 * 232 294 * @remarks See remarks on VMR3ReqCallVU. 295 * @internal 233 296 */ 234 297 VMMR3DECL(int) VMR3ReqPriorityCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) … … 250 313 * Convenience wrapper for VMR3ReqCallU. 251 314 * 252 * This assumes (1) you're calling a function that returns void, (2) that you 253 * wish to wait for ever for it to return, and (3) that it's priority request 254 * that can be safely be handled during async suspend and power off. 255 * 256 * @returns VBox status code of VMR3ReqCallVU. 257 * 258 * @param pVM Pointer to the VM. 315 * This assumes (1) you're calling a function that returns an VBox status code, 316 * (2) that you want it's return code on success, (3) that you wish to wait for 317 * ever for it to return, and (4) that it's priority request that can be safely 318 * be handled during async suspend and power off. 319 * 320 * @returns VBox status code. In the unlikely event that VMR3ReqCallVU fails, 321 * its status code is return. Otherwise, the status of pfnFunction is 322 * returned. 323 * 324 * @param pUVM The user mode VM handle. 259 325 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 260 326 * one of the following special values: … … 266 332 * @remarks See remarks on VMR3ReqCallVU. 267 333 */ 268 VMMR3DECL(int) VMR3ReqPriorityCall VoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)334 VMMR3DECL(int) VMR3ReqPriorityCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 269 335 { 270 336 PVMREQ pReq; 271 337 va_list va; 272 338 va_start(va, cArgs); 273 int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_PRIORITY, 339 int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_PRIORITY, 340 pfnFunction, cArgs, va); 341 va_end(va); 342 if (RT_SUCCESS(rc)) 343 rc = pReq->iStatus; 344 VMR3ReqFree(pReq); 345 return rc; 346 } 347 348 349 /** 350 * Convenience wrapper for VMR3ReqCallU. 351 * 352 * This assumes (1) you're calling a function that returns void, (2) that you 353 * wish to wait for ever for it to return, and (3) that it's priority request 354 * that can be safely be handled during async suspend and power off. 355 * 356 * @returns VBox status code of VMR3ReqCallVU. 357 * 358 * @param pUVM The user mode VM handle. 359 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 360 * one of the following special values: 361 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 362 * @param pfnFunction Pointer to the function to call. 363 * @param cArgs Number of arguments following in the ellipsis. 364 * @param ... Function arguments. 365 * 366 * @remarks See remarks on VMR3ReqCallVU. 367 */ 368 VMMR3DECL(int) VMR3ReqPriorityCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 369 { 370 PVMREQ pReq; 371 va_list va; 372 va_start(va, cArgs); 373 int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_PRIORITY, 274 374 pfnFunction, cArgs, va); 275 375 va_end(va); … … 380 480 * Allocate request 381 481 */ 382 int rc = VMR3ReqAlloc U(pUVM, &pReq, VMREQTYPE_INTERNAL, idDstCpu);482 int rc = VMR3ReqAlloc(pUVM, &pReq, VMREQTYPE_INTERNAL, idDstCpu); 383 483 if (RT_FAILURE(rc)) 384 484 return rc; … … 478 578 * @returns VBox status code. 479 579 * 480 * @param pVM Pointer to the VM.481 * @param ppReq Where to store the pointer to the allocated packet.482 * @param enmType Package type.483 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or484 * one of the following special values:485 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.486 */487 VMMR3DECL(int) VMR3ReqAlloc(PVM pVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu)488 {489 return VMR3ReqAllocU(pVM->pUVM, ppReq, enmType, idDstCpu);490 }491 492 493 /**494 * Allocates a request packet.495 *496 * The caller allocates a request packet, fills in the request data497 * union and queues the request.498 *499 * @returns VBox status code.500 *501 580 * @param pUVM Pointer to the user mode VM structure. 502 581 * @param ppReq Where to store the pointer to the allocated packet. … … 506 585 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 507 586 */ 508 VMMR3DECL(int) VMR3ReqAlloc U(PUVM pUVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu)587 VMMR3DECL(int) VMR3ReqAlloc(PUVM pUVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu) 509 588 { 510 589 /* … … 1021 1100 * @remarks This was made reentrant for async PDM handling, the debugger and 1022 1101 * others. 1023 */ 1024 VMMR3DECL(int) VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu, bool fPriorityOnly) 1102 * @internal 1103 */ 1104 VMMR3_INT_DECL(int) VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu, bool fPriorityOnly) 1025 1105 { 1026 1106 LogFlow(("VMR3ReqProcessU: (enmVMState=%d) idDstCpu=%d\n", pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING, idDstCpu)); -
trunk/src/VBox/VMM/testcase/tstAnimate.cpp
r41965 r44340 832 832 */ 833 833 PVM pVM; 834 rc = VMR3Create(1, NULL, NULL, NULL, cfgmR3CreateDefault, &cbMem, &pVM); 834 PUVM pUVM; 835 rc = VMR3Create(1, NULL, NULL, NULL, cfgmR3CreateDefault, &cbMem, &pVM, &pUVM); 835 836 if (RT_SUCCESS(rc)) 836 837 { … … 839 840 */ 840 841 if (FileRawMem != NIL_RTFILE) 841 rc = VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)loadMem, 3, pVM, FileRawMem, &offRawMem);842 rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)loadMem, 3, pVM, FileRawMem, &offRawMem); 842 843 else 843 rc = VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)SSMR3Load,844 7, pVM, pszSavedState, (uintptr_t)NULL /*pStreamOps*/, (uintptr_t)NULL /*pvUser*/,845 SSMAFTER_DEBUG_IT, (uintptr_t)NULL /*pfnProgress*/, (uintptr_t)NULL /*pvProgressUser*/);844 rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)SSMR3Load, 845 7, pVM, pszSavedState, (uintptr_t)NULL /*pStreamOps*/, (uintptr_t)NULL /*pvUser*/, 846 SSMAFTER_DEBUG_IT, (uintptr_t)NULL /*pfnProgress*/, (uintptr_t)NULL /*pvProgressUser*/); 846 847 if (RT_SUCCESS(rc)) 847 848 { … … 850 851 */ 851 852 if (FileScript != NIL_RTFILE) 852 rc = VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)scriptRun, 2, pVM, FileScript);853 rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)scriptRun, 2, pVM, FileScript); 853 854 if (RT_SUCCESS(rc)) 854 855 { … … 882 883 DBGFR3Info(pVM, "cpumguest", "verbose", NULL); 883 884 if (fPowerOn) 884 rc = VMR3PowerOn(p VM);885 rc = VMR3PowerOn(pUVM); 885 886 if (RT_SUCCESS(rc)) 886 887 { … … 918 919 * Cleanup. 919 920 */ 920 rc = VMR3Destroy(p VM);921 rc = VMR3Destroy(pUVM); 921 922 if (!RT_SUCCESS(rc)) 922 923 { … … 924 925 rcRet++; 925 926 } 927 928 VMR3ReleaseUVM(pUVM); 926 929 } 927 930 else -
trunk/src/VBox/VMM/testcase/tstMicro.cpp
r41965 r44340 347 347 */ 348 348 PVM pVM; 349 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 349 PUVM pUVM; 350 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM, &pUVM); 350 351 if (RT_SUCCESS(rc)) 351 352 { … … 353 354 * Do testing. 354 355 */ 355 rc = VMR3ReqCallVoidWait (pVM, VMCPUID_ANY, (PFNRT)doit, 1, pVM);356 rc = VMR3ReqCallVoidWaitU(pUVM, VMCPUID_ANY, (PFNRT)doit, 1, pVM); 356 357 AssertRC(rc); 357 358 STAMR3Dump(pVM, "*"); … … 360 361 * Cleanup. 361 362 */ 362 rc = VMR3PowerOff(p VM);363 rc = VMR3PowerOff(pUVM); 363 364 if (!RT_SUCCESS(rc)) 364 365 { … … 366 367 rcRet++; 367 368 } 368 rc = VMR3Destroy(p VM);369 rc = VMR3Destroy(pUVM); 369 370 if (!RT_SUCCESS(rc)) 370 371 { … … 372 373 rcRet++; 373 374 } 375 VMR3ReleaseUVM(pUVM); 374 376 } 375 377 else -
trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletion.cpp
r39084 r44340 87 87 88 88 PVM pVM; 89 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 89 PUVM pUVM; 90 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM, &pUVM); 90 91 if (RT_SUCCESS(rc)) 91 92 { 92 PPDMASYNCCOMPLETIONTEMPLATE pTemplate;93 94 93 /* 95 94 * Little hack to avoid the VM_ASSERT_EMT assertion. … … 102 101 * Create the template. 103 102 */ 103 PPDMASYNCCOMPLETIONTEMPLATE pTemplate; 104 104 rc = PDMR3AsyncCompletionTemplateCreateInternal(pVM, &pTemplate, pfnAsyncTaskCompleted, NULL, "Test"); 105 105 if (RT_FAILURE(rc)) … … 236 236 } 237 237 238 rc = VMR3Destroy(p VM);238 rc = VMR3Destroy(pUVM); 239 239 AssertMsg(rc == VINF_SUCCESS, ("%s: Destroying VM failed rc=%Rrc!!\n", __FUNCTION__, rc)); 240 VMR3ReleaseUVM(pUVM); 240 241 241 242 /* -
trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletionStress.cpp
r39084 r44340 575 575 576 576 PVM pVM; 577 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 577 PUVM pUVM; 578 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM, &pUVM); 578 579 if (RT_SUCCESS(rc)) 579 580 { … … 617 618 } 618 619 619 rc = VMR3Destroy(p VM);620 rc = VMR3Destroy(pUVM); 620 621 AssertMsg(rc == VINF_SUCCESS, ("%s: Destroying VM failed rc=%Rrc!!\n", __FUNCTION__, rc)); 621 622 } -
trunk/src/VBox/VMM/testcase/tstVMM-HM.cpp
r43391 r44340 84 84 RTPrintf(TESTCASE ": Initializing...\n"); 85 85 PVM pVM; 86 int rc = VMR3Create(1, NULL, NULL, NULL, CFGMConstructor, NULL, &pVM); 86 PUVM pUVM; 87 int rc = VMR3Create(1, NULL, NULL, NULL, CFGMConstructor, NULL, &pVM, &pUVM); 87 88 if (RT_SUCCESS(rc)) 88 89 { … … 91 92 */ 92 93 RTPrintf(TESTCASE ": Testing...\n"); 93 rc = VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)VMMDoHmTest, 1, pVM);94 rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)VMMDoHmTest, 1, pVM); 94 95 AssertRC(rc); 95 96 … … 99 100 * Cleanup. 100 101 */ 101 rc = VMR3Destroy(p VM);102 rc = VMR3Destroy(pUVM); 102 103 if (RT_FAILURE(rc)) 103 104 { … … 105 106 rcRet++; 106 107 } 108 VMR3ReleaseUVM(pUVM); 107 109 } 108 110 else -
trunk/src/VBox/VMM/testcase/tstVMM.cpp
r41965 r44340 248 248 RTPrintf(TESTCASE ": Initializing...\n"); 249 249 PVM pVM; 250 rc = VMR3Create(g_cCpus, NULL, NULL, NULL, tstVMMConfigConstructor, NULL, &pVM); 250 PUVM pUVM; 251 rc = VMR3Create(g_cCpus, NULL, NULL, NULL, tstVMMConfigConstructor, NULL, &pVM, &pUVM); 251 252 if (RT_SUCCESS(rc)) 252 253 { … … 263 264 { 264 265 RTTestSub(hTest, "VMM"); 265 rc = VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)VMMDoTest, 1, pVM);266 rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)VMMDoTest, 1, pVM); 266 267 if (RT_FAILURE(rc)) 267 268 RTTestFailed(hTest, "VMMDoTest failed: rc=%Rrc\n", rc); … … 274 275 for (VMCPUID idCpu = 1; idCpu < g_cCpus; idCpu++) 275 276 { 276 rc = VMR3ReqCallNoWait (pVM, idCpu, (PFNRT)tstTMWorker, 2, pVM, hTest);277 rc = VMR3ReqCallNoWaitU(pUVM, idCpu, (PFNRT)tstTMWorker, 2, pVM, hTest); 277 278 if (RT_FAILURE(rc)) 278 279 RTTestFailed(hTest, "VMR3ReqCall failed: rc=%Rrc\n", rc); 279 280 } 280 281 281 rc = VMR3ReqCallWait (pVM, 0 /*idDstCpu*/, (PFNRT)tstTMWorker, 2, pVM, hTest);282 rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)tstTMWorker, 2, pVM, hTest); 282 283 if (RT_FAILURE(rc)) 283 284 RTTestFailed(hTest, "VMMDoTest failed: rc=%Rrc\n", rc); … … 291 292 * Cleanup. 292 293 */ 293 rc = VMR3PowerOff(p VM);294 rc = VMR3PowerOff(pUVM); 294 295 if (RT_FAILURE(rc)) 295 296 RTTestFailed(hTest, "VMR3PowerOff failed: rc=%Rrc\n", rc); 296 rc = VMR3Destroy(p VM);297 rc = VMR3Destroy(pUVM); 297 298 if (RT_FAILURE(rc)) 298 299 RTTestFailed(hTest, "VMR3Destroy failed: rc=%Rrc\n", rc); 300 VMR3ReleaseUVM(pUVM); 299 301 } 300 302 else -
trunk/src/VBox/VMM/testcase/tstVMMFork.cpp
r41965 r44340 67 67 RTPrintf(TESTCASE ": Initializing...\n"); 68 68 PVM pVM; 69 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 69 PUVM pUVM; 70 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM, &pUVM); 70 71 if (RT_SUCCESS(rc)) 71 72 { … … 132 133 RTPrintf(TESTCASE ": fork() returned fine.\n"); 133 134 RTPrintf(TESTCASE ": testing VM after fork.\n"); 134 VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)VMMDoTest, 1, pVM);135 VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)VMMDoTest, 1, pVM); 135 136 136 137 STAMR3Dump(pVM, "*"); … … 146 147 * Cleanup. 147 148 */ 148 rc = VMR3PowerOff(p VM);149 rc = VMR3PowerOff(pUVM); 149 150 if (!RT_SUCCESS(rc)) 150 151 { … … 152 153 rcErrors++; 153 154 } 154 rc = VMR3Destroy(p VM);155 rc = VMR3Destroy(pUVM); 155 156 if (!RT_SUCCESS(rc)) 156 157 { … … 158 159 rcErrors++; 159 160 } 161 VMR3ReleaseUVM(pUVM); 160 162 } 161 163 else -
trunk/src/VBox/VMM/testcase/tstVMREQ.cpp
r44230 r44340 86 86 * The function PassVA and PassVA2 calls. 87 87 */ 88 static DECLCALLBACK(int) PassVACallback(P VM pVM, unsigned u4K, unsigned u1G, const char *pszFormat, va_list *pva)89 { 90 NOREF(p VM);88 static DECLCALLBACK(int) PassVACallback(PUVM pUVM, unsigned u4K, unsigned u1G, const char *pszFormat, va_list *pva) 89 { 90 NOREF(pUVM); 91 91 if (u4K != _4K) 92 92 { … … 122 122 * similar to VMSetRuntimeError. 123 123 */ 124 static void PassVA2(P VM pVM, const char *pszFormat, va_list va)124 static void PassVA2(PUVM pUVM, const char *pszFormat, va_list va) 125 125 { 126 126 #if 0 /** @todo test if this is a GCC problem only or also happens with AMD64+VCC80... */ … … 132 132 #endif 133 133 134 int rc = VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)PassVACallback, 5, pVM, _4K, _1G, pszFormat, pvVA);134 int rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)PassVACallback, 5, pUVM, _4K, _1G, pszFormat, pvVA); 135 135 NOREF(rc); 136 136 … … 145 145 * similar to VMSetRuntimeError. 146 146 */ 147 static void PassVA(P VM pVM, const char *pszFormat, ...)147 static void PassVA(PUVM pUVM, const char *pszFormat, ...) 148 148 { 149 149 /* 1st test */ 150 150 va_list va1; 151 151 va_start(va1, pszFormat); 152 int rc = VMR3ReqCallWait (pVM, VMCPUID_ANY, (PFNRT)PassVACallback, 5, pVM, _4K, _1G, pszFormat, &va1);152 int rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)PassVACallback, 5, pUVM, _4K, _1G, pszFormat, &va1); 153 153 va_end(va1); 154 154 NOREF(rc); … … 157 157 va_list va2; 158 158 va_start(va2, pszFormat); 159 PassVA2(p VM, pszFormat, va2);159 PassVA2(pUVM, pszFormat, va2); 160 160 va_end(va2); 161 161 } … … 168 168 { 169 169 int rc = VINF_SUCCESS; 170 P VM pVM = (PVM)pvUser;170 PUVM pUVM = (PUVM)pvUser; 171 171 NOREF(hThreadSelf); 172 172 … … 178 178 for (iReq = 0; iReq < cReqs; iReq++) 179 179 { 180 rc = VMR3ReqAlloc(p VM, &apReq[iReq], VMREQTYPE_INTERNAL, VMCPUID_ANY);180 rc = VMR3ReqAlloc(pUVM, &apReq[iReq], VMREQTYPE_INTERNAL, VMCPUID_ANY); 181 181 if (RT_FAILURE(rc)) 182 182 { … … 219 219 * Create empty VM. 220 220 */ 221 P VM pVM;222 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM);221 PUVM pUVM; 222 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, NULL, &pUVM); 223 223 if (RT_SUCCESS(rc)) 224 224 { … … 228 228 uint64_t u64StartTS = RTTimeNanoTS(); 229 229 RTTHREAD Thread0; 230 rc = RTThreadCreate(&Thread0, Thread, p VM, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "REQ1");230 rc = RTThreadCreate(&Thread0, Thread, pUVM, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "REQ1"); 231 231 if (RT_SUCCESS(rc)) 232 232 { 233 233 RTTHREAD Thread1; 234 rc = RTThreadCreate(&Thread1, Thread, p VM, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "REQ1");234 rc = RTThreadCreate(&Thread1, Thread, pUVM, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "REQ1"); 235 235 if (RT_SUCCESS(rc)) 236 236 { … … 273 273 * Print stats. 274 274 */ 275 STAMR3Print( pVM, "/VM/Req/*");275 STAMR3Print(VMR3GetVM(pUVM), "/VM/Req/*"); 276 276 277 277 /* … … 279 279 */ 280 280 RTPrintf(TESTCASE ": va_list argument test...\n"); RTStrmFlush(g_pStdOut); 281 PassVA(p VM, "hello %s", "world");282 VMR3AtRuntimeErrorRegister(p VM, MyAtRuntimeError, (void *)"user argument");283 VMSetRuntimeError( pVM, 0 /*fFlags*/, "enum", "some %s string", "error");281 PassVA(pUVM, "hello %s", "world"); 282 VMR3AtRuntimeErrorRegister(pUVM, MyAtRuntimeError, (void *)"user argument"); 283 VMSetRuntimeError(VMR3GetVM(pUVM), 0 /*fFlags*/, "enum", "some %s string", "error"); 284 284 285 285 /* 286 286 * Cleanup. 287 287 */ 288 rc = VMR3PowerOff(p VM);288 rc = VMR3PowerOff(pUVM); 289 289 if (!RT_SUCCESS(rc)) 290 290 { … … 292 292 g_cErrors++; 293 293 } 294 rc = VMR3Destroy(p VM);294 rc = VMR3Destroy(pUVM); 295 295 if (!RT_SUCCESS(rc)) 296 296 { … … 298 298 g_cErrors++; 299 299 } 300 VMR3ReleaseUVM(pUVM); 300 301 } 301 302 else -
trunk/src/recompiler/VBoxREMWrapper.cpp
r43387 r44340 1310 1310 { "TRPMSetFaultAddress", VMM_FN(TRPMSetFaultAddress), &g_aArgsTRPMSetFaultAddress[0], RT_ELEMENTS(g_aArgsTRPMSetFaultAddress), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1311 1311 { "VMMGetCpu", VMM_FN(VMMGetCpu), &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(PVMCPU), NULL }, 1312 { "VMR3ReqCallWait", VMM_FN(VMR3ReqCallWait), &g_aArgsVMR3ReqCallWait[0], RT_ELEMENTS(g_aArgsVMR3ReqCallWait), REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(int), NULL },1313 1312 { "VMR3ReqPriorityCallWait", VMM_FN(VMR3ReqPriorityCallWait), &g_aArgsVMR3ReqCallWait[0], RT_ELEMENTS(g_aArgsVMR3ReqCallWait), REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(int), NULL }, 1314 1313 { "VMR3ReqFree", VMM_FN(VMR3ReqFree), &g_aArgsVMR3ReqFree[0], RT_ELEMENTS(g_aArgsVMR3ReqFree), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1315 { "VMR3GetVMCPUId", VMM_FN(VMR3GetVMCPUId), &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },1316 { "VMR3GetVMCPUNativeThread", VMM_FN(VMR3GetVMCPUNativeThread), &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },1317 1314 // { "", VMM_FN(), &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1318 1315 };
Note:
See TracChangeset
for help on using the changeset viewer.