Changeset 32190 in vbox for trunk/src/VBox
- Timestamp:
- Sep 2, 2010 12:20:06 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/testcase/tstVBoxDbg.cpp
r31530 r32190 46 46 */ 47 47 PVM pVM; 48 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM);48 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 49 49 if (RT_SUCCESS(rc)) 50 50 { -
trunk/src/VBox/Devices/PC/DevACPI.cpp
r32189 r32190 1064 1064 { 1065 1065 rc = PDMDevHlpVMSuspendSaveAndPowerOff(pThis->pDevIns); 1066 AssertRC(rc); 1066 if (rc != VERR_NOT_SUPPORTED) 1067 AssertRC(rc); 1068 else 1069 { 1070 LogRel(("ACPI: PDMDevHlpVMSuspendSaveAndPowerOff is not supported, falling back to suspend-only\n")); 1071 rc = PDMDevHlpVMSuspend(pThis->pDevIns); 1072 AssertRC(rc); 1073 } 1067 1074 } 1068 1075 else -
trunk/src/VBox/Main/ConsoleImpl.cpp
r32169 r32190 7362 7362 alock.leave(); 7363 7363 7364 vrc = VMR3Create(cCpus, Console::genericVMSetErrorCallback, &task->mErrorMsg, 7364 vrc = VMR3Create(cCpus, NULL, 7365 Console::genericVMSetErrorCallback, &task->mErrorMsg, 7365 7366 task->mConfigConstructor, static_cast<Console *>(console), 7366 7367 &pVM); -
trunk/src/VBox/VMM/PDMDevHlp.cpp
r32189 r32190 28 28 #include <VBox/rem.h> 29 29 #include <VBox/dbgf.h> 30 #include <VBox/vmapi.h> 30 31 #include <VBox/vm.h> 32 #include <VBox/uvm.h> 31 33 #include <VBox/vmm.h> 32 34 … … 2814 2816 pDevIns->pReg->szName, pDevIns->iInstance)); 2815 2817 2818 /** @todo Always take the SMP path - fewer code paths. */ 2816 2819 if (pVM->cCpus > 1) 2817 2820 { … … 2829 2832 2830 2833 2834 /** 2835 * Worker for pdmR3DevHlp_VMSuspendSaveAndPowerOff that is invoked via a queued 2836 * EMT request to avoid deadlocks. 2837 * 2838 * @returns VBox status code fit for scheduling. 2839 * @param pVM The VM handle. 2840 * @param pDevIns The device that triggered this action. 2841 */ 2842 static DECLCALLBACK(int) pdmR3DevHlp_VMSuspendSaveAndPowerOffWorker(PVM pVM, PPDMDEVINS pDevIns) 2843 { 2844 /* 2845 * Suspend the VM first then do the saving. 2846 */ 2847 int rc = VMR3Suspend(pVM); 2848 if (RT_SUCCESS(rc)) 2849 { 2850 rc = pVM->pUVM->pVmm2UserMethods->pfnSaveState(pVM->pUVM->pVmm2UserMethods, pVM); 2851 2852 /* 2853 * On success, power off the VM, on failure we'll leave it suspended. 2854 */ 2855 if (RT_SUCCESS(rc)) 2856 { 2857 rc = VMR3PowerOff(pVM); 2858 if (RT_FAILURE(rc)) 2859 LogRel(("%s/SSP: VMR3PowerOff failed: %Rrc\n", pDevIns->pReg->szName, rc)); 2860 } 2861 else 2862 LogRel(("%s/SSP: pfnSaveState failed: %Rrc\n", pDevIns->pReg->szName, rc)); 2863 } 2864 else 2865 LogRel(("%s/SSP: Suspend failed: %Rrc\n", pDevIns->pReg->szName, rc)); 2866 return rc; 2867 } 2868 2869 2831 2870 /** @interface_method_impl{PDMDEVHLPR3,pfnVMSuspendSaveAndPowerOff} */ 2832 2871 static DECLCALLBACK(int) pdmR3DevHlp_VMSuspendSaveAndPowerOff(PPDMDEVINS pDevIns) 2833 2872 { 2834 int rc;2835 2873 PDMDEV_ASSERT_DEVINS(pDevIns); 2836 2874 PVM pVM = pDevIns->Internal.s.pVMR3; … … 2839 2877 pDevIns->pReg->szName, pDevIns->iInstance)); 2840 2878 2841 /** @todo We'll have to queue a request to avoid deadlock issues. */ 2842 rc = VERR_NOT_IMPLEMENTED; 2879 int rc; 2880 if ( pVM->pUVM->pVmm2UserMethods 2881 && pVM->pUVM->pVmm2UserMethods->pfnSaveState) 2882 { 2883 rc = VMR3ReqCallNoWaitU(pVM->pUVM, VMCPUID_ANY_QUEUE, (PFNRT)pdmR3DevHlp_VMSuspendSaveAndPowerOffWorker, 2, pVM, pDevIns); 2884 if (RT_SUCCESS(rc)) 2885 { 2886 LogRel(("%s: Suspending, Saving and Powering Off the VM\n", pDevIns->pReg->szName)); 2887 rc = VINF_EM_SUSPEND; 2888 } 2889 } 2890 else 2891 rc = VERR_NOT_SUPPORTED; 2843 2892 2844 2893 LogFlow(("pdmR3DevHlp_VMSuspendSaveAndPowerOff: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); … … 2857 2906 pDevIns->pReg->szName, pDevIns->iInstance)); 2858 2907 2908 /** @todo Always take the SMP path - fewer code paths. */ 2859 2909 if (pVM->cCpus > 1) 2860 2910 { -
trunk/src/VBox/VMM/VM.cpp
r32171 r32190 119 119 * Internal Functions * 120 120 *******************************************************************************/ 121 static int vmR3CreateUVM(uint32_t cCpus, PUVM *ppUVM);122 static int vmR3CreateU(PUVM pUVM, uint32_t cCpus, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM);123 static int vmR3InitRing3(PVM pVM, PUVM pUVM);124 static int vmR3InitVMCpu(PVM pVM);125 static int vmR3InitRing0(PVM pVM);126 static int vmR3InitGC(PVM pVM);127 static int vmR3InitDoCompleted(PVM pVM, VMINITCOMPLETED enmWhat);121 static int vmR3CreateUVM(uint32_t cCpus, PCVMM2USERMETHODS pVmm2UserMethods, PUVM *ppUVM); 122 static int vmR3CreateU(PUVM pUVM, uint32_t cCpus, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM); 123 static int vmR3InitRing3(PVM pVM, PUVM pUVM); 124 static int vmR3InitVMCpu(PVM pVM); 125 static int vmR3InitRing0(PVM pVM); 126 static int vmR3InitGC(PVM pVM); 127 static int vmR3InitDoCompleted(PVM pVM, VMINITCOMPLETED enmWhat); 128 128 static DECLCALLBACK(size_t) vmR3LogPrefixCallback(PRTLOGGER pLogger, char *pchBuf, size_t cchBuf, void *pvUser); 129 static void vmR3DestroyUVM(PUVM pUVM, uint32_t cMilliesEMTWait);130 static void vmR3AtDtor(PVM pVM);131 static bool vmR3ValidateStateTransition(VMSTATE enmStateOld, VMSTATE enmStateNew);132 static void vmR3DoAtState(PVM pVM, PUVM pUVM, VMSTATE enmStateNew, VMSTATE enmStateOld);133 static int vmR3TrySetState(PVM pVM, const char *pszWho, unsigned cTransitions, ...);134 static void vmR3SetStateLocked(PVM pVM, PUVM pUVM, VMSTATE enmStateNew, VMSTATE enmStateOld);135 static void vmR3SetState(PVM pVM, VMSTATE enmStateNew, VMSTATE enmStateOld);136 static int vmR3SetErrorU(PUVM pUVM, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...);129 static void vmR3DestroyUVM(PUVM pUVM, uint32_t cMilliesEMTWait); 130 static void vmR3AtDtor(PVM pVM); 131 static bool vmR3ValidateStateTransition(VMSTATE enmStateOld, VMSTATE enmStateNew); 132 static void vmR3DoAtState(PVM pVM, PUVM pUVM, VMSTATE enmStateNew, VMSTATE enmStateOld); 133 static int vmR3TrySetState(PVM pVM, const char *pszWho, unsigned cTransitions, ...); 134 static void vmR3SetStateLocked(PVM pVM, PUVM pUVM, VMSTATE enmStateNew, VMSTATE enmStateOld); 135 static void vmR3SetState(PVM pVM, VMSTATE enmStateNew, VMSTATE enmStateOld); 136 static int vmR3SetErrorU(PUVM pUVM, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...); 137 137 138 138 … … 169 169 * @returns VBox error code on failure. 170 170 * @param cCpus Number of virtual CPUs for the new VM. 171 * @param pVmm2UserMethods An optional method table that the VMM can use to 172 * make the user perform various action, like for 173 * instance state saving. 171 174 * @param pfnVMAtError Pointer to callback function for setting VM 172 175 * errors. This was added as an implicit call to … … 181 184 * @param ppVM Where to store the 'handle' of the created VM. 182 185 */ 183 VMMR3DECL(int) VMR3Create(uint32_t cCpus, PFNVMATERROR pfnVMAtError, void *pvUserVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, PVM *ppVM) 184 { 185 LogFlow(("VMR3Create: cCpus=%RU32 pfnVMAtError=%p pvUserVM=%p pfnCFGMConstructor=%p pvUserCFGM=%p ppVM=%p\n", 186 cCpus, pfnVMAtError, pvUserVM, pfnCFGMConstructor, pvUserCFGM, ppVM)); 186 VMMR3DECL(int) VMR3Create(uint32_t cCpus, PCVMM2USERMETHODS pVmm2UserMethods, 187 PFNVMATERROR pfnVMAtError, void *pvUserVM, 188 PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, 189 PVM *ppVM) 190 { 191 LogFlow(("VMR3Create: cCpus=%RU32 pVmm2UserMethods=%p pfnVMAtError=%p pvUserVM=%p pfnCFGMConstructor=%p pvUserCFGM=%p ppVM=%p\n", 192 cCpus, pVmm2UserMethods, pfnVMAtError, pvUserVM, pfnCFGMConstructor, pvUserCFGM, ppVM)); 193 194 if (pVmm2UserMethods) 195 { 196 AssertPtrReturn(pVmm2UserMethods, VERR_INVALID_POINTER); 197 AssertReturn(pVmm2UserMethods->u32Magic == VMM2USERMETHODS_MAGIC, VERR_INVALID_PARAMETER); 198 AssertReturn(pVmm2UserMethods->u32Version == VMM2USERMETHODS_VERSION, VERR_INVALID_PARAMETER); 199 AssertPtrReturn(pVmm2UserMethods->pfnSaveState, VERR_INVALID_POINTER); 200 AssertReturn(pVmm2UserMethods->u32EndMagic == VMM2USERMETHODS_MAGIC, VERR_INVALID_PARAMETER); 201 } 202 AssertPtrNullReturn(pfnVMAtError, VERR_INVALID_POINTER); 203 AssertPtrNullReturn(pfnCFGMConstructor, VERR_INVALID_POINTER); 204 AssertPtrReturn(ppVM, VERR_INVALID_POINTER); 187 205 188 206 /* … … 210 228 */ 211 229 PUVM pUVM = NULL; /* shuts up gcc */ 212 int rc = vmR3CreateUVM(cCpus, &pUVM);230 int rc = vmR3CreateUVM(cCpus, pVmm2UserMethods, &pUVM); 213 231 if (RT_FAILURE(rc)) 214 232 return rc; … … 417 435 * 418 436 * @returns VBox status code. 419 * @param cCpus Number of virtual CPUs 420 * @param ppUVM Where to store the UVM pointer. 421 */ 422 static int vmR3CreateUVM(uint32_t cCpus, PUVM *ppUVM) 437 * @param cCpus Number of virtual CPUs 438 * @param pVmm2UserMethods Pointer to the optional VMM -> User method 439 * table. 440 * @param ppUVM Where to store the UVM pointer. 441 */ 442 static int vmR3CreateUVM(uint32_t cCpus, PCVMM2USERMETHODS pVmm2UserMethods, PUVM *ppUVM) 423 443 { 424 444 uint32_t i; … … 429 449 PUVM pUVM = (PUVM)RTMemPageAllocZ(RT_OFFSETOF(UVM, aCpus[cCpus])); 430 450 AssertReturn(pUVM, VERR_NO_MEMORY); 431 pUVM->u32Magic = UVM_MAGIC; 432 pUVM->cCpus = cCpus; 451 pUVM->u32Magic = UVM_MAGIC; 452 pUVM->cCpus = cCpus; 453 pUVM->pVmm2UserMethods = pVmm2UserMethods; 433 454 434 455 AssertCompile(sizeof(pUVM->vm.s) <= sizeof(pUVM->vm.padding)); -
trunk/src/VBox/VMM/testcase/tstAnimate.cpp
r28800 r32190 824 824 */ 825 825 PVM pVM; 826 rc = VMR3Create(1, NULL, NULL, cfgmR3CreateDefault, &cbMem, &pVM);826 rc = VMR3Create(1, NULL, NULL, NULL, cfgmR3CreateDefault, &cbMem, &pVM); 827 827 if (RT_SUCCESS(rc)) 828 828 { -
trunk/src/VBox/VMM/testcase/tstMicro.cpp
r31989 r32190 345 345 */ 346 346 PVM pVM; 347 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM);347 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 348 348 if (RT_SUCCESS(rc)) 349 349 { -
trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletion.cpp
r28800 r32190 87 87 88 88 PVM pVM; 89 rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM);89 rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 90 90 if (RT_SUCCESS(rc)) 91 91 { -
trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletionStress.cpp
r28800 r32190 575 575 576 576 PVM pVM; 577 rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM);577 rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 578 578 if (RT_SUCCESS(rc)) 579 579 { -
trunk/src/VBox/VMM/testcase/tstVMM-HwAccm.cpp
r28800 r32190 82 82 RTPrintf(TESTCASE ": Initializing...\n"); 83 83 PVM pVM; 84 int rc = VMR3Create(1, NULL, NULL, CFGMConstructor, NULL, &pVM);84 int rc = VMR3Create(1, NULL, NULL, NULL, CFGMConstructor, NULL, &pVM); 85 85 if (RT_SUCCESS(rc)) 86 86 { -
trunk/src/VBox/VMM/testcase/tstVMM.cpp
r28800 r32190 250 250 RTPrintf(TESTCASE ": Initializing...\n"); 251 251 PVM pVM; 252 rc = VMR3Create(g_cCpus, NULL, NULL, tstVMMConfigConstructor, NULL, &pVM);252 rc = VMR3Create(g_cCpus, NULL, NULL, NULL, tstVMMConfigConstructor, NULL, &pVM); 253 253 if (RT_SUCCESS(rc)) 254 254 { -
trunk/src/VBox/VMM/testcase/tstVMMFork.cpp
r28800 r32190 67 67 RTPrintf(TESTCASE ": Initializing...\n"); 68 68 PVM pVM; 69 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM);69 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 70 70 if (RT_SUCCESS(rc)) 71 71 { -
trunk/src/VBox/VMM/testcase/tstVMREQ.cpp
r28800 r32190 215 215 */ 216 216 PVM pVM; 217 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM);217 int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM); 218 218 if (RT_SUCCESS(rc)) 219 219 {
Note:
See TracChangeset
for help on using the changeset viewer.