Changeset 93444 in vbox
- Timestamp:
- Jan 26, 2022 6:01:15 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 58 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/Makefile.kmk
r93115 r93444 47 47 VBox/settings.h \ 48 48 VBox/com/Guid.h \ 49 VBox/vmm/vmmapi.h \ 49 50 iprt/cpp/% \ 50 51 VBox/com/% \ -
trunk/include/VBox/hgcmsvc.h
r93115 r93444 84 84 * acMaxClients and acMaxCallsPerClient added (VBox 6.1.26). 85 85 * 9.1->10.1 Because pfnDisconnectClient was added back (VBox 6.1.28). 86 * 10.1->11.1 Because pVMM added to pfnSaveState & pfnLoadState (VBox 7.0). 86 87 */ 87 #define VBOX_HGCM_SVC_VERSION_MAJOR (0x000 a)88 #define VBOX_HGCM_SVC_VERSION_MAJOR (0x000b) 88 89 #define VBOX_HGCM_SVC_VERSION_MINOR (0x0001) 89 90 #define VBOX_HGCM_SVC_VERSION ((VBOX_HGCM_SVC_VERSION_MAJOR << 16) + VBOX_HGCM_SVC_VERSION_MINOR) … … 478 479 #endif 479 480 480 #ifdef IN_RING3 481 #if defined(IN_RING3) && defined(VBOX_INCLUDED_vmm_vmmr3vtable_h) 482 481 483 /** 482 484 * Puts (serializes) a VBOXHGCMSVCPARM struct into SSM. 483 485 * 484 486 * @returns VBox status code. 485 * @param pParm VBOXHGCMSVCPARM to serialize. 486 * @param pSSM SSM handle to serialize to. 487 * @param pParm VBOXHGCMSVCPARM to serialize. 488 * @param pSSM SSM handle to serialize to. 489 * @param pVMM The VMM vtable. 487 490 */ 488 DECLINLINE(int) HGCMSvcSSMR3Put(VBOXHGCMSVCPARM *pParm, PSSMHANDLE pSSM )491 DECLINLINE(int) HGCMSvcSSMR3Put(VBOXHGCMSVCPARM *pParm, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM) 489 492 { 490 493 int rc; … … 493 496 AssertPtrReturn(pSSM, VERR_INVALID_POINTER); 494 497 495 rc = SSMR3PutU32(pSSM, sizeof(VBOXHGCMSVCPARM));498 rc = pVMM->pfnSSMR3PutU32(pSSM, sizeof(VBOXHGCMSVCPARM)); 496 499 AssertRCReturn(rc, rc); 497 rc = SSMR3PutU32(pSSM, pParm->type);500 rc = pVMM->pfnSSMR3PutU32(pSSM, pParm->type); 498 501 AssertRCReturn(rc, rc); 499 502 … … 501 504 { 502 505 case VBOX_HGCM_SVC_PARM_32BIT: 503 rc = SSMR3PutU32(pSSM, pParm->u.uint32);506 rc = pVMM->pfnSSMR3PutU32(pSSM, pParm->u.uint32); 504 507 break; 505 508 case VBOX_HGCM_SVC_PARM_64BIT: 506 rc = SSMR3PutU64(pSSM, pParm->u.uint64);509 rc = pVMM->pfnSSMR3PutU64(pSSM, pParm->u.uint64); 507 510 break; 508 511 case VBOX_HGCM_SVC_PARM_PTR: 509 rc = SSMR3PutU32(pSSM, pParm->u.pointer.size);512 rc = pVMM->pfnSSMR3PutU32(pSSM, pParm->u.pointer.size); 510 513 if (RT_SUCCESS(rc)) 511 rc = SSMR3PutMem(pSSM, pParm->u.pointer.addr, pParm->u.pointer.size);514 rc = pVMM->pfnSSMR3PutMem(pSSM, pParm->u.pointer.addr, pParm->u.pointer.size); 512 515 break; 513 516 default: … … 524 527 * 525 528 * @returns VBox status code. 526 * @param pParm VBOXHGCMSVCPARM to load into. Must be initialied (zero-ed) properly. 527 * @param pSSM SSM handle to load from. 529 * @param pParm VBOXHGCMSVCPARM to load into. Must be zero'ed. 530 * @param pSSM SSM handle to load from. 531 * @param pVMM The VMM vtable. 528 532 */ 529 DECLINLINE(int) HGCMSvcSSMR3Get(VBOXHGCMSVCPARM *pParm, PSSMHANDLE pSSM )533 DECLINLINE(int) HGCMSvcSSMR3Get(VBOXHGCMSVCPARM *pParm, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM) 530 534 { 531 535 uint32_t cbParm; … … 535 539 AssertPtrReturn(pSSM, VERR_INVALID_POINTER); 536 540 537 rc = SSMR3GetU32(pSSM, &cbParm);541 rc = pVMM->pfnSSMR3GetU32(pSSM, &cbParm); 538 542 AssertRCReturn(rc, rc); 539 543 AssertReturn(cbParm == sizeof(VBOXHGCMSVCPARM), VERR_SSM_DATA_UNIT_FORMAT_CHANGED); 540 544 541 rc = SSMR3GetU32(pSSM, &pParm->type);545 rc = pVMM->pfnSSMR3GetU32(pSSM, &pParm->type); 542 546 AssertRCReturn(rc, rc); 543 547 … … 546 550 case VBOX_HGCM_SVC_PARM_32BIT: 547 551 { 548 rc = SSMR3GetU32(pSSM, &pParm->u.uint32);552 rc = pVMM->pfnSSMR3GetU32(pSSM, &pParm->u.uint32); 549 553 AssertRCReturn(rc, rc); 550 554 break; … … 553 557 case VBOX_HGCM_SVC_PARM_64BIT: 554 558 { 555 rc = SSMR3GetU64(pSSM, &pParm->u.uint64);559 rc = pVMM->pfnSSMR3GetU64(pSSM, &pParm->u.uint64); 556 560 AssertRCReturn(rc, rc); 557 561 break; … … 563 567 ("Pointer size parameter already in use (or not initialized)\n"), VERR_INVALID_PARAMETER); 564 568 565 rc = SSMR3GetU32(pSSM, &pParm->u.pointer.size);569 rc = pVMM->pfnSSMR3GetU32(pSSM, &pParm->u.pointer.size); 566 570 AssertRCReturn(rc, rc); 567 571 … … 571 575 pParm->u.pointer.addr = RTMemAlloc(pParm->u.pointer.size); 572 576 AssertPtrReturn(pParm->u.pointer.addr, VERR_NO_MEMORY); 573 rc = SSMR3GetMem(pSSM, pParm->u.pointer.addr, pParm->u.pointer.size);577 rc = pVMM->pfnSSMR3GetMem(pSSM, pParm->u.pointer.addr, pParm->u.pointer.size); 574 578 575 579 AssertRCReturn(rc, rc); … … 585 589 return VINF_SUCCESS; 586 590 } 591 587 592 #endif /* IN_RING3 */ 588 593 … … 693 698 694 699 /** Inform the service about a VM save operation. */ 695 DECLR3CALLBACKMEMBER(int, pfnSaveState, (void *pvService, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM)); 700 DECLR3CALLBACKMEMBER(int, pfnSaveState, (void *pvService, uint32_t u32ClientID, void *pvClient, 701 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM)); 696 702 697 703 /** Inform the service about a VM load operation. */ 698 DECLR3CALLBACKMEMBER(int, pfnLoadState, (void *pvService, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM,699 uint32_t uVersion));704 DECLR3CALLBACKMEMBER(int, pfnLoadState, (void *pvService, uint32_t u32ClientID, void *pvClient, 705 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion)); 700 706 701 707 /** Register a service extension callback. */ -
trunk/include/VBox/types.h
r93115 r93444 77 77 #define NIL_SUPSEMEVENTMULTI ((SUPSEMEVENTMULTI)0) 78 78 79 80 /** Pointer to a ring-3 VMM API vtable. */ 81 typedef R3PTRTYPE(const struct VMMR3VTABLE *) PCVMMR3VTABLE; 79 82 80 83 /** Pointer to a VM. */ -
trunk/include/VBox/vmm/cfgm.h
r93115 r93444 82 82 * @param pUVM The user mode VM handle. 83 83 * @param pVM The cross context VM structure. 84 * @param pVMM The VMM R3 vtable. 84 85 * @param pvUser The argument supplied to VMR3Create(). 85 86 */ 86 typedef DECLCALLBACKTYPE(int, FNCFGMCONSTRUCTOR,(PUVM pUVM, PVM pVM, void *pvUser));87 typedef DECLCALLBACKTYPE(int, FNCFGMCONSTRUCTOR,(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, void *pvUser)); 87 88 /** Pointer to a FNCFGMCONSTRUCTOR(). */ 88 89 typedef FNCFGMCONSTRUCTOR *PFNCFGMCONSTRUCTOR; -
trunk/include/VBox/vmm/dbgf.h
r93115 r93444 2278 2278 VMMR3DECL(int) DBGFR3RegCpuQueryU64( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64); 2279 2279 VMMR3DECL(int) DBGFR3RegCpuQueryU128(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint128_t *pu128); 2280 VMMR3DECL(int) DBGFR3RegCpuQueryLrd( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, long double *plrd); 2280 /*VMMR3DECL(int) DBGFR3RegCpuQueryLrd( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, long double *plrd);*/ 2281 2281 VMMR3DECL(int) DBGFR3RegCpuQueryXdtr(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64Base, uint16_t *pu16Limit); 2282 2282 #if 0 -
trunk/include/VBox/vmm/ssm.h
r93115 r93444 945 945 * @returns VBox status code. 946 946 * @param pSSM SSM operation handle. 947 * @param pVMM The VMM ring-3 vtable. 947 948 * @param pvUser User argument. 948 949 * @thread Any. 949 950 */ 950 typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEPREP,(PSSMHANDLE pSSM, void *pvUser));951 typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEPREP,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser)); 951 952 /** Pointer to a FNSSMEXTLIVEPREP() function. */ 952 953 typedef FNSSMEXTLIVEPREP *PFNSSMEXTLIVEPREP; … … 960 961 * @returns VBox status code. 961 962 * @param pSSM SSM operation handle. 963 * @param pVMM The VMM ring-3 vtable. 962 964 * @param pvUser User argument. 963 965 * @param uPass The data pass. 964 966 * @thread Any. 965 967 */ 966 typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEEXEC,(PSSMHANDLE pSSM, void *pvUser, uint32_t uPass));968 typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEEXEC,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, uint32_t uPass)); 967 969 /** Pointer to a FNSSMEXTLIVEEXEC() function. */ 968 970 typedef FNSSMEXTLIVEEXEC *PFNSSMEXTLIVEEXEC; … … 982 984 * 983 985 * @param pSSM SSM operation handle. 986 * @param pVMM The VMM ring-3 vtable. 984 987 * @param pvUser User argument. 985 988 * @param uPass The data pass. 986 989 * @thread Any. 987 990 */ 988 typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEVOTE,(PSSMHANDLE pSSM, void *pvUser, uint32_t uPass));991 typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEVOTE,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, uint32_t uPass)); 989 992 /** Pointer to a FNSSMEXTLIVEVOTE() function. */ 990 993 typedef FNSSMEXTLIVEVOTE *PFNSSMEXTLIVEVOTE; … … 995 998 * @returns VBox status code. 996 999 * @param pSSM SSM operation handle. 1000 * @param pVMM The VMM ring-3 vtable. 997 1001 * @param pvUser User argument. 998 1002 */ 999 typedef DECLCALLBACKTYPE(int, FNSSMEXTSAVEPREP,(PSSMHANDLE pSSM, void *pvUser));1003 typedef DECLCALLBACKTYPE(int, FNSSMEXTSAVEPREP,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser)); 1000 1004 /** Pointer to a FNSSMEXTSAVEPREP() function. */ 1001 1005 typedef FNSSMEXTSAVEPREP *PFNSSMEXTSAVEPREP; … … 1004 1008 * Execute state save operation. 1005 1009 * 1006 * @param pSSM SSM operation handle. 1010 * @returns VBox status code. 1011 * @param pSSM SSM operation handle. 1012 * @param pVMM The VMM ring-3 vtable. 1007 1013 * @param pvUser User argument. 1008 * @author The lack of return code is for legacy reasons. 1009 */ 1010 typedef DECLCALLBACKTYPE(void, FNSSMEXTSAVEEXEC,(PSSMHANDLE pSSM, void *pvUser)); 1014 */ 1015 typedef DECLCALLBACKTYPE(int, FNSSMEXTSAVEEXEC,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser)); 1011 1016 /** Pointer to a FNSSMEXTSAVEEXEC() function. */ 1012 1017 typedef FNSSMEXTSAVEEXEC *PFNSSMEXTSAVEEXEC; … … 1017 1022 * @returns VBox status code. 1018 1023 * @param pSSM SSM operation handle. 1024 * @param pVMM The VMM ring-3 vtable. 1019 1025 * @param pvUser User argument. 1020 1026 */ 1021 typedef DECLCALLBACKTYPE(int, FNSSMEXTSAVEDONE,(PSSMHANDLE pSSM, void *pvUser));1027 typedef DECLCALLBACKTYPE(int, FNSSMEXTSAVEDONE,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser)); 1022 1028 /** Pointer to a FNSSMEXTSAVEDONE() function. */ 1023 1029 typedef FNSSMEXTSAVEDONE *PFNSSMEXTSAVEDONE; … … 1028 1034 * @returns VBox status code. 1029 1035 * @param pSSM SSM operation handle. 1036 * @param pVMM The VMM ring-3 vtable. 1030 1037 * @param pvUser User argument. 1031 1038 */ 1032 typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADPREP,(PSSMHANDLE pSSM, void *pvUser));1039 typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADPREP,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser)); 1033 1040 /** Pointer to a FNSSMEXTLOADPREP() function. */ 1034 1041 typedef FNSSMEXTLOADPREP *PFNSSMEXTLOADPREP; … … 1039 1046 * @returns VBox status code. 1040 1047 * @param pSSM SSM operation handle. 1048 * @param pVMM The VMM ring-3 vtable. 1041 1049 * @param pvUser User argument. 1042 1050 * @param uVersion Data layout version. … … 1045 1053 * @remark The odd return value is for legacy reasons. 1046 1054 */ 1047 typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADEXEC,(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass)); 1055 typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADEXEC,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, 1056 uint32_t uVersion, uint32_t uPass)); 1048 1057 /** Pointer to a FNSSMEXTLOADEXEC() function. */ 1049 1058 typedef FNSSMEXTLOADEXEC *PFNSSMEXTLOADEXEC; … … 1054 1063 * @returns VBox load code. 1055 1064 * @param pSSM SSM operation handle. 1065 * @param pVMM The VMM ring-3 vtable. 1056 1066 * @param pvUser User argument. 1057 1067 */ 1058 typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADDONE,(PSSMHANDLE pSSM, void *pvUser));1068 typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADDONE,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser)); 1059 1069 /** Pointer to a FNSSMEXTLOADDONE() function. */ 1060 1070 typedef FNSSMEXTLOADDONE *PFNSSMEXTLOADDONE; … … 1191 1201 VMMR3_INT_DECL(int) SSMR3DeregisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance); 1192 1202 VMMR3DECL(int) SSMR3DeregisterInternal(PVM pVM, const char *pszName); 1193 VMMR3DECL(int) SSMR3DeregisterExternal(P VM pVM, const char *pszName);1203 VMMR3DECL(int) SSMR3DeregisterExternal(PUVM pUVM, const char *pszName); 1194 1204 VMMR3DECL(int) SSMR3Save(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser); 1195 1205 VMMR3_INT_DECL(int) SSMR3LiveSave(PVM pVM, uint32_t cMsMaxDowntime, … … 1302 1312 VMMR3DECL(int) SSMR3GetStrZ(PSSMHANDLE pSSM, char *psz, size_t cbMax); 1303 1313 VMMR3DECL(int) SSMR3GetStrZEx(PSSMHANDLE pSSM, char *psz, size_t cbMax, size_t *pcbStr); 1304 VMMR3DECL(int) SSMR3GetTimer(PSSMHANDLE pSSM, PTMTIMER pTimer);1305 1314 VMMR3DECL(int) SSMR3Skip(PSSMHANDLE pSSM, size_t cb); 1306 1315 VMMR3DECL(int) SSMR3SkipToEndOfUnit(PSSMHANDLE pSSM); -
trunk/include/VBox/vmm/vmapi.h
r93115 r93444 159 159 * 160 160 * @param pUVM The user mode VM handle. 161 * @param pVMM The VMM ring-3 vtable. 161 162 * @param enmState The new state. 162 163 * @param enmOldState The old state. 163 164 * @param pvUser The user argument. 164 165 */ 165 typedef DECLCALLBACKTYPE(void, FNVMATSTATE,(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser));166 typedef DECLCALLBACKTYPE(void, FNVMATSTATE,(PUVM pUVM, PCVMMR3VTABLE pVMM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser)); 166 167 /** Pointer to a VM state callback. */ 167 168 typedef FNVMATSTATE *PFNVMATSTATE; -
trunk/src/VBox/Debugger/VBoxDbgBase.cpp
r93115 r93444 107 107 108 108 /*static*/ DECLCALLBACK(void) 109 VBoxDbgBase::atStateChange(PUVM pUVM, VMSTATE enmState, VMSTATE /*enmOldState*/, void *pvUser)109 VBoxDbgBase::atStateChange(PUVM pUVM, PCVMMR3VTABLE /*pVMM*/, VMSTATE enmState, VMSTATE /*enmOldState*/, void *pvUser) 110 110 { 111 111 VBoxDbgBase *pThis = (VBoxDbgBase *)pvUser; NOREF(pUVM); -
trunk/src/VBox/Debugger/VBoxDbgBase.h
r93115 r93444 107 107 private: 108 108 /** @callback_method_impl{FNVMATSTATE} */ 109 static DECLCALLBACK(void) atStateChange(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);109 static DECLCALLBACK(void) atStateChange(PUVM pUVM, PCVMMR3VTABLE pVMM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser); 110 110 111 111 private: -
trunk/src/VBox/HostServices/DragAndDrop/Makefile.kmk
r93115 r93444 47 47 48 48 VBoxDragAndDropSvc_LIBS = \ 49 $(LIB_VMM) \50 49 $(LIB_RUNTIME) \ 51 $(LIB_REM) \52 50 $(PATH_STAGE_LIB)/VBoxDnDHostR3Lib$(VBOX_SUFF_LIB) 53 51 -
trunk/src/VBox/HostServices/GuestControl/Makefile.kmk
r93115 r93444 40 40 41 41 VBoxGuestControlSvc_LIBS = \ 42 $(LIB_VMM) \ 43 $(LIB_RUNTIME) \ 44 $(LIB_REM) 42 $(LIB_RUNTIME) 45 43 46 44 VBoxGuestControlSvc_LDFLAGS.darwin = \ -
trunk/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.cpp
r93115 r93444 69 69 #include <VBox/VMMDev.h> 70 70 #include <VBox/vmm/ssm.h> 71 #include <VBox/vmm/vmmr3vtable.h> 71 72 #include <iprt/assert.h> 72 73 #include <iprt/cpp/autores.h> … … 905 906 uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival); 906 907 static DECLCALLBACK(int) svcHostCall(void *pvService, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 907 static DECLCALLBACK(int) svcSaveState(void *pvService, uint32_t idClient, void *pvClient, PSSMHANDLE pSSM); 908 static DECLCALLBACK(int) svcLoadState(void *pvService, uint32_t idClient, void *pvClient, PSSMHANDLE pSSM, uint32_t uVersion); 908 static DECLCALLBACK(int) svcSaveState(void *pvService, uint32_t idClient, void *pvClient, 909 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM); 910 static DECLCALLBACK(int) svcLoadState(void *pvService, uint32_t idClient, void *pvClient, 911 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion); 909 912 static DECLCALLBACK(int) svcRegisterExtension(void *pvService, PFNHGCMSVCEXT pfnExtension, void *pvExtension); 910 913 … … 2423 2426 */ 2424 2427 /*static*/ DECLCALLBACK(int) 2425 GstCtrlService::svcSaveState(void *pvService, uint32_t idClient, void *pvClient, PSSMHANDLE pSSM )2428 GstCtrlService::svcSaveState(void *pvService, uint32_t idClient, void *pvClient, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM) 2426 2429 { 2427 2430 RT_NOREF(pvClient); … … 2434 2437 Only the root service survives, so remember who that is and its mode. */ 2435 2438 2436 SSMR3PutU32(pSSM, 1);2437 SSMR3PutBool(pSSM, pThis->m_fLegacyMode);2438 return SSMR3PutBool(pSSM, idClient == pThis->m_idMasterClient);2439 pVMM->pfnSSMR3PutU32(pSSM, 1); 2440 pVMM->pfnSSMR3PutBool(pSSM, pThis->m_fLegacyMode); 2441 return pVMM->pfnSSMR3PutBool(pSSM, idClient == pThis->m_idMasterClient); 2439 2442 } 2440 2443 … … 2444 2447 */ 2445 2448 /*static*/ DECLCALLBACK(int) 2446 GstCtrlService::svcLoadState(void *pvService, uint32_t idClient, void *pvClient, PSSMHANDLE pSSM, uint32_t uVersion) 2449 GstCtrlService::svcLoadState(void *pvService, uint32_t idClient, void *pvClient, 2450 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion) 2447 2451 { 2448 2452 SELF *pThis = reinterpret_cast<SELF *>(pvService); … … 2455 2459 { 2456 2460 uint32_t uSubVersion; 2457 int rc = SSMR3GetU32(pSSM, &uSubVersion);2461 int rc = pVMM->pfnSSMR3GetU32(pSSM, &uSubVersion); 2458 2462 AssertRCReturn(rc, rc); 2459 2463 if (uSubVersion != 1) 2460 return SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,2464 return pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 2461 2465 "sub version %u, expected 1\n", uSubVersion); 2462 2466 bool fLegacyMode; 2463 rc = SSMR3GetBool(pSSM, &fLegacyMode);2467 rc = pVMM->pfnSSMR3GetBool(pSSM, &fLegacyMode); 2464 2468 AssertRCReturn(rc, rc); 2465 2469 pThis->m_fLegacyMode = fLegacyMode; 2466 2470 2467 2471 bool fIsMaster; 2468 rc = SSMR3GetBool(pSSM, &fIsMaster);2472 rc = pVMM->pfnSSMR3GetBool(pSSM, &fIsMaster); 2469 2473 AssertRCReturn(rc, rc); 2470 2474 -
trunk/src/VBox/HostServices/GuestControl/testcase/Makefile.kmk
r93115 r93444 35 35 ../VBoxGuestControlSvc.cpp \ 36 36 tstGuestControlSvc.cpp 37 tstGuestControlSvc_LIBS = $(LIB_RUNTIME) $(LIB_VMM)37 tstGuestControlSvc_LIBS = $(LIB_RUNTIME) 38 38 39 39 $$(tstGuestControlSvc_0_OUTDIR)/tstGuestControlSvc.run: $$(tstGuestControlSvc_1_STAGE_TARGET) -
trunk/src/VBox/HostServices/GuestProperties/Makefile.kmk
r93115 r93444 40 40 41 41 VBoxGuestPropSvc_LIBS = \ 42 $(LIB_VMM) \ 43 $(LIB_RUNTIME) \ 44 $(LIB_REM) 42 $(LIB_RUNTIME) 45 43 46 44 VBoxGuestPropSvc_LDFLAGS.darwin = \ -
trunk/src/VBox/HostServices/HostChannel/Makefile.kmk
r93115 r93444 36 36 37 37 VBoxHostChannel_LIBS = \ 38 $(LIB_VMM) \39 38 $(LIB_RUNTIME) 40 39 -
trunk/src/VBox/HostServices/SharedClipboard/Makefile.kmk
r93115 r93444 73 73 74 74 VBoxSharedClipboard_LIBS = \ 75 $(LIB_VMM) \ 76 $(LIB_RUNTIME) \ 77 $(LIB_REM) 75 $(LIB_RUNTIME) 78 76 if1of ($(KBUILD_TARGET), linux solaris freebsd) 79 77 ifndef VBOX_HEADLESS -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r93316 r93444 184 184 #define LOG_GROUP LOG_GROUP_SHARED_CLIPBOARD 185 185 #include <VBox/log.h> 186 #include <VBox/vmm/vmmr3vtable.h> /* must be included before hgcmsvc.h */ 186 187 187 188 #include <VBox/GuestHost/clipboard-helper.h> … … 2457 2458 #endif /* !UNIT_TEST */ 2458 2459 2459 static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM )2460 static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM) 2460 2461 { 2461 2462 LogFlowFuncEnter(); … … 2475 2476 2476 2477 /* Write Shared Clipboard saved state version. */ 2477 SSMR3PutU32(pSSM, VBOX_SHCL_SAVED_STATE_VER_CURRENT);2478 2479 int rc = SSMR3PutStructEx(pSSM, &pClient->State, sizeof(pClient->State), 0 /*fFlags*/, &s_aShClSSMClientState[0], NULL);2478 pVMM->pfnSSMR3PutU32(pSSM, VBOX_SHCL_SAVED_STATE_VER_CURRENT); 2479 2480 int rc = pVMM->pfnSSMR3PutStructEx(pSSM, &pClient->State, sizeof(pClient->State), 0 /*fFlags*/, &s_aShClSSMClientState[0], NULL); 2480 2481 AssertRCReturn(rc, rc); 2481 2482 2482 rc = SSMR3PutStructEx(pSSM, &pClient->State.POD, sizeof(pClient->State.POD), 0 /*fFlags*/, &s_aShClSSMClientPODState[0], NULL);2483 rc = pVMM->pfnSSMR3PutStructEx(pSSM, &pClient->State.POD, sizeof(pClient->State.POD), 0 /*fFlags*/, &s_aShClSSMClientPODState[0], NULL); 2483 2484 AssertRCReturn(rc, rc); 2484 2485 2485 rc = SSMR3PutStructEx(pSSM, &pClient->State.Transfers, sizeof(pClient->State.Transfers), 0 /*fFlags*/, &s_aShClSSMClientTransferState[0], NULL);2486 rc = pVMM->pfnSSMR3PutStructEx(pSSM, &pClient->State.Transfers, sizeof(pClient->State.Transfers), 0 /*fFlags*/, &s_aShClSSMClientTransferState[0], NULL); 2486 2487 AssertRCReturn(rc, rc); 2487 2488 2488 2489 /* Serialize the client's internal message queue. */ 2489 rc = SSMR3PutU64(pSSM, pClient->cMsgAllocated);2490 rc = pVMM->pfnSSMR3PutU64(pSSM, pClient->cMsgAllocated); 2490 2491 AssertRCReturn(rc, rc); 2491 2492 … … 2493 2494 RTListForEach(&pClient->MsgQueue, pMsg, SHCLCLIENTMSG, ListEntry) 2494 2495 { 2495 SSMR3PutStructEx(pSSM, pMsg, sizeof(SHCLCLIENTMSG), 0 /*fFlags*/, &s_aShClSSMClientMsgHdr[0], NULL);2496 SSMR3PutStructEx(pSSM, pMsg, sizeof(SHCLCLIENTMSG), 0 /*fFlags*/, &s_aShClSSMClientMsgCtx[0], NULL);2496 pVMM->pfnSSMR3PutStructEx(pSSM, pMsg, sizeof(SHCLCLIENTMSG), 0 /*fFlags*/, &s_aShClSSMClientMsgHdr[0], NULL); 2497 pVMM->pfnSSMR3PutStructEx(pSSM, pMsg, sizeof(SHCLCLIENTMSG), 0 /*fFlags*/, &s_aShClSSMClientMsgCtx[0], NULL); 2497 2498 2498 2499 for (uint32_t iParm = 0; iParm < pMsg->cParms; iParm++) 2499 HGCMSvcSSMR3Put(&pMsg->aParms[iParm], pSSM );2500 } 2501 2502 rc = SSMR3PutU64(pSSM, pClient->Legacy.cCID);2500 HGCMSvcSSMR3Put(&pMsg->aParms[iParm], pSSM, pVMM); 2501 } 2502 2503 rc = pVMM->pfnSSMR3PutU64(pSSM, pClient->Legacy.cCID); 2503 2504 AssertRCReturn(rc, rc); 2504 2505 … … 2506 2507 RTListForEach(&pClient->Legacy.lstCID, pCID, SHCLCLIENTLEGACYCID, Node) 2507 2508 { 2508 rc = SSMR3PutStructEx(pSSM, pCID, sizeof(SHCLCLIENTLEGACYCID), 0 /*fFlags*/, &s_aShClSSMClientLegacyCID[0], NULL);2509 rc = pVMM->pfnSSMR3PutStructEx(pSSM, pCID, sizeof(SHCLCLIENTLEGACYCID), 0 /*fFlags*/, &s_aShClSSMClientLegacyCID[0], NULL); 2509 2510 AssertRCReturn(rc, rc); 2510 2511 } 2511 2512 #else /* UNIT_TEST */ 2512 RT_NOREF 3(u32ClientID, pvClient, pSSM);2513 RT_NOREF(u32ClientID, pvClient, pSSM, pVMM); 2513 2514 #endif /* UNIT_TEST */ 2514 2515 return VINF_SUCCESS; … … 2516 2517 2517 2518 #ifndef UNIT_TEST 2518 static int svcLoadStateV0(uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM, uint32_t uVersion)2519 static int svcLoadStateV0(uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion) 2519 2520 { 2520 2521 RT_NOREF(u32ClientID, pvClient, pSSM, uVersion); 2521 2522 2522 2523 uint32_t uMarker; 2523 int rc = SSMR3GetU32(pSSM, &uMarker); /* Begin marker. */2524 int rc = pVMM->pfnSSMR3GetU32(pSSM, &uMarker); /* Begin marker. */ 2524 2525 AssertRC(rc); 2525 2526 Assert(uMarker == UINT32_C(0x19200102) /* SSMR3STRUCT_BEGIN */); 2526 2527 2527 rc = SSMR3Skip(pSSM, sizeof(uint32_t)); /* Client ID */2528 rc = pVMM->pfnSSMR3Skip(pSSM, sizeof(uint32_t)); /* Client ID */ 2528 2529 AssertRCReturn(rc, rc); 2529 2530 2530 2531 bool fValue; 2531 rc = SSMR3GetBool(pSSM, &fValue); /* fHostMsgQuit */2532 rc = pVMM->pfnSSMR3GetBool(pSSM, &fValue); /* fHostMsgQuit */ 2532 2533 AssertRCReturn(rc, rc); 2533 2534 2534 rc = SSMR3GetBool(pSSM, &fValue); /* fHostMsgReadData */2535 rc = pVMM->pfnSSMR3GetBool(pSSM, &fValue); /* fHostMsgReadData */ 2535 2536 AssertRCReturn(rc, rc); 2536 2537 2537 rc = SSMR3GetBool(pSSM, &fValue); /* fHostMsgFormats */2538 rc = pVMM->pfnSSMR3GetBool(pSSM, &fValue); /* fHostMsgFormats */ 2538 2539 AssertRCReturn(rc, rc); 2539 2540 2540 2541 uint32_t fFormats; 2541 rc = SSMR3GetU32(pSSM, &fFormats); /* u32RequestedFormat */2542 rc = pVMM->pfnSSMR3GetU32(pSSM, &fFormats); /* u32RequestedFormat */ 2542 2543 AssertRCReturn(rc, rc); 2543 2544 2544 rc = SSMR3GetU32(pSSM, &uMarker); /* End marker. */2545 rc = pVMM->pfnSSMR3GetU32(pSSM, &uMarker); /* End marker. */ 2545 2546 AssertRCReturn(rc, rc); 2546 2547 Assert(uMarker == UINT32_C(0x19920406) /* SSMR3STRUCT_END */); … … 2550 2551 #endif /* UNIT_TEST */ 2551 2552 2552 static DECLCALLBACK(int) svcLoadState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM, uint32_t uVersion) 2553 static DECLCALLBACK(int) svcLoadState(void *, uint32_t u32ClientID, void *pvClient, 2554 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion) 2553 2555 { 2554 2556 LogFlowFuncEnter(); … … 2563 2565 /* Restore the client data. */ 2564 2566 uint32_t lenOrVer; 2565 int rc = SSMR3GetU32(pSSM, &lenOrVer);2567 int rc = pVMM->pfnSSMR3GetU32(pSSM, &lenOrVer); 2566 2568 AssertRCReturn(rc, rc); 2567 2569 … … 2569 2571 2570 2572 if (lenOrVer == VBOX_SHCL_SAVED_STATE_VER_3_1) 2571 return svcLoadStateV0(u32ClientID, pvClient, pSSM, uVersion);2573 return svcLoadStateV0(u32ClientID, pvClient, pSSM, pVMM, uVersion); 2572 2574 2573 2575 if ( lenOrVer >= VBOX_SHCL_SAVED_STATE_VER_6_1B2 … … 2576 2578 if (lenOrVer >= VBOX_SHCL_SAVED_STATE_VER_6_1RC1) 2577 2579 { 2578 SSMR3GetStructEx(pSSM, &pClient->State, sizeof(pClient->State), 0 /* fFlags */, &s_aShClSSMClientState[0], NULL); 2579 SSMR3GetStructEx(pSSM, &pClient->State.POD, sizeof(pClient->State.POD), 0 /* fFlags */, 2580 &s_aShClSSMClientPODState[0], NULL); 2580 pVMM->pfnSSMR3GetStructEx(pSSM, &pClient->State, sizeof(pClient->State), 0 /* fFlags */, 2581 &s_aShClSSMClientState[0], NULL); 2582 pVMM->pfnSSMR3GetStructEx(pSSM, &pClient->State.POD, sizeof(pClient->State.POD), 0 /* fFlags */, 2583 &s_aShClSSMClientPODState[0], NULL); 2581 2584 } 2582 2585 else 2583 SSMR3GetStructEx(pSSM, &pClient->State, sizeof(pClient->State), 0 /* fFlags */, &s_aShClSSMClientState61B1[0], NULL); 2584 rc = SSMR3GetStructEx(pSSM, &pClient->State.Transfers, sizeof(pClient->State.Transfers), 0 /* fFlags */, 2585 &s_aShClSSMClientTransferState[0], NULL); 2586 pVMM->pfnSSMR3GetStructEx(pSSM, &pClient->State, sizeof(pClient->State), 0 /* fFlags */, 2587 &s_aShClSSMClientState61B1[0], NULL); 2588 rc = pVMM->pfnSSMR3GetStructEx(pSSM, &pClient->State.Transfers, sizeof(pClient->State.Transfers), 0 /* fFlags */, 2589 &s_aShClSSMClientTransferState[0], NULL); 2586 2590 AssertRCReturn(rc, rc); 2587 2591 2588 2592 /* Load the client's internal message queue. */ 2589 2593 uint64_t cMsgs; 2590 rc = SSMR3GetU64(pSSM, &cMsgs);2594 rc = pVMM->pfnSSMR3GetU64(pSSM, &cMsgs); 2591 2595 AssertRCReturn(rc, rc); 2592 2596 AssertLogRelMsgReturn(cMsgs < _16K, ("Too many messages: %u (%x)\n", cMsgs, cMsgs), VERR_SSM_DATA_UNIT_FORMAT_CHANGED); … … 2600 2604 } u; 2601 2605 2602 SSMR3GetStructEx(pSSM, &u.Msg, RT_UOFFSETOF(SHCLCLIENTMSG, aParms), 0 /*fFlags*/, &s_aShClSSMClientMsgHdr[0], NULL); 2603 rc = SSMR3GetStructEx(pSSM, &u.Msg, RT_UOFFSETOF(SHCLCLIENTMSG, aParms), 0 /*fFlags*/, &s_aShClSSMClientMsgCtx[0], NULL); 2606 pVMM->pfnSSMR3GetStructEx(pSSM, &u.Msg, RT_UOFFSETOF(SHCLCLIENTMSG, aParms), 0 /*fFlags*/, 2607 &s_aShClSSMClientMsgHdr[0], NULL); 2608 rc = pVMM->pfnSSMR3GetStructEx(pSSM, &u.Msg, RT_UOFFSETOF(SHCLCLIENTMSG, aParms), 0 /*fFlags*/, 2609 &s_aShClSSMClientMsgCtx[0], NULL); 2604 2610 AssertRCReturn(rc, rc); 2605 2611 … … 2614 2620 for (uint32_t p = 0; p < pMsg->cParms; p++) 2615 2621 { 2616 rc = HGCMSvcSSMR3Get(&pMsg->aParms[p], pSSM );2622 rc = HGCMSvcSSMR3Get(&pMsg->aParms[p], pSSM, pVMM); 2617 2623 AssertRCReturnStmt(rc, shClSvcMsgFree(pClient, pMsg), rc); 2618 2624 } … … 2626 2632 { 2627 2633 uint64_t cCID; 2628 rc = SSMR3GetU64(pSSM, &cCID);2634 rc = pVMM->pfnSSMR3GetU64(pSSM, &cCID); 2629 2635 AssertRCReturn(rc, rc); 2630 2636 AssertLogRelMsgReturn(cCID < _16K, ("Too many context IDs: %u (%x)\n", cCID, cCID), VERR_SSM_DATA_UNIT_FORMAT_CHANGED); … … 2635 2641 AssertPtrReturn(pCID, VERR_NO_MEMORY); 2636 2642 2637 SSMR3GetStructEx(pSSM, pCID, sizeof(SHCLCLIENTLEGACYCID), 0 /* fFlags */, &s_aShClSSMClientLegacyCID[0], NULL); 2643 pVMM->pfnSSMR3GetStructEx(pSSM, pCID, sizeof(SHCLCLIENTLEGACYCID), 0 /* fFlags */, 2644 &s_aShClSSMClientLegacyCID[0], NULL); 2638 2645 RTListAppend(&pClient->Legacy.lstCID, &pCID->Node); 2639 2646 } … … 2650 2657 2651 2658 #else /* UNIT_TEST */ 2652 RT_NOREF(u32ClientID, pvClient, pSSM, uVersion);2659 RT_NOREF(u32ClientID, pvClient, pSSM, pVMM, uVersion); 2653 2660 #endif /* UNIT_TEST */ 2654 2661 return VINF_SUCCESS; -
trunk/src/VBox/HostServices/SharedFolders/Makefile.kmk
r93115 r93444 47 47 48 48 VBoxSharedFolders_LIBS = \ 49 $(LIB_VMM) \ 50 $(LIB_RUNTIME) \ 51 $(LIB_REM) 49 $(LIB_RUNTIME) 52 50 53 51 include $(FILE_KBUILD_SUB_FOOTER) -
trunk/src/VBox/HostServices/SharedFolders/VBoxSharedFoldersSvc.cpp
r93115 r93444 33 33 #include <VBox/vmm/ssm.h> 34 34 #include <VBox/vmm/pdmifs.h> 35 #include <VBox/vmm/vmmr3vtable.h> 35 36 36 37 … … 194 195 * as the contents of a shared folder might change in between save and restore. 195 196 */ 196 static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM )197 static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM) 197 198 { 198 199 #ifndef UNITTEST /* Read this as not yet tested */ … … 202 203 Log(("SharedFolders host service: saving state, u32ClientID = %u\n", u32ClientID)); 203 204 204 int rc = SSMR3PutU32(pSSM, SHFL_SAVED_STATE_VERSION);205 int rc = pVMM->pfnSSMR3PutU32(pSSM, SHFL_SAVED_STATE_VERSION); 205 206 AssertRCReturn(rc, rc); 206 207 207 rc = SSMR3PutU32(pSSM, SHFL_MAX_MAPPINGS);208 rc = pVMM->pfnSSMR3PutU32(pSSM, SHFL_MAX_MAPPINGS); 208 209 AssertRCReturn(rc, rc); 209 210 210 211 /* Save client structure length & contents */ 211 rc = SSMR3PutU32(pSSM, sizeof(*pClient));212 rc = pVMM->pfnSSMR3PutU32(pSSM, sizeof(*pClient)); 212 213 AssertRCReturn(rc, rc); 213 214 214 rc = SSMR3PutMem(pSSM, pClient, sizeof(*pClient));215 rc = pVMM->pfnSSMR3PutMem(pSSM, pClient, sizeof(*pClient)); 215 216 AssertRCReturn(rc, rc); 216 217 … … 221 222 MAPPING *pFolderMapping = vbsfMappingGetByRoot(i); 222 223 223 rc = SSMR3PutU32(pSSM, pFolderMapping? pFolderMapping->cMappings: 0);224 rc = pVMM->pfnSSMR3PutU32(pSSM, pFolderMapping? pFolderMapping->cMappings: 0); 224 225 AssertRCReturn(rc, rc); 225 226 226 rc = SSMR3PutBool(pSSM, pFolderMapping? pFolderMapping->fValid: false);227 rc = pVMM->pfnSSMR3PutBool(pSSM, pFolderMapping? pFolderMapping->fValid: false); 227 228 AssertRCReturn(rc, rc); 228 229 … … 230 231 { 231 232 uint32_t len = (uint32_t)strlen(pFolderMapping->pszFolderName); 232 SSMR3PutU32(pSSM, len);233 SSMR3PutStrZ(pSSM, pFolderMapping->pszFolderName);233 pVMM->pfnSSMR3PutU32(pSSM, len); 234 pVMM->pfnSSMR3PutStrZ(pSSM, pFolderMapping->pszFolderName); 234 235 235 236 len = ShflStringSizeOfBuffer(pFolderMapping->pMapName); 236 SSMR3PutU32(pSSM, len);237 SSMR3PutMem(pSSM, pFolderMapping->pMapName, len);238 239 SSMR3PutBool(pSSM, pFolderMapping->fHostCaseSensitive);240 241 SSMR3PutBool(pSSM, pFolderMapping->fGuestCaseSensitive);237 pVMM->pfnSSMR3PutU32(pSSM, len); 238 pVMM->pfnSSMR3PutMem(pSSM, pFolderMapping->pMapName, len); 239 240 pVMM->pfnSSMR3PutBool(pSSM, pFolderMapping->fHostCaseSensitive); 241 242 pVMM->pfnSSMR3PutBool(pSSM, pFolderMapping->fGuestCaseSensitive); 242 243 243 244 len = ShflStringSizeOfBuffer(pFolderMapping->pAutoMountPoint); 244 SSMR3PutU32(pSSM, len);245 rc = SSMR3PutMem(pSSM, pFolderMapping->pAutoMountPoint, len);245 pVMM->pfnSSMR3PutU32(pSSM, len); 246 rc = pVMM->pfnSSMR3PutMem(pSSM, pFolderMapping->pAutoMountPoint, len); 246 247 AssertRCReturn(rc, rc); 247 248 } … … 249 250 250 251 #else 251 RT_NOREF 3(u32ClientID, pvClient, pSSM);252 RT_NOREF(u32ClientID, pvClient, pSSM, pVMM); 252 253 #endif 253 254 return VINF_SUCCESS; 254 255 } 255 256 256 static DECLCALLBACK(int) svcLoadState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM, uint32_t uVersion) 257 static DECLCALLBACK(int) svcLoadState(void *, uint32_t u32ClientID, void *pvClient, 258 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion) 257 259 { 258 260 #ifndef UNITTEST /* Read this as not yet tested */ … … 265 267 266 268 uint32_t uShfVersion = 0; 267 int rc = SSMR3GetU32(pSSM, &uShfVersion);269 int rc = pVMM->pfnSSMR3GetU32(pSSM, &uShfVersion); 268 270 AssertRCReturn(rc, rc); 269 271 270 272 if ( uShfVersion > SHFL_SAVED_STATE_VERSION 271 273 || uShfVersion < SHFL_SAVED_STATE_VERSION_FOLDERNAME_UTF16) 272 return SSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS,273 "Unknown shared folders state version %u!", uShfVersion);274 275 rc = SSMR3GetU32(pSSM, &nrMappings);274 return pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS, 275 "Unknown shared folders state version %u!", uShfVersion); 276 277 rc = pVMM->pfnSSMR3GetU32(pSSM, &nrMappings); 276 278 AssertRCReturn(rc, rc); 277 279 if (nrMappings != SHFL_MAX_MAPPINGS) … … 279 281 280 282 /* Restore the client data (flags + path delimiter + mapping counts (new) at the moment) */ 281 rc = SSMR3GetU32(pSSM, &len);283 rc = pVMM->pfnSSMR3GetU32(pSSM, &len); 282 284 AssertRCReturn(rc, rc); 283 285 … … 285 287 pClient->fHasMappingCounts = false; 286 288 else if (len != sizeof(*pClient)) 287 return SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,288 "Saved SHFLCLIENTDATA size %u differs from current %u!", len, sizeof(*pClient));289 290 rc = SSMR3GetMem(pSSM, pClient, len);289 return pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 290 "Saved SHFLCLIENTDATA size %u differs from current %u!", len, sizeof(*pClient)); 291 292 rc = pVMM->pfnSSMR3GetMem(pSSM, pClient, len); 291 293 AssertRCReturn(rc, rc); 292 294 … … 297 299 else if ( pClient->enmErrorStyle <= kShflErrorStyle_Invalid 298 300 || pClient->enmErrorStyle >= kShflErrorStyle_End) 299 return SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,300 "Saved SHFLCLIENTDATA enmErrorStyle value %d is not known/valid!", pClient->enmErrorStyle);301 return pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 302 "Saved SHFLCLIENTDATA enmErrorStyle value %d is not known/valid!", pClient->enmErrorStyle); 301 303 302 304 /* Drop the root IDs of all configured mappings before restoring: */ … … 311 313 312 314 /* restore the folder mapping counter. */ 313 rc = SSMR3GetU32(pSSM, &mapping.cMappings);315 rc = pVMM->pfnSSMR3GetU32(pSSM, &mapping.cMappings); 314 316 AssertRCReturn(rc, rc); 315 317 316 rc = SSMR3GetBool(pSSM, &mapping.fValid);318 rc = pVMM->pfnSSMR3GetBool(pSSM, &mapping.fValid); 317 319 AssertRCReturn(rc, rc); 318 320 … … 321 323 /* Load the host path name. */ 322 324 uint32_t cb; 323 rc = SSMR3GetU32(pSSM, &cb);325 rc = pVMM->pfnSSMR3GetU32(pSSM, &cb); 324 326 AssertRCReturn(rc, rc); 325 327 … … 328 330 { 329 331 AssertReturn(cb > SHFLSTRING_HEADER_SIZE && cb <= UINT16_MAX + SHFLSTRING_HEADER_SIZE && !(cb & 1), 330 SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, "Bad folder name size: %#x", cb)); 332 pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 333 "Bad folder name size: %#x", cb)); 331 334 PSHFLSTRING pFolderName = (PSHFLSTRING)RTMemAlloc(cb); 332 335 AssertReturn(pFolderName != NULL, VERR_NO_MEMORY); 333 336 334 rc = SSMR3GetMem(pSSM, pFolderName, cb);337 rc = pVMM->pfnSSMR3GetMem(pSSM, pFolderName, cb); 335 338 AssertRCReturn(rc, rc); 336 339 AssertReturn(pFolderName->u16Size < cb && pFolderName->u16Length < pFolderName->u16Size, 337 SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,338 "Bad folder name string: %#x/%#x cb=%#x",339 pFolderName->u16Size, pFolderName->u16Length, cb));340 pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 341 "Bad folder name string: %#x/%#x cb=%#x", 342 pFolderName->u16Size, pFolderName->u16Length, cb)); 340 343 341 344 rc = RTUtf16ToUtf8(pFolderName->String.ucs2, &pszFolderName); … … 348 351 AssertReturn(pszFolderName, VERR_NO_MEMORY); 349 352 350 rc = SSMR3GetStrZ(pSSM, pszFolderName, cb + 1);353 rc = pVMM->pfnSSMR3GetStrZ(pSSM, pszFolderName, cb + 1); 351 354 AssertRCReturn(rc, rc); 352 355 mapping.pszFolderName = pszFolderName; … … 354 357 355 358 /* Load the map name. */ 356 rc = SSMR3GetU32(pSSM, &cb);359 rc = pVMM->pfnSSMR3GetU32(pSSM, &cb); 357 360 AssertRCReturn(rc, rc); 358 361 AssertReturn(cb > SHFLSTRING_HEADER_SIZE && cb <= UINT16_MAX + SHFLSTRING_HEADER_SIZE && !(cb & 1), 359 SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, "Bad map name size: %#x", cb)); 362 pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 363 "Bad map name size: %#x", cb)); 360 364 361 365 PSHFLSTRING pMapName = (PSHFLSTRING)RTMemAlloc(cb); 362 366 AssertReturn(pMapName != NULL, VERR_NO_MEMORY); 363 367 364 rc = SSMR3GetMem(pSSM, pMapName, cb);368 rc = pVMM->pfnSSMR3GetMem(pSSM, pMapName, cb); 365 369 AssertRCReturn(rc, rc); 366 370 AssertReturn(pMapName->u16Size < cb && pMapName->u16Length < pMapName->u16Size, 367 SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,368 "Bad map name string: %#x/%#x cb=%#x",369 pMapName->u16Size, pMapName->u16Length, cb));371 pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 372 "Bad map name string: %#x/%#x cb=%#x", 373 pMapName->u16Size, pMapName->u16Length, cb)); 370 374 371 375 /* Load case sensitivity config. */ 372 rc = SSMR3GetBool(pSSM, &mapping.fHostCaseSensitive);376 rc = pVMM->pfnSSMR3GetBool(pSSM, &mapping.fHostCaseSensitive); 373 377 AssertRCReturn(rc, rc); 374 378 375 rc = SSMR3GetBool(pSSM, &mapping.fGuestCaseSensitive);379 rc = pVMM->pfnSSMR3GetBool(pSSM, &mapping.fGuestCaseSensitive); 376 380 AssertRCReturn(rc, rc); 377 381 … … 380 384 if (uShfVersion > SHFL_SAVED_STATE_VERSION_PRE_AUTO_MOUNT_POINT) 381 385 { 382 rc = SSMR3GetU32(pSSM, &cb);386 rc = pVMM->pfnSSMR3GetU32(pSSM, &cb); 383 387 AssertRCReturn(rc, rc); 384 388 AssertReturn(cb > SHFLSTRING_HEADER_SIZE && cb <= UINT16_MAX + SHFLSTRING_HEADER_SIZE && !(cb & 1), 385 SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, "Bad auto mount point size: %#x", cb)); 389 pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 390 "Bad auto mount point size: %#x", cb)); 386 391 387 392 pAutoMountPoint = (PSHFLSTRING)RTMemAlloc(cb); 388 393 AssertReturn(pAutoMountPoint != NULL, VERR_NO_MEMORY); 389 394 390 rc = SSMR3GetMem(pSSM, pAutoMountPoint, cb);395 rc = pVMM->pfnSSMR3GetMem(pSSM, pAutoMountPoint, cb); 391 396 AssertRCReturn(rc, rc); 392 397 AssertReturn(pAutoMountPoint->u16Size < cb && pAutoMountPoint->u16Length < pAutoMountPoint->u16Size, 393 SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,394 "Bad auto mount point string: %#x/%#x cb=%#x",395 pAutoMountPoint->u16Size, pAutoMountPoint->u16Length, cb));398 pVMM->pfnSSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 399 "Bad auto mount point string: %#x/%#x cb=%#x", 400 pAutoMountPoint->u16Size, pAutoMountPoint->u16Length, cb)); 396 401 397 402 } … … 428 433 Log(("SharedFolders host service: successfully loaded state\n")); 429 434 #else 430 RT_NOREF(u32ClientID, pvClient, pSSM, uVersion);435 RT_NOREF(u32ClientID, pvClient, pSSM, pVMM, uVersion); 431 436 #endif 432 437 return VINF_SUCCESS; -
trunk/src/VBox/Main/Makefile.kmk
r93424 r93444 1029 1029 1030 1030 VBoxC_LIBS += \ 1031 $(PATH_STAGE_LIB)/VBoxAPIWrap$(VBOX_SUFF_LIB) \ 1032 $(if-expr "$(LIB_VMM)" == "$(VBOX_LIB_VMM_LAZY)",$(LIB_REM),) \ 1033 $(VBOX_LIB_VMM_LAZY) 1031 $(PATH_STAGE_LIB)/VBoxAPIWrap$(VBOX_SUFF_LIB) 1034 1032 VBoxC_LIBS.win += \ 1035 1033 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/psapi.lib \ … … 1068 1066 src-all/DisplayPNGUtil.cpp \ 1069 1067 src-all/DisplayResampleImage.cpp \ 1070 src-all/DisplayUtils.cpp \1071 1068 src-all/EventImpl.cpp \ 1072 1069 src-all/Global.cpp \ -
trunk/src/VBox/Main/include/AudioDriver.h
r93115 r93444 97 97 bool IsAttached(void) { return mfAttached; } 98 98 99 int doAttachDriverViaEmt(PUVM pUVM, util::AutoWriteLock *pAutoLock);100 int doDetachDriverViaEmt(PUVM pUVM, util::AutoWriteLock *pAutoLock);99 int doAttachDriverViaEmt(PUVM pUVM, PCVMMR3VTABLE pVMM, util::AutoWriteLock *pAutoLock); 100 int doDetachDriverViaEmt(PUVM pUVM, PCVMMR3VTABLE pVMM, util::AutoWriteLock *pAutoLock); 101 101 102 102 protected: … … 107 107 108 108 /** 109 * Optional (virtual) function to give the derived audio driver 110 * class the ability to add (or change) the driver configuration 111 * entries when setting up. 109 * Virtual function for child specific driver configuration. 112 110 * 113 * @return VBox status code. 114 * @param pLunCfg CFGM configuration node of the driver. 111 * This is called at the end of AudioDriver::configure(). 112 * 113 * @returns VBox status code. 114 * @param pLunCfg CFGM configuration node of the driver. 115 * @param pVMM The VMM ring-3 vtable. 115 116 */ 116 virtual int configureDriver(PCFGMNODE pLunCfg) { RT_NOREF(pLunCfg); return VINF_SUCCESS; } 117 virtual int configureDriver(PCFGMNODE pLunCfg, PCVMMR3VTABLE pVMM) 118 { 119 RT_NOREF(pLunCfg, pVMM); 120 return VINF_SUCCESS; 121 } 117 122 118 123 protected: -
trunk/src/VBox/Main/include/BusAssignmentManager.h
r93115 r93444 47 47 }; 48 48 49 static BusAssignmentManager *createInstance( ChipsetType_T chipsetType, IommuType_T iommuType);49 static BusAssignmentManager *createInstance(PCVMMR3VTABLE pVMM, ChipsetType_T chipsetType, IommuType_T iommuType); 50 50 virtual void AddRef(); 51 51 virtual void Release(); -
trunk/src/VBox/Main/include/ConsoleImpl.h
r93312 r93444 135 135 136 136 // public initializers/uninitializers for internal purposes only 137 HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType);137 HRESULT initWithMachine(IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType); 138 138 void uninit(); 139 139 … … 146 146 */ 147 147 148 PCVMMR3VTABLE i_getVMMVTable() const RT_NOEXCEPT { return mpVMM; } 148 149 Guest *i_getGuest() const { return mGuest; } 149 150 Keyboard *i_getKeyboard() const { return mKeyboard; } … … 162 163 int i_recordingStop(util::AutoWriteLock *pAutoLock = NULL); 163 164 # ifdef VBOX_WITH_AUDIO_RECORDING 164 AudioVideoRec *i_recordingGetAudioDrv(void) const { return Recording.mAudioRec; }165 AudioVideoRec *i_recordingGetAudioDrv(void) const { return mRecording.mAudioRec; } 165 166 # endif 166 RecordingContext *i_recordingGetContext(void) const { return Recording.mpCtx; }167 RecordingContext *i_recordingGetContext(void) const { return mRecording.mpCtx; } 167 168 # ifdef VBOX_WITH_AUDIO_RECORDING 168 169 HRESULT i_recordingSendAudio(const void *pvData, size_t cbData, uint64_t uDurationMs); … … 328 329 private: 329 330 330 // wrap ed IConsole properties331 // wrapped IConsole properties 331 332 HRESULT getMachine(ComPtr<IMachine> &aMachine); 332 333 HRESULT getState(MachineState_T *aState); … … 346 347 HRESULT getEmulatedUSB(ComPtr<IEmulatedUSB> &aEmulatedUSB); 347 348 348 // wrap ed IConsole methods349 // wrapped IConsole methods 349 350 HRESULT powerUp(ComPtr<IProgress> &aProgress); 350 351 HRESULT powerUpPaused(ComPtr<IProgress> &aProgress); … … 384 385 HRESULT clearAllDiskEncryptionPasswords(); 385 386 386 void notifyNatDnsChange(PUVM pUVM, const char *pszDevice, ULONG ulInstanceMax);387 void notifyNatDnsChange(PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDevice, ULONG ulInstanceMax); 387 388 Utf8Str VRDPServerErrorToMsg(int vrc); 388 389 … … 492 493 typedef AutoVMCallerBase<taQuiet, true> Base; 493 494 public: 494 SafeVMPtrBase(Console *aThat) : Base(aThat), mRC(E_FAIL), mpUVM(NULL) 495 SafeVMPtrBase(Console *aThat) : Base(aThat), mRC(E_FAIL), mpUVM(NULL), mpVMM(NULL) 495 496 { 496 497 if (Base::isOk()) 497 mRC = aThat->i_safeVMPtrRetainer(&mpUVM, taQuiet);498 mRC = aThat->i_safeVMPtrRetainer(&mpUVM, &mpVMM, taQuiet); 498 499 } 499 500 ~SafeVMPtrBase() … … 503 504 /** Direct PUVM access. */ 504 505 PUVM rawUVM() const { return mpUVM; } 506 /** Direct PCVMMR3VTABLE access. */ 507 PCVMMR3VTABLE vtable() const { return mpVMM; } 505 508 /** Release the handles. */ 506 509 void release() … … 525 528 Base::doRelease(); 526 529 } 527 HRESULT mRC; /* Whether the VM ptr was retained. */ 528 PUVM mpUVM; 530 HRESULT mRC; /* Whether the VM ptr was retained. */ 531 PUVM mpUVM; 532 PCVMMR3VTABLE mpVMM; 529 533 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase); 530 534 }; … … 637 641 typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList; 638 642 643 HRESULT i_loadVMM(void) RT_NOEXCEPT; 639 644 HRESULT i_addVMCaller(bool aQuiet = false, bool aAllowNullVM = false); 640 645 void i_releaseVMCaller(); 641 HRESULT i_safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);646 HRESULT i_safeVMPtrRetainer(PUVM *a_ppUVM, PCVMMR3VTABLE *a_ppVMM, bool aQuiet) RT_NOEXCEPT; 642 647 void i_safeVMPtrReleaser(PUVM *a_ppUVM); 643 648 … … 671 676 HRESULT i_removeSharedFolder(const Utf8Str &strName); 672 677 673 HRESULT i_suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume); 674 void i_resumeAfterConfigChange(PUVM pUVM); 675 676 static DECLCALLBACK(int) i_configConstructor(PUVM pUVM, PVM pVM, void *pvConsole); 678 HRESULT i_suspendBeforeConfigChange(PUVM pUVM, PCVMMR3VTABLE pVMM, AutoWriteLock *pAlock, bool *pfResume); 679 void i_resumeAfterConfigChange(PUVM pUVM, PCVMMR3VTABLE pVMM); 680 681 static DECLCALLBACK(int) i_configConstructor(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, void *pvConsole); 682 void InsertConfigString(PCFGMNODE pNode, const char *pcszName, const char *pcszValue); 683 void InsertConfigString(PCFGMNODE pNode, const char *pcszName, const Utf8Str &rStrValue); 684 void InsertConfigString(PCFGMNODE pNode, const char *pcszName, const Bstr &rBstrValue); 685 void InsertConfigPassword(PCFGMNODE pNode, const char *pcszName, const Utf8Str &rStrValue); 686 void InsertConfigBytes(PCFGMNODE pNode, const char *pcszName, const void *pvBytes, size_t cbBytes); 687 void InsertConfigInteger(PCFGMNODE pNode, const char *pcszName, uint64_t u64Integer); 688 void InsertConfigNode(PCFGMNODE pNode, const char *pcszName, PCFGMNODE *ppChild); 689 void InsertConfigNodeF(PCFGMNODE pNode, PCFGMNODE *ppChild, const char *pszNameFormat, ...); 690 void RemoveConfigValue(PCFGMNODE pNode, const char *pcszName); 691 int SetBiosDiskInfo(ComPtr<IMachine> pMachine, PCFGMNODE pCfg, PCFGMNODE pBiosCfg, 692 Bstr controllerName, const char * const s_apszBiosConfig[4]); 677 693 void i_configAudioDriver(IVirtualBox *pVirtualBox, IMachine *pMachine, PCFGMNODE pLUN, const char *pszDriverName, 678 694 bool fAudioEnabledIn, bool fAudioEnabledOut); 679 int i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);695 int i_configConstructorInner(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, AutoWriteLock *pAlock); 680 696 int i_configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine); 681 697 int i_configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine); … … 689 705 bool fHMEnabled); 690 706 int i_checkMediumLocation(IMedium *pMedium, bool *pfUseHostIOCache); 691 int i_unmountMediumFromGuest(PUVM pUVM, StorageBus_T enmBus, DeviceType_T enmDevType,707 int i_unmountMediumFromGuest(PUVM pUVM, PCVMMR3VTABLE pVMM, StorageBus_T enmBus, DeviceType_T enmDevType, 692 708 const char *pcszDevice, unsigned uInstance, unsigned uLUN, 693 bool fForceUnmount) ;709 bool fForceUnmount) RT_NOEXCEPT; 694 710 int i_removeMediumDriverFromVm(PCFGMNODE pCtlInst, 695 711 const char *pcszDevice, … … 701 717 bool fForceUnmount, 702 718 PUVM pUVM, 719 PCVMMR3VTABLE pVMM, 703 720 DeviceType_T enmDevType, 704 721 PCFGMNODE *ppLunL0); … … 719 736 bool fHotplug, 720 737 PUVM pUVM, 738 PCVMMR3VTABLE pVMM, 721 739 DeviceType_T *paLedDevType, 722 740 PCFGMNODE *ppLunL0); … … 739 757 static DECLCALLBACK(int) i_reconfigureMediumAttachment(Console *pThis, 740 758 PUVM pUVM, 759 PCVMMR3VTABLE pVMM, 741 760 const char *pcszDevice, 742 761 unsigned uInstance, … … 753 772 static DECLCALLBACK(int) i_changeRemovableMedium(Console *pThis, 754 773 PUVM pUVM, 774 PCVMMR3VTABLE pVMM, 755 775 const char *pcszDevice, 756 776 unsigned uInstance, … … 770 790 const char *pcszDevice, unsigned uInstance); 771 791 772 int i_configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun, 773 INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg, 774 PCFGMNODE pLunL0, PCFGMNODE pInst, 775 bool fAttachDetach, bool fIgnoreConnectFailure); 792 int i_configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun, INetworkAdapter *aNetworkAdapter, 793 PCFGMNODE pCfg, PCFGMNODE pLunL0, PCFGMNODE pInst, bool fAttachDetach, bool fIgnoreConnectFailure, 794 PUVM pUVM, PCVMMR3VTABLE pVMM); 776 795 int i_configSerialPort(PCFGMNODE pInst, PortMode_T ePortMode, const char *pszPath, bool fServer); 777 static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser); 778 static DECLCALLBACK(int) i_unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu); 779 static DECLCALLBACK(int) i_plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu); 780 HRESULT i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM); 781 HRESULT i_doCPURemove(ULONG aCpu, PUVM pUVM); 782 HRESULT i_doCPUAdd(ULONG aCpu, PUVM pUVM); 783 784 HRESULT i_doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance, 796 static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, PCVMMR3VTABLE pVMM, VMSTATE enmState, 797 VMSTATE enmOldState, void *pvUser); 798 static DECLCALLBACK(int) i_unplugCpu(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, VMCPUID idCpu); 799 static DECLCALLBACK(int) i_plugCpu(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, VMCPUID idCpu); 800 HRESULT i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM, PCVMMR3VTABLE pVMM); 801 HRESULT i_doCPURemove(ULONG aCpu, PUVM pUVM, PCVMMR3VTABLE pVMM); 802 HRESULT i_doCPUAdd(ULONG aCpu, PUVM pUVM, PCVMMR3VTABLE pVMM); 803 804 HRESULT i_doNetworkAdapterChange(PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDevice, unsigned uInstance, 785 805 unsigned uLun, INetworkAdapter *aNetworkAdapter); 786 static DECLCALLBACK(int) i_changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice, 787 unsigned uInstance, unsigned uLun, 788 INetworkAdapter *aNetworkAdapter); 789 static DECLCALLBACK(int) i_changeSerialPortAttachment(Console *pThis, PUVM pUVM, 790 ISerialPort *pSerialPort); 806 static DECLCALLBACK(int) i_changeNetworkAttachment(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDevice, 807 unsigned uInstance, unsigned uLun, INetworkAdapter *aNetworkAdapter); 808 static DECLCALLBACK(int) i_changeSerialPortAttachment(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, ISerialPort *pSerialPort); 791 809 792 810 int i_changeClipboardMode(ClipboardMode_T aClipboardMode); … … 798 816 HRESULT i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice); 799 817 800 static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,801 const char *aBackend, const char *aAddress, void *pvRemoteBackend,802 USBConnectionSpeed_T enmSpeed, ULONG aMaskedIfs,818 static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, PCVMMR3VTABLE pVMM, IUSBDevice *aHostDevice, 819 PCRTUUID aUuid, const char *aBackend, const char *aAddress, 820 void *pvRemoteBackend, USBConnectionSpeed_T enmSpeed, ULONG aMaskedIfs, 803 821 const char *pszCaptureFilename); 804 static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PC RTUUID aUuid);822 static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PCVMMR3VTABLE pVMM, PCRTUUID aUuid); 805 823 #endif 806 824 807 825 static DECLCALLBACK(int) i_attachStorageDevice(Console *pThis, 808 826 PUVM pUVM, 827 PCVMMR3VTABLE pVMM, 809 828 const char *pcszDevice, 810 829 unsigned uInstance, … … 815 834 static DECLCALLBACK(int) i_detachStorageDevice(Console *pThis, 816 835 PUVM pUVM, 836 PCVMMR3VTABLE pVMM, 817 837 const char *pcszDevice, 818 838 unsigned uInstance, … … 820 840 IMediumAttachment *aMediumAtt, 821 841 bool fSilent); 822 HRESULT i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);823 HRESULT i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);842 HRESULT i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, PCVMMR3VTABLE pVMM, bool fSilent); 843 HRESULT i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, PCVMMR3VTABLE pVMM, bool fSilent); 824 844 825 845 static DECLCALLBACK(int) i_stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser); … … 866 886 867 887 HRESULT i_loadDataFromSavedState(); 868 int i_loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version); 869 870 static DECLCALLBACK(void) i_saveStateFileExec(PSSMHANDLE pSSM, void *pvUser); 871 static DECLCALLBACK(int) i_loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass); 888 int i_loadStateFileExecInternal(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t u32Version); 889 890 static DECLCALLBACK(int) i_saveStateFileExec(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser); 891 static DECLCALLBACK(int) i_loadStateFileExec(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, 892 uint32_t uVersion, uint32_t uPass); 872 893 873 894 #ifdef VBOX_WITH_GUEST_PROPS … … 907 928 HRESULT i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL); 908 929 HRESULT i_teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true); 909 HRESULT i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,910 Progress *pProgress, bool *pfPowerOffOnFailure);930 HRESULT i_teleporterTrg(PUVM pUVM, PCVMMR3VTABLE pVMM, IMachine *pMachine, Utf8Str *pErrorMsg, 931 bool fStartPaused, Progress *pProgress, bool *pfPowerOffOnFailure); 911 932 static DECLCALLBACK(int) i_teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser); 912 933 /** @} */ … … 945 966 SharedFolderMap m_mapSharedFolders; // the console instances 946 967 968 /** VMM loader handle. */ 969 RTLDRMOD mhModVMM; 970 /** The VMM vtable. */ 971 PCVMMR3VTABLE mpVMM; 947 972 /** The user mode VM handle. */ 948 973 PUVM mpUVM; … … 1082 1107 AudioVideoRec * const mAudioRec; 1083 1108 # endif 1084 } Recording;1109 } mRecording; 1085 1110 #endif /* VBOX_WITH_RECORDING */ 1086 1111 -
trunk/src/VBox/Main/include/DisplayImpl.h
r93115 r93444 343 343 #endif 344 344 345 static DECLCALLBACK(void) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser); 346 static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass); 347 static DECLCALLBACK(void) i_displaySSMSave(PSSMHANDLE pSSM, void *pvUser); 348 static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass); 345 static DECLCALLBACK(int) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser); 346 static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, 347 uint32_t uVersion, uint32_t uPass); 348 static DECLCALLBACK(int) i_displaySSMSave(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser); 349 static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, 350 uint32_t uVersion, uint32_t uPass); 349 351 350 352 Console * const mParent; -
trunk/src/VBox/Main/include/DisplayUtils.h
r93115 r93444 37 37 uint32_t *pu32Width, uint32_t *pu32Height, uint16_t *pu16Flags); 38 38 39 int readSavedDisplayScreenshot(const Utf8Str &strStateFilePath, uint32_t u32Type, uint8_t **ppu8Data, uint32_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height); 39 int readSavedDisplayScreenshot(const Utf8Str &strStateFilePath, uint32_t u32Type, uint8_t **ppu8Data, 40 uint32_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height); 40 41 void freeSavedDisplayScreenshot(uint8_t *pu8Data); 41 42 -
trunk/src/VBox/Main/include/DrvAudioRec.h
r93115 r93444 58 58 private: 59 59 60 int configureDriver(PCFGMNODE pLunCfg);60 virtual int configureDriver(PCFGMNODE pLunCfg, PCVMMR3VTABLE pVMM) RT_OVERRIDE; 61 61 62 62 /** Pointer to the associated video recording audio driver. */ -
trunk/src/VBox/Main/include/DrvAudioVRDE.h
r93115 r93444 66 66 private: 67 67 68 int configureDriver(PCFGMNODE pLunCfg);68 virtual int configureDriver(PCFGMNODE pLunCfg, PCVMMR3VTABLE pVMM) RT_OVERRIDE; 69 69 70 70 /** Pointer to the associated VRDE audio driver. */ -
trunk/src/VBox/Main/include/HGCM.h
r93115 r93444 36 36 int HGCMHostReset(bool fForShutdown); 37 37 38 int HGCMHostLoad(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM, PPDMIHGCMPORT pHgcmPort); 38 int HGCMHostLoad(const char *pszServiceLibrary, const char *pszServiceName, 39 PUVM pUVM, PCVMMR3VTABLE pVMM, PPDMIHGCMPORT pHgcmPort); 39 40 40 41 int HGCMHostRegisterServiceExtension(HGCMSVCEXTHANDLE *pHandle, const char *pszServiceName, PFNHGCMSVCEXT pfnExtension, void *pvExtension); … … 50 51 int HGCMBroadcastEvent(HGCMNOTIFYEVENT enmEvent); 51 52 52 int HGCMHostSaveState(PSSMHANDLE pSSM );53 int HGCMHostLoadState(PSSMHANDLE pSSM, uint32_t uVersion);53 int HGCMHostSaveState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM); 54 int HGCMHostLoadState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion); 54 55 55 56 RT_C_DECLS_END -
trunk/src/VBox/Main/include/HGCMThread.h
r93115 r93444 143 143 * @param pUVM The user mode VM handle to register statistics with. 144 144 * NULL if no stats. 145 * @param pVMM The VMM vtable for statistics registration. NULL if 146 * no stats. 145 147 * 146 148 * @return VBox status code. 147 149 */ 148 150 int hgcmThreadCreate(HGCMThread **ppThread, const char *pszThreadName, PFNHGCMTHREAD pfnThread, void *pvUser, 149 const char *pszStatsSubDir, PUVM pUVM );151 const char *pszStatsSubDir, PUVM pUVM, PCVMMR3VTABLE pVMM); 150 152 151 153 /** Wait for termination of a HGCM worker thread. -
trunk/src/VBox/Main/include/VMMDev.h
r93115 r93444 86 86 static DECLCALLBACK(void) drvSuspend(PPDMDRVINS pDrvIns); 87 87 static DECLCALLBACK(void) drvResume(PPDMDRVINS pDrvIns); 88 static DECLCALLBACK(int) hgcmSave(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM); 89 static DECLCALLBACK(int) hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass); 88 90 89 91 Console * const mParent; -
trunk/src/VBox/Main/src-all/DisplayUtils.cpp
r93115 r93444 1 1 /* $Id$ */ 2 2 /** @file 3 * Implementation of IDisplay helpers .3 * Implementation of IDisplay helpers, currently only used in VBoxSVC. 4 4 */ 5 5 -
trunk/src/VBox/Main/src-all/NvramStoreImpl.cpp
r93115 r93444 1037 1037 DECLCALLBACK(int) NvramStore::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 1038 1038 { 1039 RT_NOREF(fFlags);1040 1039 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 1040 RT_NOREF(fFlags, pCfg); 1041 1041 PDRVMAINNVRAMSTORE pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINNVRAMSTORE); 1042 1042 LogFlow(("NvramStore::drvConstruct: iInstance=%d\n", pDrvIns->iInstance)); … … 1045 1045 * Validate configuration. 1046 1046 */ 1047 if (!CFGMR3AreValuesValid(pCfg, "")) 1048 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 1047 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "", ""); 1049 1048 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 1050 1049 ("Configuration error: Not possible to attach anything to this driver!\n"), -
trunk/src/VBox/Main/src-client/AudioDriver.cpp
r93115 r93444 28 28 #include <VBox/vmm/pdmapi.h> 29 29 #include <VBox/vmm/pdmdrv.h> 30 #include <VBox/vmm/vmmr3vtable.h> 30 31 31 32 #include "AudioDriver.h" … … 80 81 * 81 82 * @returns VBox status code. 82 * @param pUVM The user mode VM handle for talking to EMT. 83 * @param pAutoLock The callers auto lock instance. Can be NULL if 84 * not locked. 85 */ 86 int AudioDriver::doAttachDriverViaEmt(PUVM pUVM, util::AutoWriteLock *pAutoLock) 83 * @param pUVM The user mode VM handle for talking to EMT. 84 * @param pVMM The VMM ring-3 vtable. 85 * @param pAutoLock The callers auto lock instance. Can be NULL if not 86 * locked. 87 */ 88 int AudioDriver::doAttachDriverViaEmt(PUVM pUVM, PCVMMR3VTABLE pVMM, util::AutoWriteLock *pAutoLock) 87 89 { 88 90 if (!isConfigured()) … … 90 92 91 93 PVMREQ pReq; 92 int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,93 (PFNRT)attachDriverOnEmt, 1, this);94 int vrc = pVMM->pfnVMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 95 (PFNRT)attachDriverOnEmt, 1, this); 94 96 if (vrc == VERR_TIMEOUT) 95 97 { … … 98 100 pAutoLock->release(); 99 101 100 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);102 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 101 103 102 104 if (pAutoLock) … … 105 107 106 108 AssertRC(vrc); 107 VMR3ReqFree(pReq);109 pVMM->pfnVMR3ReqFree(pReq); 108 110 109 111 return vrc; … … 138 140 139 141 /* Detach the driver chain from the audio device first. */ 140 int rc = PDMR3DeviceDetach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 0 /* fFlags */);142 int rc = ptrVM.vtable()->pfnPDMR3DeviceDetach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 0 /* fFlags */); 141 143 if (RT_SUCCESS(rc)) 142 144 { 143 145 rc = pThis->configure(pCfg->uLUN, true /* Attach */); 144 146 if (RT_SUCCESS(rc)) 145 rc = PDMR3DriverAttach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 0 /* fFlags */,146 NULL /* ppBase */);147 rc = ptrVM.vtable()->pfnPDMR3DriverAttach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 148 0 /* fFlags */, NULL /* ppBase */); 147 149 } 148 150 … … 164 166 * 165 167 * @returns VBox status code. 166 * @param pUVM The user mode VM handle for talking to EMT. 167 * @param pAutoLock The callers auto lock instance. Can be NULL if 168 * not locked. 169 */ 170 int AudioDriver::doDetachDriverViaEmt(PUVM pUVM, util::AutoWriteLock *pAutoLock) 168 * @param pUVM The user mode VM handle for talking to EMT. 169 * @param pVMM The VMM ring-3 vtable. 170 * @param pAutoLock The callers auto lock instance. Can be NULL if not 171 * locked. 172 */ 173 int AudioDriver::doDetachDriverViaEmt(PUVM pUVM, PCVMMR3VTABLE pVMM, util::AutoWriteLock *pAutoLock) 171 174 { 172 175 if (!isConfigured()) … … 174 177 175 178 PVMREQ pReq; 176 int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,177 (PFNRT)detachDriverOnEmt, 1, this);179 int vrc = pVMM->pfnVMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 180 (PFNRT)detachDriverOnEmt, 1, this); 178 181 if (vrc == VERR_TIMEOUT) 179 182 { … … 182 185 pAutoLock->release(); 183 186 184 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);187 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 185 188 186 189 if (pAutoLock) … … 189 192 190 193 AssertRC(vrc); 191 VMR3ReqFree(pReq);194 pVMM->pfnVMR3ReqFree(pReq); 192 195 193 196 return vrc; … … 227 230 * Start with the "AUDIO" driver, as this driver serves as the audio connector between 228 231 * the device emulation and the select backend(s). */ 229 int rc = PDMR3DriverDetach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN,230 "AUDIO", 0 /* iOccurrence */, 0 /* fFlags */);232 int rc = ptrVM.vtable()->pfnPDMR3DriverDetach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 233 "AUDIO", 0 /* iOccurrence */, 0 /* fFlags */); 231 234 if (RT_SUCCESS(rc)) 232 235 rc = pThis->configure(pCfg->uLUN, false /* Detach */);/** @todo r=bird: Illogical and from what I can tell pointless! */ … … 256 259 { 257 260 Console::SafeVMPtrQuiet ptrVM(mpConsole); 258 Assert(ptrVM.isOk()); 259 260 PUVM pUVM = ptrVM.rawUVM(); 261 AssertPtr(pUVM); 262 263 PCFGMNODE pRoot = CFGMR3GetRootU(pUVM); 261 AssertReturn(ptrVM.isOk(), VERR_INVALID_STATE); 262 263 PCFGMNODE pRoot = ptrVM.vtable()->pfnCFGMR3GetRootU(ptrVM.rawUVM()); 264 264 AssertPtr(pRoot); 265 PCFGMNODE pDev0 = CFGMR3GetChildF(pRoot, "Devices/%s/%u/", mCfg.strDev.c_str(), mCfg.uInst);265 PCFGMNODE pDev0 = ptrVM.vtable()->pfnCFGMR3GetChildF(pRoot, "Devices/%s/%u/", mCfg.strDev.c_str(), mCfg.uInst); 266 266 267 267 if (!pDev0) /* No audio device configured? Bail out. */ … … 273 273 int rc = VINF_SUCCESS; 274 274 275 PCFGMNODE pDevLun = CFGMR3GetChildF(pDev0, "LUN#%u/", uLUN);275 PCFGMNODE pDevLun = ptrVM.vtable()->pfnCFGMR3GetChildF(pDev0, "LUN#%u/", uLUN); 276 276 277 277 if (fAttach) 278 278 { 279 do 279 do /* break "loop" */ 280 280 { 281 281 AssertMsgBreakStmt(pDevLun, ("%s: Device LUN #%u not found\n", mCfg.strName.c_str(), uLUN), rc = VERR_NOT_FOUND); … … 283 283 LogRel2(("%s: Configuring audio driver (to LUN #%u)\n", mCfg.strName.c_str(), uLUN)); 284 284 285 CFGMR3RemoveNode(pDevLun); /* Remove LUN completely first. */285 ptrVM.vtable()->pfnCFGMR3RemoveNode(pDevLun); /* Remove LUN completely first. */ 286 286 287 287 /* Insert new LUN configuration and build up the new driver chain. */ 288 rc = CFGMR3InsertNodeF(pDev0, &pDevLun, "LUN#%u/", uLUN);AssertRCBreak(rc);289 rc = CFGMR3InsertString(pDevLun, "Driver", "AUDIO");AssertRCBreak(rc);288 rc = ptrVM.vtable()->pfnCFGMR3InsertNodeF(pDev0, &pDevLun, "LUN#%u/", uLUN); AssertRCBreak(rc); 289 rc = ptrVM.vtable()->pfnCFGMR3InsertString(pDevLun, "Driver", "AUDIO"); AssertRCBreak(rc); 290 290 291 291 PCFGMNODE pLunCfg; 292 rc = CFGMR3InsertNode(pDevLun, "Config", &pLunCfg);AssertRCBreak(rc);293 294 rc = CFGMR3InsertStringF(pLunCfg, "DriverName", "%s", mCfg.strName.c_str());AssertRCBreak(rc);295 rc = CFGMR3InsertInteger(pLunCfg, "InputEnabled", mCfg.fEnabledIn);AssertRCBreak(rc);296 rc = CFGMR3InsertInteger(pLunCfg, "OutputEnabled", mCfg.fEnabledOut);AssertRCBreak(rc);292 rc = ptrVM.vtable()->pfnCFGMR3InsertNode(pDevLun, "Config", &pLunCfg); AssertRCBreak(rc); 293 294 rc = ptrVM.vtable()->pfnCFGMR3InsertStringF(pLunCfg, "DriverName", "%s", mCfg.strName.c_str()); AssertRCBreak(rc); 295 rc = ptrVM.vtable()->pfnCFGMR3InsertInteger(pLunCfg, "InputEnabled", mCfg.fEnabledIn); AssertRCBreak(rc); 296 rc = ptrVM.vtable()->pfnCFGMR3InsertInteger(pLunCfg, "OutputEnabled", mCfg.fEnabledOut); AssertRCBreak(rc); 297 297 298 298 PCFGMNODE pAttachedDriver; 299 rc = CFGMR3InsertNode(pDevLun, "AttachedDriver", &pAttachedDriver);AssertRCBreak(rc);300 rc = CFGMR3InsertStringF(pAttachedDriver, "Driver", "%s", mCfg.strName.c_str());AssertRCBreak(rc);299 rc = ptrVM.vtable()->pfnCFGMR3InsertNode(pDevLun, "AttachedDriver", &pAttachedDriver); AssertRCBreak(rc); 300 rc = ptrVM.vtable()->pfnCFGMR3InsertStringF(pAttachedDriver, "Driver", "%s", mCfg.strName.c_str()); AssertRCBreak(rc); 301 301 PCFGMNODE pAttachedDriverCfg; 302 rc = CFGMR3InsertNode(pAttachedDriver, "Config", &pAttachedDriverCfg);AssertRCBreak(rc);302 rc = ptrVM.vtable()->pfnCFGMR3InsertNode(pAttachedDriver, "Config", &pAttachedDriverCfg); AssertRCBreak(rc); 303 303 304 304 /* Call the (virtual) method for driver-specific configuration. */ 305 rc = configureDriver(pAttachedDriverCfg );AssertRCBreak(rc);305 rc = configureDriver(pAttachedDriverCfg, ptrVM.vtable()); AssertRCBreak(rc); 306 306 307 307 } while (0); … … 316 316 #ifdef LOG_ENABLED 317 317 LogFunc(("%s: fAttach=%RTbool\n", mCfg.strName.c_str(), fAttach)); 318 CFGMR3Dump(pDevLun);318 ptrVM.vtable()->pfnCFGMR3Dump(pDevLun); 319 319 #endif 320 320 } -
trunk/src/VBox/Main/src-client/BusAssignmentManager.cpp
r93115 r93444 16 16 */ 17 17 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 18 22 #define LOG_GROUP LOG_GROUP_MAIN 19 23 #include "LoggingNew.h" … … 25 29 26 30 #include <VBox/vmm/cfgm.h> 31 #include <VBox/vmm/vmmr3vtable.h> 27 32 #include <VBox/com/array.h> 28 33 … … 31 36 #include <algorithm> 32 37 38 39 /********************************************************************************************************************************* 40 * Structures and Typedefs * 41 *********************************************************************************************************************************/ 33 42 struct DeviceAssignmentRule 34 43 { … … 46 55 }; 47 56 57 58 /********************************************************************************************************************************* 59 * Global Variables * 60 *********************************************************************************************************************************/ 48 61 /* Those rules define PCI slots assignment */ 49 62 /** @note … … 297 310 }; 298 311 312 313 314 /** 315 * Bus assignment manage state data. 316 * @internal 317 */ 299 318 struct BusAssignmentManager::State 300 319 { … … 337 356 PCIMap mPCIMap; 338 357 ReversePCIMap mReversePCIMap; 358 PCVMMR3VTABLE mpVMM; 339 359 340 360 State() 341 : cRefCnt(1), mChipsetType(ChipsetType_Null), mpszBridgeName("unknownbridge") 361 : cRefCnt(1), mChipsetType(ChipsetType_Null), mpszBridgeName("unknownbridge"), mpVMM(NULL) 342 362 {} 343 363 ~State() 344 364 {} 345 365 346 HRESULT init( ChipsetType_T chipsetType, IommuType_T iommuType);366 HRESULT init(PCVMMR3VTABLE pVMM, ChipsetType_T chipsetType, IommuType_T iommuType); 347 367 348 368 HRESULT record(const char *pszName, PCIBusAddress& GuestAddress, PCIBusAddress HostAddress); … … 356 376 }; 357 377 358 HRESULT BusAssignmentManager::State::init(ChipsetType_T chipsetType, IommuType_T iommuType) 359 { 378 379 HRESULT BusAssignmentManager::State::init(PCVMMR3VTABLE pVMM, ChipsetType_T chipsetType, IommuType_T iommuType) 380 { 381 mpVMM = pVMM; 382 360 383 if (iommuType != IommuType_None) 361 384 { … … 550 573 } 551 574 552 BusAssignmentManager *BusAssignmentManager::createInstance( ChipsetType_T chipsetType, IommuType_T iommuType)575 BusAssignmentManager *BusAssignmentManager::createInstance(PCVMMR3VTABLE pVMM, ChipsetType_T chipsetType, IommuType_T iommuType) 553 576 { 554 577 BusAssignmentManager *pInstance = new BusAssignmentManager(); 555 pInstance->pState->init( chipsetType, iommuType);578 pInstance->pState->init(pVMM, chipsetType, iommuType); 556 579 Assert(pInstance); 557 580 return pInstance; … … 562 585 ASMAtomicIncS32(&pState->cRefCnt); 563 586 } 587 564 588 void BusAssignmentManager::Release() 565 589 { … … 568 592 } 569 593 570 DECLINLINE(HRESULT) InsertConfigInteger(PC FGMNODE pCfg,const char *pszName, uint64_t u64)571 { 572 int vrc = CFGMR3InsertInteger(pCfg, pszName, u64);594 DECLINLINE(HRESULT) InsertConfigInteger(PCVMMR3VTABLE pVMM, PCFGMNODE pCfg, const char *pszName, uint64_t u64) 595 { 596 int vrc = pVMM->pfnCFGMR3InsertInteger(pCfg, pszName, u64); 573 597 if (RT_FAILURE(vrc)) 574 598 return E_INVALIDARG; … … 577 601 } 578 602 579 DECLINLINE(HRESULT) InsertConfigNode(PC FGMNODE pNode, const char *pcszName, PCFGMNODE *ppChild)580 { 581 int vrc = CFGMR3InsertNode(pNode, pcszName, ppChild);603 DECLINLINE(HRESULT) InsertConfigNode(PCVMMR3VTABLE pVMM, PCFGMNODE pNode, const char *pcszName, PCFGMNODE *ppChild) 604 { 605 int vrc = pVMM->pfnCFGMR3InsertNode(pNode, pcszName, ppChild); 582 606 if (RT_FAILURE(vrc)) 583 607 return E_INVALIDARG; … … 619 643 return rc; 620 644 645 PCVMMR3VTABLE const pVMM = pState->mpVMM; 621 646 if (pCfg) 622 647 { 623 rc = InsertConfigInteger(p Cfg, "PCIBusNo", GuestAddress.miBus);648 rc = InsertConfigInteger(pVMM, pCfg, "PCIBusNo", GuestAddress.miBus); 624 649 if (FAILED(rc)) 625 650 return rc; 626 rc = InsertConfigInteger(p Cfg, "PCIDeviceNo", GuestAddress.miDevice);651 rc = InsertConfigInteger(pVMM, pCfg, "PCIDeviceNo", GuestAddress.miDevice); 627 652 if (FAILED(rc)) 628 653 return rc; 629 rc = InsertConfigInteger(p Cfg, "PCIFunctionNo", GuestAddress.miFn);654 rc = InsertConfigInteger(pVMM, pCfg, "PCIFunctionNo", GuestAddress.miFn); 630 655 if (FAILED(rc)) 631 656 return rc; … … 636 661 && !hasPCIDevice(pState->mpszBridgeName, GuestAddress.miBus - 1)) 637 662 { 638 PCFGMNODE pDevices = CFGMR3GetParent(CFGMR3GetParent(pCfg));663 PCFGMNODE pDevices = pVMM->pfnCFGMR3GetParent(pVMM->pfnCFGMR3GetParent(pCfg)); 639 664 AssertLogRelMsgReturn(pDevices, ("BusAssignmentManager: cannot find base device configuration\n"), E_UNEXPECTED); 640 PCFGMNODE pBridges = CFGMR3GetChild(pDevices, "ich9pcibridge");665 PCFGMNODE pBridges = pVMM->pfnCFGMR3GetChild(pDevices, "ich9pcibridge"); 641 666 AssertLogRelMsgReturn(pBridges, ("BusAssignmentManager: cannot find bridge configuration base\n"), E_UNEXPECTED); 642 667 … … 654 679 655 680 PCFGMNODE pInst; 656 InsertConfigNode(p Bridges, Utf8StrFmt("%d", iBridge).c_str(), &pInst);657 InsertConfigInteger(p Inst, "Trusted", 1);681 InsertConfigNode(pVMM, pBridges, Utf8StrFmt("%d", iBridge).c_str(), &pInst); 682 InsertConfigInteger(pVMM, pInst, "Trusted", 1); 658 683 rc = assignPCIDevice(pState->mpszBridgeName, pInst); 659 684 if (FAILED(rc)) -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r93440 r93444 105 105 #include <iprt/memsafer.h> 106 106 107 #include <VBox/vmm/vmmr3vtable.h> 107 108 #include <VBox/vmm/vmapi.h> 108 109 #include <VBox/vmm/vmm.h> … … 229 230 Progress *aProgress) 230 231 : VMTask(aConsole, aProgress, NULL /* aServerProgress */, false /* aUsesVMPtr */) 231 , m ConfigConstructor(NULL)232 , mpfnConfigConstructor(NULL) 232 233 , mStartPaused(false) 233 234 , mTeleporterEnabled(FALSE) … … 236 237 } 237 238 238 PFNCFGMCONSTRUCTOR m ConfigConstructor;239 PFNCFGMCONSTRUCTOR mpfnConfigConstructor; 239 240 Utf8Str mSavedStateFile; 240 241 Console::SharedFolderDataMap mSharedFolders; … … 389 390 , mfVRDEChangeInProcess(false) 390 391 , mfVRDEChangePending(false) 392 , mhModVMM(NIL_RTLDRMOD) 393 , mpVMM(NULL) 391 394 , mpUVM(NULL) 392 395 , mVMCallers(0) … … 475 478 ///////////////////////////////////////////////////////////////////////////// 476 479 477 HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType) 480 /** @todo r=bird: aLockType is always LockType_VM. */ 481 HRESULT Console::initWithMachine(IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType) 478 482 { 479 483 AssertReturn(aMachine && aControl, E_INVALIDARG); … … 516 520 517 521 /* Now the VM specific parts */ 522 /** @todo r=bird: aLockType is always LockType_VM. */ 518 523 if (aLockType == LockType_VM) 519 524 { 525 /* Load the VMM. We won't continue without it being successfully loaded here. */ 526 rc = i_loadVMM(); 527 AssertComRCReturnRC(rc); 528 520 529 rc = mMachine->COMGETTER(VRDEServer)(unconst(mVRDEServer).asOutParam()); 521 530 AssertComRCReturnRC(rc); … … 594 603 #endif 595 604 #ifdef VBOX_WITH_AUDIO_RECORDING 596 unconst( Recording.mAudioRec) = new AudioVideoRec(this);597 AssertReturn( Recording.mAudioRec, E_FAIL);605 unconst(mRecording.mAudioRec) = new AudioVideoRec(this); 606 AssertReturn(mRecording.mAudioRec, E_FAIL); 598 607 #endif 599 608 … … 728 737 i_recordingDestroy(); 729 738 # ifdef VBOX_WITH_AUDIO_RECORDING 730 if ( Recording.mAudioRec)731 { 732 delete Recording.mAudioRec;733 unconst( Recording.mAudioRec) = NULL;739 if (mRecording.mAudioRec) 740 { 741 delete mRecording.mAudioRec; 742 unconst(mRecording.mAudioRec) = NULL; 734 743 } 735 744 # endif … … 827 836 unconst(mptrExtPackManager).setNull(); 828 837 #endif 838 839 /* Unload the VMM. */ 840 mpVMM = NULL; 841 if (mhModVMM != NIL_RTLDRMOD) 842 { 843 RTLdrClose(mhModVMM); 844 mhModVMM = NIL_RTLDRMOD; 845 } 829 846 830 847 /* Release memory held by the LED sets. */ … … 1559 1576 /** 1560 1577 * Loads various console data stored in the saved state file. 1578 * 1561 1579 * This method does validation of the state file and returns an error info 1562 1580 * when appropriate. … … 1569 1587 HRESULT Console::i_loadDataFromSavedState() 1570 1588 { 1571 if ((mMachineState != MachineState_Saved && mMachineState != MachineState_AbortedSaved) || mSavedStateDataLoaded) 1589 if ( ( mMachineState != MachineState_Saved 1590 && mMachineState != MachineState_AbortedSaved) 1591 || mSavedStateDataLoaded) 1572 1592 return S_OK; 1573 1593 1574 Bstr savedStateFile; 1575 HRESULT rc = mMachine->COMGETTER(StateFilePath)(savedStateFile.asOutParam()); 1576 if (FAILED(rc)) 1577 return rc; 1578 1579 PSSMHANDLE ssm; 1580 int vrc = SSMR3Open(Utf8Str(savedStateFile).c_str(), 0, &ssm); 1581 if (RT_SUCCESS(vrc)) 1582 { 1583 uint32_t version = 0; 1584 vrc = SSMR3Seek(ssm, sSSMConsoleUnit, 0 /* iInstance */, &version); 1585 if (SSM_VERSION_MAJOR(version) == SSM_VERSION_MAJOR(CONSOLE_SAVED_STATE_VERSION)) 1586 { 1587 if (RT_SUCCESS(vrc)) 1588 vrc = i_loadStateFileExecInternal(ssm, version); 1589 else if (vrc == VERR_SSM_UNIT_NOT_FOUND) 1590 vrc = VINF_SUCCESS; 1591 } 1592 else 1593 vrc = VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 1594 1595 SSMR3Close(ssm); 1596 } 1597 1598 if (RT_FAILURE(vrc)) 1599 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, 1600 tr("The saved state file '%ls' is invalid (%Rrc). Delete the saved state and try again"), 1601 savedStateFile.raw(), vrc); 1602 1603 mSavedStateDataLoaded = true; 1604 1605 return rc; 1594 Bstr bstrSavedStateFile; 1595 HRESULT hrc = mMachine->COMGETTER(StateFilePath)(bstrSavedStateFile.asOutParam()); 1596 if (SUCCEEDED(hrc)) 1597 { 1598 Utf8Str const strSavedStateFile(bstrSavedStateFile); 1599 1600 PCVMMR3VTABLE pVMM = mpVMM; 1601 AssertPtrReturn(pVMM, E_UNEXPECTED); 1602 1603 PSSMHANDLE pSSM; 1604 int vrc = pVMM->pfnSSMR3Open(strSavedStateFile.c_str(), 0, &pSSM); 1605 if (RT_SUCCESS(vrc)) 1606 { 1607 uint32_t uVersion = 0; 1608 vrc = pVMM->pfnSSMR3Seek(pSSM, sSSMConsoleUnit, 0 /* iInstance */, &uVersion); 1609 /** @todo r=bird: This version check is premature, so the logic here is 1610 * buggered as we won't ignore VERR_SSM_UNIT_NOT_FOUND as seems to be 1611 * intended. Sigh. */ 1612 if (SSM_VERSION_MAJOR(uVersion) == SSM_VERSION_MAJOR(CONSOLE_SAVED_STATE_VERSION)) 1613 { 1614 if (RT_SUCCESS(vrc)) 1615 try 1616 { 1617 vrc = i_loadStateFileExecInternal(pSSM, pVMM, uVersion); 1618 } 1619 catch (std::bad_alloc &) 1620 { 1621 vrc = VERR_NO_MEMORY; 1622 } 1623 else if (vrc == VERR_SSM_UNIT_NOT_FOUND) 1624 vrc = VINF_SUCCESS; 1625 } 1626 else 1627 vrc = VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 1628 1629 pVMM->pfnSSMR3Close(pSSM); 1630 } 1631 1632 if (RT_FAILURE(vrc)) 1633 hrc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, 1634 tr("The saved state file '%s' is invalid (%Rrc). Delete the saved state and try again"), 1635 strSavedStateFile.c_str(), vrc); 1636 1637 mSavedStateDataLoaded = true; 1638 } 1639 1640 return hrc; 1606 1641 } 1607 1642 … … 1610 1645 * called when the user saves the VM state. 1611 1646 * 1612 * @param pSSM SSM handle. 1613 * @param pvUser pointer to Console 1614 * 1615 * @note Locks the Console object for reading. 1616 */ 1617 //static 1618 DECLCALLBACK(void) Console::i_saveStateFileExec(PSSMHANDLE pSSM, void *pvUser) 1647 * @returns VBox status code. 1648 * @param pSSM SSM handle. 1649 * @param pVMM The VMM ring-3 vtable. 1650 * @param pvUser Pointer to Console 1651 * 1652 * @note Locks the Console object for reading. 1653 */ 1654 /*static*/ DECLCALLBACK(int) 1655 Console::i_saveStateFileExec(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser) 1619 1656 { 1620 1657 LogFlowFunc(("\n")); 1621 1658 1622 Console * that = static_cast<Console *>(pvUser);1623 AssertReturn Void(that);1624 1625 AutoCaller autoCaller( that);1626 AssertComRCReturn Void(autoCaller.rc());1627 1628 AutoReadLock alock( that COMMA_LOCKVAL_SRC_POS);1629 1630 SSMR3PutU32(pSSM, (uint32_t)that->m_mapSharedFolders.size());1631 1632 for (SharedFolderMap::const_iterator it = that->m_mapSharedFolders.begin();1633 it != that->m_mapSharedFolders.end();1659 Console *pThat = static_cast<Console *>(pvUser); 1660 AssertReturn(pThat, VERR_INVALID_POINTER); 1661 1662 AutoCaller autoCaller(pThat); 1663 AssertComRCReturn(autoCaller.rc(), VERR_INVALID_STATE); 1664 1665 AutoReadLock alock(pThat COMMA_LOCKVAL_SRC_POS); 1666 1667 pVMM->pfnSSMR3PutU32(pSSM, (uint32_t)pThat->m_mapSharedFolders.size()); 1668 1669 for (SharedFolderMap::const_iterator it = pThat->m_mapSharedFolders.begin(); 1670 it != pThat->m_mapSharedFolders.end(); 1634 1671 ++it) 1635 1672 { … … 1639 1676 1640 1677 const Utf8Str &name = pSF->i_getName(); 1641 SSMR3PutU32(pSSM, (uint32_t)name.length() + 1 /* term. 0 */);1642 SSMR3PutStrZ(pSSM, name.c_str());1678 pVMM->pfnSSMR3PutU32(pSSM, (uint32_t)name.length() + 1 /* term. 0 */); 1679 pVMM->pfnSSMR3PutStrZ(pSSM, name.c_str()); 1643 1680 1644 1681 const Utf8Str &hostPath = pSF->i_getHostPath(); 1645 SSMR3PutU32(pSSM, (uint32_t)hostPath.length() + 1 /* term. 0 */);1646 SSMR3PutStrZ(pSSM, hostPath.c_str());1647 1648 SSMR3PutBool(pSSM, !!pSF->i_isWritable());1649 SSMR3PutBool(pSSM, !!pSF->i_isAutoMounted());1682 pVMM->pfnSSMR3PutU32(pSSM, (uint32_t)hostPath.length() + 1 /* term. 0 */); 1683 pVMM->pfnSSMR3PutStrZ(pSSM, hostPath.c_str()); 1684 1685 pVMM->pfnSSMR3PutBool(pSSM, !!pSF->i_isWritable()); 1686 pVMM->pfnSSMR3PutBool(pSSM, !!pSF->i_isAutoMounted()); 1650 1687 1651 1688 const Utf8Str &rStrAutoMountPoint = pSF->i_getAutoMountPoint(); 1652 SSMR3PutU32(pSSM, (uint32_t)rStrAutoMountPoint.length() + 1 /* term. 0 */); 1653 SSMR3PutStrZ(pSSM, rStrAutoMountPoint.c_str()); 1654 } 1689 pVMM->pfnSSMR3PutU32(pSSM, (uint32_t)rStrAutoMountPoint.length() + 1 /* term. 0 */); 1690 pVMM->pfnSSMR3PutStrZ(pSSM, rStrAutoMountPoint.c_str()); 1691 } 1692 1693 return VINF_SUCCESS; 1655 1694 } 1656 1695 1657 1696 /** 1658 1697 * Callback handler to load various console data from the state file. 1698 * 1659 1699 * Called when the VM is being restored from the saved state. 1660 1700 * 1661 * @param pSSM SSM handle. 1662 * @param pvUser pointer to Console 1663 * @param uVersion Console unit version. 1664 * Should match sSSMConsoleVer. 1665 * @param uPass The data pass. 1666 * 1667 * @note Should locks the Console object for writing, if necessary. 1701 * @returns VBox status code. 1702 * @param pSSM SSM handle. 1703 * @param pVMM The VMM ring-3 vtable. 1704 * @param pvUser pointer to Console 1705 * @param uVersion Console unit version. Should match sSSMConsoleVer. 1706 * @param uPass The data pass. 1668 1707 */ 1669 1708 //static 1670 1709 DECLCALLBACK(int) 1671 Console::i_loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass) 1672 { 1673 LogFlowFunc(("\n")); 1710 Console::i_loadStateFileExec(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, uint32_t uVersion, uint32_t uPass) 1711 { 1712 LogFlowFunc(("uVersion=%#x uPass=%#x\n", uVersion, uPass)); 1713 Assert(uPass == SSM_PASS_FINAL); RT_NOREF_PV(uPass); 1674 1714 1675 1715 if (SSM_VERSION_MAJOR_CHANGED(uVersion, CONSOLE_SAVED_STATE_VERSION)) 1676 1716 return VERR_VERSION_MISMATCH; 1677 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 1678 1679 Console *that = static_cast<Console *>(pvUser); 1680 AssertReturn(that, VERR_INVALID_PARAMETER); 1717 1718 Console *pThat = static_cast<Console *>(pvUser); 1719 AssertReturn(pThat, VERR_INVALID_PARAMETER); 1681 1720 1682 1721 /* Currently, nothing to do when we've been called from VMR3Load*. */ 1683 return SSMR3SkipToEndOfUnit(pSSM);1722 return pVMM->pfnSSMR3SkipToEndOfUnit(pSSM); 1684 1723 } 1685 1724 1686 1725 /** 1687 1726 * Method to load various console data from the state file. 1727 * 1688 1728 * Called from #i_loadDataFromSavedState. 1689 1729 * 1690 1730 * @param pSSM SSM handle. 1731 * @param pVMM The VMM vtable. 1691 1732 * @param u32Version Console unit version. 1692 1733 * Should match sSSMConsoleVer. … … 1694 1735 * @note Locks the Console object for writing. 1695 1736 */ 1696 int Console::i_loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version)1737 int Console::i_loadStateFileExecInternal(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t u32Version) 1697 1738 { 1698 1739 AutoCaller autoCaller(this); … … 1704 1745 1705 1746 uint32_t size = 0; 1706 int vrc = SSMR3GetU32(pSSM, &size);1747 int vrc = pVMM->pfnSSMR3GetU32(pSSM, &size); 1707 1748 AssertRCReturn(vrc, vrc); 1708 1749 … … 1717 1758 char *buf = NULL; 1718 1759 1719 vrc = SSMR3GetU32(pSSM, &cbStr);1760 vrc = pVMM->pfnSSMR3GetU32(pSSM, &cbStr); 1720 1761 AssertRCReturn(vrc, vrc); 1721 1762 buf = new char[cbStr]; 1722 vrc = SSMR3GetStrZ(pSSM, buf, cbStr);1763 vrc = pVMM->pfnSSMR3GetStrZ(pSSM, buf, cbStr); 1723 1764 AssertRC(vrc); 1724 1765 strName = buf; 1725 1766 delete[] buf; 1726 1767 1727 vrc = SSMR3GetU32(pSSM, &cbStr);1768 vrc = pVMM->pfnSSMR3GetU32(pSSM, &cbStr); 1728 1769 AssertRCReturn(vrc, vrc); 1729 1770 buf = new char[cbStr]; 1730 vrc = SSMR3GetStrZ(pSSM, buf, cbStr);1771 vrc = pVMM->pfnSSMR3GetStrZ(pSSM, buf, cbStr); 1731 1772 AssertRC(vrc); 1732 1773 strHostPath = buf; … … 1734 1775 1735 1776 if (u32Version >= CONSOLE_SAVED_STATE_VERSION_PRE_AUTO_MOUNT_POINT) 1736 SSMR3GetBool(pSSM, &writable);1777 pVMM->pfnSSMR3GetBool(pSSM, &writable); 1737 1778 1738 1779 if ( u32Version >= CONSOLE_SAVED_STATE_VERSION_PRE_AUTO_MOUNT_POINT 1739 1780 #ifndef VBOX_OSE /* This broke saved state when introduced in r63916 (4.0). */ 1740 && SSMR3HandleRevision(pSSM) >= 639161781 && pVMM->pfnSSMR3HandleRevision(pSSM) >= 63916 1741 1782 #endif 1742 1783 ) 1743 SSMR3GetBool(pSSM, &autoMount);1784 pVMM->pfnSSMR3GetBool(pSSM, &autoMount); 1744 1785 1745 1786 Utf8Str strAutoMountPoint; 1746 1787 if (u32Version >= CONSOLE_SAVED_STATE_VERSION) 1747 1788 { 1748 vrc = SSMR3GetU32(pSSM, &cbStr);1789 vrc = pVMM->pfnSSMR3GetU32(pSSM, &cbStr); 1749 1790 AssertRCReturn(vrc, vrc); 1750 1791 vrc = strAutoMountPoint.reserveNoThrow(cbStr); 1751 1792 AssertRCReturn(vrc, vrc); 1752 vrc = SSMR3GetStrZ(pSSM, strAutoMountPoint.mutableRaw(), cbStr);1793 vrc = pVMM->pfnSSMR3GetStrZ(pSSM, strAutoMountPoint.mutableRaw(), cbStr); 1753 1794 AssertRCReturn(vrc, vrc); 1754 1795 strAutoMountPoint.jolt(); … … 2263 2304 /* protect mpUVM */ 2264 2305 SafeVMPtr ptrVM(this); 2265 if (!ptrVM.isOk()) 2266 return ptrVM.rc(); 2267 2268 /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */ 2269 alock.release(); 2270 2271 int vrc = VMR3Reset(ptrVM.rawUVM()); 2272 2273 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not reset the machine (%Rrc)"), vrc); 2274 2275 LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc)); 2306 HRESULT hrc = ptrVM.rc(); 2307 if (SUCCEEDED(hrc)) 2308 { 2309 /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */ 2310 alock.release(); 2311 2312 int vrc = ptrVM.vtable()->pfnVMR3Reset(ptrVM.rawUVM()); 2313 2314 hrc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not reset the machine (%Rrc)"), vrc); 2315 } 2316 2317 LogFlowThisFunc(("mMachineState=%d, hrc=%Rhrc\n", mMachineState, hrc)); 2276 2318 LogFlowThisFuncLeave(); 2277 return rc;2278 } 2279 2280 /*static*/ DECLCALLBACK(int) Console::i_unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu)2319 return hrc; 2320 } 2321 2322 /*static*/ DECLCALLBACK(int) Console::i_unplugCpu(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, VMCPUID idCpu) 2281 2323 { 2282 2324 LogFlowFunc(("pThis=%p pVM=%p idCpu=%u\n", pThis, pUVM, idCpu)); … … 2284 2326 AssertReturn(pThis, VERR_INVALID_PARAMETER); 2285 2327 2286 int vrc = PDMR3DeviceDetach(pUVM, "acpi", 0, idCpu, 0);2328 int vrc = pVMM->pfnPDMR3DeviceDetach(pUVM, "acpi", 0, idCpu, 0); 2287 2329 Log(("UnplugCpu: rc=%Rrc\n", vrc)); 2288 2330 … … 2290 2332 } 2291 2333 2292 HRESULT Console::i_doCPURemove(ULONG aCpu, PUVM pUVM )2334 HRESULT Console::i_doCPURemove(ULONG aCpu, PUVM pUVM, PCVMMR3VTABLE pVMM) 2293 2335 { 2294 2336 HRESULT rc = S_OK; … … 2326 2368 /* Check if the CPU is unlocked */ 2327 2369 PPDMIBASE pBase; 2328 int vrc = PDMR3QueryDeviceLun(pUVM, "acpi", 0, aCpu, &pBase);2370 int vrc = pVMM->pfnPDMR3QueryDeviceLun(pUVM, "acpi", 0, aCpu, &pBase); 2329 2371 if (RT_SUCCESS(vrc)) 2330 2372 { … … 2334 2376 /* Notify the guest if possible. */ 2335 2377 uint32_t idCpuCore, idCpuPackage; 2336 vrc = VMR3GetCpuCoreAndPackageIdFromCpuId(pUVM, aCpu, &idCpuCore, &idCpuPackage); AssertRC(vrc);2378 vrc = pVMM->pfnVMR3GetCpuCoreAndPackageIdFromCpuId(pUVM, aCpu, &idCpuCore, &idCpuPackage); AssertRC(vrc); 2337 2379 if (RT_SUCCESS(vrc)) 2338 2380 vrc = pVmmDevPort->pfnCpuHotUnplug(pVmmDevPort, idCpuCore, idCpuPackage); … … 2366 2408 */ 2367 2409 PVMREQ pReq; 2368 vrc = VMR3ReqCallU(pUVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,2369 (PFNRT)i_unplugCpu, 3,2370 this, pUVM, (VMCPUID)aCpu);2410 vrc = pVMM->pfnVMR3ReqCallU(pUVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 2411 (PFNRT)i_unplugCpu, 4, 2412 this, pUVM, pVMM, (VMCPUID)aCpu); 2371 2413 2372 2414 if (vrc == VERR_TIMEOUT) 2373 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);2415 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 2374 2416 AssertRC(vrc); 2375 2417 if (RT_SUCCESS(vrc)) 2376 2418 vrc = pReq->iStatus; 2377 VMR3ReqFree(pReq);2419 pVMM->pfnVMR3ReqFree(pReq); 2378 2420 2379 2421 if (RT_SUCCESS(vrc)) 2380 2422 { 2381 2423 /* Detach it from the VM */ 2382 vrc = VMR3HotUnplugCpu(pUVM, aCpu);2424 vrc = pVMM->pfnVMR3HotUnplugCpu(pUVM, aCpu); 2383 2425 AssertRC(vrc); 2384 2426 } … … 2395 2437 } 2396 2438 2397 /*static*/ DECLCALLBACK(int) Console::i_plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu)2439 /*static*/ DECLCALLBACK(int) Console::i_plugCpu(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, VMCPUID idCpu) 2398 2440 { 2399 2441 LogFlowFunc(("pThis=%p uCpu=%u\n", pThis, idCpu)); 2400 2401 AssertReturn(pThis, VERR_INVALID_PARAMETER); 2402 2403 int rc = VMR3HotPlugCpu(pUVM, idCpu); 2442 RT_NOREF(pThis); 2443 2444 int rc = pVMM->pfnVMR3HotPlugCpu(pUVM, idCpu); 2404 2445 AssertRC(rc); 2405 2446 2406 PCFGMNODE pInst = CFGMR3GetChild(CFGMR3GetRootU(pUVM), "Devices/acpi/0/");2447 PCFGMNODE pInst = pVMM->pfnCFGMR3GetChild(pVMM->pfnCFGMR3GetRootU(pUVM), "Devices/acpi/0/"); 2407 2448 AssertRelease(pInst); 2408 2449 /* nuke anything which might have been left behind. */ 2409 CFGMR3RemoveNode(CFGMR3GetChildF(pInst, "LUN#%u", idCpu));2450 pVMM->pfnCFGMR3RemoveNode(pVMM->pfnCFGMR3GetChildF(pInst, "LUN#%u", idCpu)); 2410 2451 2411 2452 #define RC_CHECK() do { if (RT_FAILURE(rc)) { AssertReleaseRC(rc); break; } } while (0) … … 2413 2454 PCFGMNODE pLunL0; 2414 2455 PCFGMNODE pCfg; 2415 rc = CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%u", idCpu);RC_CHECK();2416 rc = CFGMR3InsertString(pLunL0, "Driver", "ACPICpu"); RC_CHECK();2417 rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg); RC_CHECK();2456 rc = pVMM->pfnCFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%u", idCpu); RC_CHECK(); 2457 rc = pVMM->pfnCFGMR3InsertString(pLunL0, "Driver", "ACPICpu"); RC_CHECK(); 2458 rc = pVMM->pfnCFGMR3InsertNode(pLunL0, "Config", &pCfg); RC_CHECK(); 2418 2459 2419 2460 /* … … 2421 2462 */ 2422 2463 PPDMIBASE pBase; 2423 rc = PDMR3DeviceAttach(pUVM, "acpi", 0, idCpu, 0, &pBase); RC_CHECK();2464 rc = pVMM->pfnPDMR3DeviceAttach(pUVM, "acpi", 0, idCpu, 0, &pBase); RC_CHECK(); 2424 2465 2425 2466 Log(("PlugCpu: rc=%Rrc\n", rc)); 2426 2467 2427 CFGMR3Dump(pInst);2468 pVMM->pfnCFGMR3Dump(pInst); 2428 2469 2429 2470 #undef RC_CHECK … … 2432 2473 } 2433 2474 2434 HRESULT Console::i_doCPUAdd(ULONG aCpu, PUVM pUVM )2475 HRESULT Console::i_doCPUAdd(ULONG aCpu, PUVM pUVM, PCVMMR3VTABLE pVMM) 2435 2476 { 2436 2477 HRESULT rc = S_OK; … … 2470 2511 */ 2471 2512 PVMREQ pReq; 2472 int vrc = VMR3ReqCallU(pUVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,2473 (PFNRT)i_plugCpu, 3,2474 this, pUVM, aCpu);2513 int vrc = pVMM->pfnVMR3ReqCallU(pUVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 2514 (PFNRT)i_plugCpu, 4, 2515 this, pUVM, pVMM, aCpu); 2475 2516 2476 2517 /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */ … … 2478 2519 2479 2520 if (vrc == VERR_TIMEOUT) 2480 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);2521 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 2481 2522 AssertRC(vrc); 2482 2523 if (RT_SUCCESS(vrc)) 2483 2524 vrc = pReq->iStatus; 2484 VMR3ReqFree(pReq);2525 pVMM->pfnVMR3ReqFree(pReq); 2485 2526 2486 2527 if (RT_SUCCESS(vrc)) … … 2488 2529 /* Notify the guest if possible. */ 2489 2530 uint32_t idCpuCore, idCpuPackage; 2490 vrc = VMR3GetCpuCoreAndPackageIdFromCpuId(pUVM, aCpu, &idCpuCore, &idCpuPackage); AssertRC(vrc);2531 vrc = pVMM->pfnVMR3GetCpuCoreAndPackageIdFromCpuId(pUVM, aCpu, &idCpuCore, &idCpuPackage); AssertRC(vrc); 2491 2532 if (RT_SUCCESS(vrc)) 2492 2533 vrc = pDevPort->pfnCpuHotPlug(pDevPort, idCpuCore, idCpuPackage); … … 2544 2585 /* get the VM handle. */ 2545 2586 SafeVMPtr ptrVM(this); 2546 if (!ptrVM.isOk()) 2547 return ptrVM.rc(); 2548 2549 // no need to release lock, as there are no cross-thread callbacks 2550 2551 /* get the acpi device interface and press the button. */ 2552 PPDMIBASE pBase; 2553 int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 2554 if (RT_SUCCESS(vrc)) 2555 { 2556 Assert(pBase); 2557 PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT); 2558 if (pPort) 2559 vrc = pPort->pfnPowerButtonPress(pPort); 2560 else 2561 vrc = VERR_PDM_MISSING_INTERFACE; 2562 } 2563 2564 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Controlled power off failed (%Rrc)"), vrc); 2565 2566 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 2587 HRESULT hrc = ptrVM.rc(); 2588 if (SUCCEEDED(hrc)) 2589 { 2590 // no need to release lock, as there are no cross-thread callbacks 2591 2592 /* get the acpi device interface and press the button. */ 2593 PPDMIBASE pBase = NULL; 2594 int vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 2595 if (RT_SUCCESS(vrc)) 2596 { 2597 Assert(pBase); 2598 PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT); 2599 if (pPort) 2600 vrc = pPort->pfnPowerButtonPress(pPort); 2601 else 2602 vrc = VERR_PDM_MISSING_INTERFACE; 2603 } 2604 2605 hrc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Controlled power off failed (%Rrc)"), vrc); 2606 } 2607 2608 LogFlowThisFunc(("hrc=%Rhrc\n", hrc)); 2567 2609 LogFlowThisFuncLeave(); 2568 return rc;2610 return hrc; 2569 2611 } 2570 2612 … … 2585 2627 /* get the VM handle. */ 2586 2628 SafeVMPtr ptrVM(this); 2587 if (!ptrVM.isOk()) 2588 return ptrVM.rc(); 2589 2590 // no need to release lock, as there are no cross-thread callbacks 2591 2592 /* get the acpi device interface and check if the button press was handled. */ 2593 PPDMIBASE pBase; 2594 int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 2595 if (RT_SUCCESS(vrc)) 2596 { 2597 Assert(pBase); 2598 PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT); 2599 if (pPort) 2600 { 2601 bool fHandled = false; 2602 vrc = pPort->pfnGetPowerButtonHandled(pPort, &fHandled); 2603 if (RT_SUCCESS(vrc)) 2604 *aHandled = fHandled; 2605 } 2606 else 2607 vrc = VERR_PDM_MISSING_INTERFACE; 2608 } 2609 2610 HRESULT rc = RT_SUCCESS(vrc) ? S_OK 2611 : setErrorBoth(VBOX_E_PDM_ERROR, vrc, 2612 tr("Checking if the ACPI Power Button event was handled by the guest OS failed (%Rrc)"), vrc); 2613 2614 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 2629 HRESULT hrc = ptrVM.rc(); 2630 if (SUCCEEDED(hrc)) 2631 { 2632 // no need to release lock, as there are no cross-thread callbacks 2633 2634 /* get the acpi device interface and check if the button press was handled. */ 2635 PPDMIBASE pBase; 2636 int vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 2637 if (RT_SUCCESS(vrc)) 2638 { 2639 Assert(pBase); 2640 PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT); 2641 if (pPort) 2642 { 2643 bool fHandled = false; 2644 vrc = pPort->pfnGetPowerButtonHandled(pPort, &fHandled); 2645 if (RT_SUCCESS(vrc)) 2646 *aHandled = fHandled; 2647 } 2648 else 2649 vrc = VERR_PDM_MISSING_INTERFACE; 2650 } 2651 2652 hrc = RT_SUCCESS(vrc) ? S_OK 2653 : setErrorBoth(VBOX_E_PDM_ERROR, vrc, 2654 tr("Checking if the ACPI Power Button event was handled by the guest OS failed (%Rrc)"), vrc); 2655 2656 } 2657 LogFlowThisFunc(("hrc=%Rhrc\n", hrc)); 2615 2658 LogFlowThisFuncLeave(); 2616 return rc;2659 return hrc; 2617 2660 } 2618 2661 … … 2635 2678 /* get the VM handle. */ 2636 2679 SafeVMPtr ptrVM(this); 2637 if (!ptrVM.isOk()) 2638 return ptrVM.rc(); 2639 2640 // no need to release lock, as there are no cross-thread callbacks 2641 2642 /* get the acpi device interface and query the information. */ 2643 PPDMIBASE pBase; 2644 int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 2645 if (RT_SUCCESS(vrc)) 2646 { 2647 Assert(pBase); 2648 PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT); 2649 if (pPort) 2650 { 2651 bool fEntered = false; 2652 vrc = pPort->pfnGetGuestEnteredACPIMode(pPort, &fEntered); 2653 if (RT_SUCCESS(vrc)) 2654 *aEntered = fEntered; 2655 } 2656 else 2657 vrc = VERR_PDM_MISSING_INTERFACE; 2680 HRESULT hrc = ptrVM.rc(); 2681 if (SUCCEEDED(hrc)) 2682 { 2683 // no need to release lock, as there are no cross-thread callbacks 2684 2685 /* get the acpi device interface and query the information. */ 2686 PPDMIBASE pBase; 2687 int vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 2688 if (RT_SUCCESS(vrc)) 2689 { 2690 Assert(pBase); 2691 PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT); 2692 if (pPort) 2693 { 2694 bool fEntered = false; 2695 vrc = pPort->pfnGetGuestEnteredACPIMode(pPort, &fEntered); 2696 if (RT_SUCCESS(vrc)) 2697 *aEntered = fEntered; 2698 } 2699 else 2700 vrc = VERR_PDM_MISSING_INTERFACE; 2701 } 2658 2702 } 2659 2703 2660 2704 LogFlowThisFuncLeave(); 2661 return S_OK;2705 return hrc; 2662 2706 } 2663 2707 … … 2675 2719 /* get the VM handle. */ 2676 2720 SafeVMPtr ptrVM(this); 2677 if (!ptrVM.isOk()) 2678 return ptrVM.rc(); 2679 2680 // no need to release lock, as there are no cross-thread callbacks 2681 2682 /* get the acpi device interface and press the sleep button. */ 2683 PPDMIBASE pBase; 2684 int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 2685 if (RT_SUCCESS(vrc)) 2686 { 2687 Assert(pBase); 2688 PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT); 2689 if (pPort) 2690 vrc = pPort->pfnSleepButtonPress(pPort); 2691 else 2692 vrc = VERR_PDM_MISSING_INTERFACE; 2693 } 2694 2695 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Sending sleep button event failed (%Rrc)"), vrc); 2696 2697 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 2721 HRESULT hrc = ptrVM.rc(); 2722 if (SUCCEEDED(hrc)) 2723 { 2724 // no need to release lock, as there are no cross-thread callbacks 2725 2726 /* get the acpi device interface and press the sleep button. */ 2727 PPDMIBASE pBase = NULL; 2728 int vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 2729 if (RT_SUCCESS(vrc)) 2730 { 2731 Assert(pBase); 2732 PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT); 2733 if (pPort) 2734 vrc = pPort->pfnSleepButtonPress(pPort); 2735 else 2736 vrc = VERR_PDM_MISSING_INTERFACE; 2737 } 2738 2739 hrc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Sending sleep button event failed (%Rrc)"), vrc); 2740 } 2741 2742 LogFlowThisFunc(("hrc=%Rhrc\n", hrc)); 2698 2743 LogFlowThisFuncLeave(); 2699 return rc;2744 return hrc; 2700 2745 } 2701 2746 … … 2710 2755 } 2711 2756 2712 HRESULT Console::getDeviceActivity(const std::vector<DeviceType_T> &aType, 2713 std::vector<DeviceActivity_T> &aActivity) 2757 HRESULT Console::getDeviceActivity(const std::vector<DeviceType_T> &aType, std::vector<DeviceActivity_T> &aActivity) 2714 2758 { 2715 2759 /* … … 2797 2841 /* Get the VM handle. */ 2798 2842 SafeVMPtr ptrVM(this); 2799 if (!ptrVM.isOk()) 2800 return ptrVM.rc(); 2801 2802 /* Don't proceed unless we have a USB controller. */ 2803 if (!mfVMHasUsbController) 2804 return setError(VBOX_E_PDM_ERROR, tr("The virtual machine does not have a USB controller")); 2805 2806 /* release the lock because the USB Proxy service may call us back 2807 * (via onUSBDeviceAttach()) */ 2808 alock.release(); 2809 2810 /* Request the device capture */ 2811 return mControl->CaptureUSBDevice(Bstr(aId.toString()).raw(), Bstr(aCaptureFilename).raw()); 2843 HRESULT hrc = ptrVM.rc(); 2844 if (SUCCEEDED(hrc)) 2845 { 2846 /* Don't proceed unless we have a USB controller. */ 2847 if (mfVMHasUsbController) 2848 { 2849 /* release the lock because the USB Proxy service may call us back 2850 * (via onUSBDeviceAttach()) */ 2851 alock.release(); 2852 2853 /* Request the device capture */ 2854 hrc = mControl->CaptureUSBDevice(Bstr(aId.toString()).raw(), Bstr(aCaptureFilename).raw()); 2855 } 2856 else 2857 hrc = setError(VBOX_E_PDM_ERROR, tr("The virtual machine does not have a USB controller")); 2858 } 2859 return hrc; 2812 2860 2813 2861 #else /* !VBOX_WITH_USB */ … … 2821 2869 RT_NOREF(aDevice); 2822 2870 #ifdef VBOX_WITH_USB 2823 2824 2871 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2825 2872 2826 2873 /* Find it. */ 2827 ComObjPtr<OUSBDevice> pUSBDevice; 2828 USBDeviceList::iterator it = mUSBDevices.begin(); 2829 while (it != mUSBDevices.end()) 2830 { 2874 for (USBDeviceList::iterator it = mUSBDevices.begin(); it != mUSBDevices.end(); ++it) 2831 2875 if ((*it)->i_id() == aId) 2832 2876 { 2833 pUSBDevice = *it; 2834 break; 2835 } 2836 ++it; 2837 } 2838 2839 if (!pUSBDevice) 2840 return setError(E_INVALIDARG, tr("USB device with UUID {%RTuuid} is not attached to this machine"), aId.raw()); 2841 2842 /* Remove the device from the collection, it is re-added below for failures */ 2843 mUSBDevices.erase(it); 2844 2845 /* 2846 * Inform the USB device and USB proxy about what's cooking. 2847 */ 2848 alock.release(); 2849 HRESULT rc = mControl->DetachUSBDevice(Bstr(aId.toString()).raw(), false /* aDone */); 2850 if (FAILED(rc)) 2851 { 2852 /* Re-add the device to the collection */ 2853 alock.acquire(); 2854 mUSBDevices.push_back(pUSBDevice); 2855 return rc; 2856 } 2857 2858 /* Request the PDM to detach the USB device. */ 2859 rc = i_detachUSBDevice(pUSBDevice); 2860 if (SUCCEEDED(rc)) 2861 { 2862 /* Request the device release. Even if it fails, the device will 2863 * remain as held by proxy, which is OK for us (the VM process). */ 2864 rc = mControl->DetachUSBDevice(Bstr(aId.toString()).raw(), true /* aDone */); 2865 } 2866 else 2867 { 2868 /* Re-add the device to the collection */ 2869 alock.acquire(); 2870 mUSBDevices.push_back(pUSBDevice); 2871 } 2872 2873 return rc; 2874 2877 /* Found it! */ 2878 ComObjPtr<OUSBDevice> pUSBDevice(*it); 2879 2880 /* Remove the device from the collection, it is re-added below for failures */ 2881 mUSBDevices.erase(it); 2882 2883 /* 2884 * Inform the USB device and USB proxy about what's cooking. 2885 */ 2886 alock.release(); 2887 HRESULT hrc = mControl->DetachUSBDevice(Bstr(aId.toString()).raw(), false /* aDone */); 2888 if (SUCCEEDED(hrc)) 2889 { 2890 /* Request the PDM to detach the USB device. */ 2891 hrc = i_detachUSBDevice(pUSBDevice); 2892 if (SUCCEEDED(hrc)) 2893 { 2894 /* Request the device release. Even if it fails, the device will 2895 * remain as held by proxy, which is OK for us (the VM process). */ 2896 return mControl->DetachUSBDevice(Bstr(aId.toString()).raw(), true /* aDone */); 2897 } 2898 } 2899 2900 /* Re-add the device to the collection */ 2901 alock.acquire(); 2902 mUSBDevices.push_back(pUSBDevice); 2903 return hrc; 2904 } 2905 2906 return setError(E_INVALIDARG, tr("USB device with UUID {%RTuuid} is not attached to this machine"), aId.raw()); 2875 2907 2876 2908 #else /* !VBOX_WITH_USB */ … … 2893 2925 for (size_t i = 0; i < devsvec.size(); ++i) 2894 2926 { 2895 Bstr address;2896 rc = devsvec[i]->COMGETTER(Address)( address.asOutParam());2927 Bstr bstrAddress; 2928 rc = devsvec[i]->COMGETTER(Address)(bstrAddress.asOutParam()); 2897 2929 if (FAILED(rc)) return rc; 2898 if ( address == Bstr(aName))2930 if (bstrAddress == aName) 2899 2931 { 2900 2932 ComObjPtr<OUSBDevice> pUSBDevice; … … 2923 2955 if (FAILED(rc)) return rc; 2924 2956 2957 Utf8Str const strId = aId.toString(); 2925 2958 for (size_t i = 0; i < devsvec.size(); ++i) 2926 2959 { … … 2928 2961 rc = devsvec[i]->COMGETTER(Id)(id.asOutParam()); 2929 2962 if (FAILED(rc)) return rc; 2930 if ( Utf8Str(id) == aId.toString())2963 if (id == strId) 2931 2964 { 2932 2965 ComObjPtr<OUSBDevice> pUSBDevice; … … 2938 2971 } 2939 2972 2940 return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND, tr("Could not find a USB device with uuid {%RTuuid}"), Guid(aId).raw());2973 return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND, tr("Could not find a USB device with uuid {%RTuuid}"), aId.raw()); 2941 2974 2942 2975 #else /* !VBOX_WITH_USB */ … … 3051 3084 ) 3052 3085 { 3053 /* if the VM is online and supports shared folders, UNshare this 3054 * folder. */ 3086 /* if the VM is online and supports shared folders, UNshare this folder. */ 3055 3087 3056 3088 /* first, remove the given folder */ … … 3118 3150 3119 3151 alock.release(); 3120 vrc = VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_RECONFIG);3152 vrc = ptrVM.vtable()->pfnVMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_RECONFIG); 3121 3153 3122 3154 hrc = RT_SUCCESS(vrc) ? S_OK … … 3266 3298 3267 3299 3268 /* static */ 3269 const char *Console::i_storageControllerTypeToStr(StorageControllerType_T enmCtrlType) 3300 /** 3301 * Converts to PDM device names. 3302 */ 3303 /* static */ const char *Console::i_storageControllerTypeToStr(StorageControllerType_T enmCtrlType) 3270 3304 { 3271 3305 switch (enmCtrlType) … … 3339 3373 * 3340 3374 * @param pUVM Safe VM handle. 3375 * @param pVMM Safe VMM vtable. 3341 3376 * @param pAlock The automatic lock instance. This is for when we have 3342 3377 * to leave it in order to avoid deadlocks. … … 3344 3379 * afterwards. 3345 3380 */ 3346 HRESULT Console::i_suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume)3381 HRESULT Console::i_suspendBeforeConfigChange(PUVM pUVM, PCVMMR3VTABLE pVMM, AutoWriteLock *pAlock, bool *pfResume) 3347 3382 { 3348 3383 *pfResume = false; 3349 VMSTATE enmVMState = VMR3GetStateU(pUVM); 3384 3385 VMSTATE enmVMState = pVMM->pfnVMR3GetStateU(pUVM); 3350 3386 switch (enmVMState) 3351 3387 { … … 3359 3395 if (pAlock) 3360 3396 pAlock->release(); 3361 int vrc = VMR3Suspend(pUVM, VMSUSPENDREASON_RECONFIG);3397 int vrc = pVMM->pfnVMR3Suspend(pUVM, VMSUSPENDREASON_RECONFIG); 3362 3398 if (pAlock) 3363 3399 pAlock->acquire(); … … 3384 3420 0 /* aResultDetail */, 3385 3421 tr("Invalid state '%s' for changing medium"), 3386 VMR3GetStateName(enmVMState));3422 pVMM->pfnVMR3GetStateName(enmVMState)); 3387 3423 } 3388 3424 … … 3395 3431 * 3396 3432 * @param pUVM Safe VM handle. 3397 */ 3398 void Console::i_resumeAfterConfigChange(PUVM pUVM) 3433 * @param pVMM Safe VMM vtable. 3434 */ 3435 void Console::i_resumeAfterConfigChange(PUVM pUVM, PCVMMR3VTABLE pVMM) 3399 3436 { 3400 3437 LogFlowFunc(("Resuming the VM...\n")); 3438 3401 3439 /* disable the callback to prevent Console-level state change */ 3402 3440 mVMStateChangeCallbackDisabled = true; 3403 int rc = VMR3Resume(pUVM, VMRESUMEREASON_RECONFIG);3441 int rc = pVMM->pfnVMR3Resume(pUVM, VMRESUMEREASON_RECONFIG); 3404 3442 mVMStateChangeCallbackDisabled = false; 3405 3443 AssertRC(rc); 3406 3444 if (RT_FAILURE(rc)) 3407 3445 { 3408 VMSTATE enmVMState = VMR3GetStateU(pUVM);3446 VMSTATE enmVMState = pVMM->pfnVMR3GetStateU(pUVM); 3409 3447 if (enmVMState == VMSTATE_SUSPENDED) 3410 3448 { 3411 3449 /* too bad, we failed. try to sync the console state with the VMM state */ 3412 i_vmstateChangeCallback(pUVM, VMSTATE_SUSPENDED, enmVMState, this);3450 i_vmstateChangeCallback(pUVM, pVMM, VMSTATE_SUSPENDED, enmVMState, this); 3413 3451 } 3414 3452 } … … 3421 3459 * @param fForce Force medium chance, if it is locked or not. 3422 3460 * @param pUVM Safe VM handle. 3461 * @param pVMM Safe VMM vtable. 3423 3462 * 3424 3463 * @note Locks this object for writing. 3425 3464 */ 3426 HRESULT Console::i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM )3465 HRESULT Console::i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM, PCVMMR3VTABLE pVMM) 3427 3466 { 3428 3467 AutoCaller autoCaller(this); … … 3487 3526 */ 3488 3527 bool fResume = false; 3489 rc = i_suspendBeforeConfigChange(pUVM, &alock, &fResume);3528 rc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume); 3490 3529 if (FAILED(rc)) 3491 3530 return rc; … … 3497 3536 */ 3498 3537 PVMREQ pReq; 3499 int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,3500 (PFNRT)i_changeRemovableMedium, 8,3501 this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fForce);3538 int vrc = pVMM->pfnVMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 3539 (PFNRT)i_changeRemovableMedium, 9, 3540 this, pUVM, pVMM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fForce); 3502 3541 3503 3542 /* release the lock before waiting for a result (EMT might wait for it, @bugref{7648})! */ … … 3505 3544 3506 3545 if (vrc == VERR_TIMEOUT) 3507 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);3546 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 3508 3547 AssertRC(vrc); 3509 3548 if (RT_SUCCESS(vrc)) 3510 3549 vrc = pReq->iStatus; 3511 VMR3ReqFree(pReq);3550 pVMM->pfnVMR3ReqFree(pReq); 3512 3551 3513 3552 if (fResume) 3514 i_resumeAfterConfigChange(pUVM );3553 i_resumeAfterConfigChange(pUVM, pVMM); 3515 3554 3516 3555 if (RT_SUCCESS(vrc)) … … 3532 3571 * @param pThis Pointer to the Console object. 3533 3572 * @param pUVM The VM handle. 3573 * @param pVMM The VMM vtable. 3534 3574 * @param pcszDevice The PDM device name. 3535 3575 * @param uInstance The PDM device instance. … … 3544 3584 DECLCALLBACK(int) Console::i_changeRemovableMedium(Console *pThis, 3545 3585 PUVM pUVM, 3586 PCVMMR3VTABLE pVMM, 3546 3587 const char *pcszDevice, 3547 3588 unsigned uInstance, … … 3562 3603 * Check the VM for correct state. 3563 3604 */ 3564 VMSTATE enmVMState = VMR3GetStateU(pUVM);3605 VMSTATE enmVMState = pVMM->pfnVMR3GetStateU(pUVM); 3565 3606 AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE); 3566 3607 … … 3581 3622 false /* fHotplug */, 3582 3623 pUVM, 3624 pVMM, 3583 3625 NULL /* paLedDevType */, 3584 3626 NULL /* ppLunL0 */); … … 3593 3635 * @param aMediumAttachment The medium attachment which is added. 3594 3636 * @param pUVM Safe VM handle. 3637 * @param pVMM Safe VMM vtable. 3595 3638 * @param fSilent Flag whether to notify the guest about the attached device. 3596 3639 * 3597 3640 * @note Locks this object for writing. 3598 3641 */ 3599 HRESULT Console::i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)3642 HRESULT Console::i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, PCVMMR3VTABLE pVMM, bool fSilent) 3600 3643 { 3601 3644 AutoCaller autoCaller(this); … … 3637 3680 } 3638 3681 if (pStorageController.isNull()) 3639 return setError(E_FAIL, 3640 tr("Could not find storage controller '%ls'"), attCtrlName.raw()); 3682 return setError(E_FAIL, tr("Could not find storage controller '%ls'"), attCtrlName.raw()); 3641 3683 3642 3684 StorageControllerType_T enmCtrlType; … … 3660 3702 */ 3661 3703 bool fResume = false; 3662 rc = i_suspendBeforeConfigChange(pUVM, &alock, &fResume);3704 rc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume); 3663 3705 if (FAILED(rc)) 3664 3706 return rc; … … 3670 3712 */ 3671 3713 PVMREQ pReq; 3672 int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,3673 (PFNRT)i_attachStorageDevice, 8,3674 this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fSilent);3714 int vrc = pVMM->pfnVMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 3715 (PFNRT)i_attachStorageDevice, 9, 3716 this, pUVM, pVMM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fSilent); 3675 3717 3676 3718 /* release the lock before waiting for a result (EMT might wait for it, @bugref{7648})! */ … … 3678 3720 3679 3721 if (vrc == VERR_TIMEOUT) 3680 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);3722 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 3681 3723 AssertRC(vrc); 3682 3724 if (RT_SUCCESS(vrc)) 3683 3725 vrc = pReq->iStatus; 3684 VMR3ReqFree(pReq);3726 pVMM->pfnVMR3ReqFree(pReq); 3685 3727 3686 3728 if (fResume) 3687 i_resumeAfterConfigChange(pUVM );3729 i_resumeAfterConfigChange(pUVM, pVMM); 3688 3730 3689 3731 if (RT_SUCCESS(vrc)) … … 3706 3748 * @param pThis Pointer to the Console object. 3707 3749 * @param pUVM The VM handle. 3750 * @param pVMM The VMM vtable. 3708 3751 * @param pcszDevice The PDM device name. 3709 3752 * @param uInstance The PDM device instance. … … 3718 3761 DECLCALLBACK(int) Console::i_attachStorageDevice(Console *pThis, 3719 3762 PUVM pUVM, 3763 PCVMMR3VTABLE pVMM, 3720 3764 const char *pcszDevice, 3721 3765 unsigned uInstance, … … 3736 3780 * Check the VM for correct state. 3737 3781 */ 3738 VMSTATE enmVMState = VMR3GetStateU(pUVM);3782 VMSTATE enmVMState = pVMM->pfnVMR3GetStateU(pUVM); 3739 3783 AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE); 3740 3784 … … 3755 3799 !fSilent /* fHotplug */, 3756 3800 pUVM, 3801 pVMM, 3757 3802 NULL /* paLedDevType */, 3758 3803 NULL); … … 3766 3811 * @param aMediumAttachment The medium attachment which is added. 3767 3812 * @param pUVM Safe VM handle. 3813 * @param pVMM Safe VMM vtable. 3768 3814 * @param fSilent Flag whether to notify the guest about the detached device. 3769 3815 * 3770 3816 * @note Locks this object for writing. 3771 3817 */ 3772 HRESULT Console::i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)3818 HRESULT Console::i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, PCVMMR3VTABLE pVMM, bool fSilent) 3773 3819 { 3774 3820 AutoCaller autoCaller(this); … … 3810 3856 } 3811 3857 if (pStorageController.isNull()) 3812 return setError(E_FAIL, 3813 tr("Could not find storage controller '%ls'"), attCtrlName.raw()); 3858 return setError(E_FAIL, tr("Could not find storage controller '%ls'"), attCtrlName.raw()); 3814 3859 3815 3860 StorageControllerType_T enmCtrlType; … … 3830 3875 */ 3831 3876 bool fResume = false; 3832 rc = i_suspendBeforeConfigChange(pUVM, &alock, &fResume);3877 rc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume); 3833 3878 if (FAILED(rc)) 3834 3879 return rc; … … 3840 3885 */ 3841 3886 PVMREQ pReq; 3842 int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,3843 (PFNRT)i_detachStorageDevice, 7,3844 this, pUVM, pszDevice, uInstance, enmBus, aMediumAttachment, fSilent);3887 int vrc = pVMM->pfnVMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 3888 (PFNRT)i_detachStorageDevice, 8, 3889 this, pUVM, pVMM, pszDevice, uInstance, enmBus, aMediumAttachment, fSilent); 3845 3890 3846 3891 /* release the lock before waiting for a result (EMT might wait for it, @bugref{7648})! */ … … 3848 3893 3849 3894 if (vrc == VERR_TIMEOUT) 3850 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);3895 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 3851 3896 AssertRC(vrc); 3852 3897 if (RT_SUCCESS(vrc)) 3853 3898 vrc = pReq->iStatus; 3854 VMR3ReqFree(pReq);3899 pVMM->pfnVMR3ReqFree(pReq); 3855 3900 3856 3901 if (fResume) 3857 i_resumeAfterConfigChange(pUVM );3902 i_resumeAfterConfigChange(pUVM, pVMM); 3858 3903 3859 3904 if (RT_SUCCESS(vrc)) … … 3875 3920 * @param pThis Pointer to the Console object. 3876 3921 * @param pUVM The VM handle. 3922 * @param pVMM The VMM vtable. 3877 3923 * @param pcszDevice The PDM device name. 3878 3924 * @param uInstance The PDM device instance. … … 3886 3932 DECLCALLBACK(int) Console::i_detachStorageDevice(Console *pThis, 3887 3933 PUVM pUVM, 3934 PCVMMR3VTABLE pVMM, 3888 3935 const char *pcszDevice, 3889 3936 unsigned uInstance, … … 3903 3950 * Check the VM for correct state. 3904 3951 */ 3905 VMSTATE enmVMState = VMR3GetStateU(pUVM);3952 VMSTATE enmVMState = pVMM->pfnVMR3GetStateU(pUVM); 3906 3953 AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE); 3907 3954 3908 3955 /* Determine the base path for the device instance. */ 3909 3956 PCFGMNODE pCtlInst; 3910 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance);3957 pCtlInst = pVMM->pfnCFGMR3GetChildF(pVMM->pfnCFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 3911 3958 AssertReturn(pCtlInst || enmBus == StorageBus_USB, VERR_INTERNAL_ERROR); 3912 3959 … … 3932 3979 { 3933 3980 /* First check if the LUN really exists. */ 3934 pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN);3981 pLunL0 = pVMM->pfnCFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN); 3935 3982 if (pLunL0) 3936 3983 { … … 3940 3987 fFlags |= PDM_TACH_FLAGS_NOT_HOT_PLUG; 3941 3988 3942 rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags);3989 rc = pVMM->pfnPDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags); 3943 3990 if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN) 3944 3991 rc = VINF_SUCCESS; 3945 3992 AssertRCReturn(rc, rc); 3946 CFGMR3RemoveNode(pLunL0);3993 pVMM->pfnCFGMR3RemoveNode(pLunL0); 3947 3994 3948 3995 Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN); … … 3953 4000 AssertFailedReturn(VERR_INTERNAL_ERROR); 3954 4001 3955 CFGMR3Dump(pCtlInst);4002 pVMM->pfnCFGMR3Dump(pCtlInst); 3956 4003 } 3957 4004 #ifdef VBOX_WITH_USB … … 3967 4014 3968 4015 AssertReturn(it != pThis->mUSBStorageDevices.end(), VERR_INTERNAL_ERROR); 3969 rc = PDMR3UsbDetachDevice(pUVM, &it->mUuid);4016 rc = pVMM->pfnPDMR3UsbDetachDevice(pUVM, &it->mUuid); 3970 4017 AssertRCReturn(rc, rc); 3971 4018 pThis->mUSBStorageDevices.erase(it); … … 4024 4071 alock.release(); 4025 4072 4026 PPDMIBASE pBase ;4027 int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase);4073 PPDMIBASE pBase = NULL; 4074 int vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase); 4028 4075 if (RT_SUCCESS(vrc)) 4029 4076 { … … 4042 4089 if (RT_SUCCESS(vrc) && changeAdapter) 4043 4090 { 4044 VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM());4091 VMSTATE enmVMState = mpVMM->pfnVMR3GetStateU(ptrVM.rawUVM()); 4045 4092 if ( enmVMState == VMSTATE_RUNNING /** @todo LiveMigration: Forbid or deal 4046 4093 correctly with the _LS variants */ … … 4053 4100 } 4054 4101 4055 rc = i_doNetworkAdapterChange(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, aNetworkAdapter); 4102 rc = i_doNetworkAdapterChange(ptrVM.rawUVM(), ptrVM.vtable(), pszAdapterName, 4103 ulInstance, 0, aNetworkAdapter); 4056 4104 4057 4105 if (fTraceEnabled && fCableConnected && pINetCfg) … … 4133 4181 const char *pszAdapterName = networkAdapterTypeToName(adapterType); 4134 4182 PPDMIBASE pBase; 4135 int vrc = PDMR3QueryLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase);4183 int vrc = ptrVM.vtable()->pfnPDMR3QueryLun(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, &pBase); 4136 4184 if (RT_FAILURE(vrc)) 4137 4185 { … … 4237 4285 ULONG ulInstanceMax = (ULONG)Global::getMaxNetworkAdapters(enmChipsetType); 4238 4286 4239 notifyNatDnsChange(ptrVM.rawUVM(), "pcnet", ulInstanceMax);4240 notifyNatDnsChange(ptrVM.rawUVM(), "e1000", ulInstanceMax);4241 notifyNatDnsChange(ptrVM.rawUVM(), "virtio-net", ulInstanceMax);4287 notifyNatDnsChange(ptrVM.rawUVM(), ptrVM.vtable(), "pcnet", ulInstanceMax); 4288 notifyNatDnsChange(ptrVM.rawUVM(), ptrVM.vtable(), "e1000", ulInstanceMax); 4289 notifyNatDnsChange(ptrVM.rawUVM(), ptrVM.vtable(), "virtio-net", ulInstanceMax); 4242 4290 } 4243 4291 } … … 4252 4300 * change callback. 4253 4301 */ 4254 void Console::notifyNatDnsChange(PUVM pUVM, const char *pszDevice, ULONG ulInstanceMax)4302 void Console::notifyNatDnsChange(PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDevice, ULONG ulInstanceMax) 4255 4303 { 4256 4304 Log(("notifyNatDnsChange: looking for DrvNAT attachment on %s device instances\n", pszDevice)); … … 4258 4306 { 4259 4307 PPDMIBASE pBase; 4260 int rc = PDMR3QueryDriverOnLun(pUVM, pszDevice, ulInstance, 0 /* iLun */, "NAT", &pBase);4308 int rc = pVMM->pfnPDMR3QueryDriverOnLun(pUVM, pszDevice, ulInstance, 0 /* iLun */, "NAT", &pBase); 4261 4309 if (RT_FAILURE(rc)) 4262 4310 continue; … … 4412 4460 PPDMIBASE pIBase = NULL; 4413 4461 PPDMIMEDIA pIMedium = NULL; 4414 int rc = PDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);4462 int rc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase); 4415 4463 if (RT_SUCCESS(rc)) 4416 4464 { … … 4524 4572 PPDMIBASE pIBase = NULL; 4525 4573 PPDMIMEDIA pIMedium = NULL; 4526 int rc = PDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);4574 int rc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase); 4527 4575 if (RT_SUCCESS(rc)) 4528 4576 { … … 4647 4695 PPDMIBASE pIBase = NULL; 4648 4696 PPDMIMEDIA pIMedium = NULL; 4649 int vrc = PDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);4697 int vrc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase); 4650 4698 if (RT_SUCCESS(vrc)) 4651 4699 { … … 4831 4879 * 4832 4880 * @param pUVM The VM handle (caller hold this safely). 4881 * @param pVMM The VMM vtable. 4833 4882 * @param pszDevice The PDM device name. 4834 4883 * @param uInstance The PDM device instance. … … 4836 4885 * @param aNetworkAdapter The network adapter whose attachment needs to be changed 4837 4886 */ 4838 HRESULT Console::i_doNetworkAdapterChange(PUVM pUVM, 4839 const char *pszDevice, 4840 unsigned uInstance, 4841 unsigned uLun, 4842 INetworkAdapter *aNetworkAdapter) 4887 HRESULT Console::i_doNetworkAdapterChange(PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDevice, 4888 unsigned uInstance, unsigned uLun, INetworkAdapter *aNetworkAdapter) 4843 4889 { 4844 4890 LogFlowThisFunc(("pszDevice=%p:{%s} uInstance=%u uLun=%u aNetworkAdapter=%p\n", … … 4852 4898 */ 4853 4899 bool fResume = false; 4854 HRESULT hr = i_suspendBeforeConfigChange(pUVM, NULL, &fResume);4900 HRESULT hr = i_suspendBeforeConfigChange(pUVM, pVMM, NULL, &fResume); 4855 4901 if (FAILED(hr)) 4856 4902 return hr; … … 4861 4907 * here to make requests from under the lock in order to serialize them. 4862 4908 */ 4863 int rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/,4864 (PFNRT)i_changeNetworkAttachment, 6,4865 this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);4909 int rc = pVMM->pfnVMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, 4910 (PFNRT)i_changeNetworkAttachment, 7, 4911 this, pUVM, pVMM, pszDevice, uInstance, uLun, aNetworkAdapter); 4866 4912 4867 4913 if (fResume) 4868 i_resumeAfterConfigChange(pUVM );4914 i_resumeAfterConfigChange(pUVM, pVMM); 4869 4915 4870 4916 if (RT_SUCCESS(rc)) … … 4882 4928 * @param pThis Pointer to the Console object. 4883 4929 * @param pUVM The VM handle. 4930 * @param pVMM The VMM vtable. 4884 4931 * @param pszDevice The PDM device name. 4885 4932 * @param uInstance The PDM device instance. … … 4893 4940 DECLCALLBACK(int) Console::i_changeNetworkAttachment(Console *pThis, 4894 4941 PUVM pUVM, 4942 PCVMMR3VTABLE pVMM, 4895 4943 const char *pszDevice, 4896 4944 unsigned uInstance, … … 4927 4975 * Check the VM for correct state. 4928 4976 */ 4929 VMSTATE enmVMState = VMR3GetStateU(pUVM);4930 AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE);4931 4932 4977 PCFGMNODE pCfg = NULL; /* /Devices/Dev/.../Config/ */ 4933 4978 PCFGMNODE pLunL0 = NULL; /* /Devices/Dev/0/LUN#0/ */ 4934 PCFGMNODE pInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%d/", pszDevice, uInstance);4979 PCFGMNODE pInst = pVMM->pfnCFGMR3GetChildF(pVMM->pfnCFGMR3GetRootU(pUVM), "Devices/%s/%d/", pszDevice, uInstance); 4935 4980 AssertRelease(pInst); 4936 4981 4937 4982 int rc = pThis->i_configNetwork(pszDevice, uInstance, uLun, aNetworkAdapter, pCfg, pLunL0, pInst, 4938 true /*fAttachDetach*/, false /*fIgnoreConnectFailure*/);4983 true /*fAttachDetach*/, false /*fIgnoreConnectFailure*/, pUVM, pVMM); 4939 4984 4940 4985 LogFlowFunc(("Returning %Rrc\n", rc)); … … 5001 5046 { 5002 5047 PPDMIBASE pBase; 5003 int rc2 = PDMR3QueryDriverOnLun(ptrVM.rawUVM(),5004 i_getAudioAdapterDeviceName(aAudioAdapter).c_str(), 0 /* iInstance */,5005 ulLUN, "AUDIO", &pBase);5048 int rc2 = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), 5049 i_getAudioAdapterDeviceName(aAudioAdapter).c_str(), 5050 0 /* iInstance */, ulLUN, "AUDIO", &pBase); 5006 5051 if (RT_FAILURE(rc2)) 5007 5052 continue; … … 5009 5054 if (pBase) 5010 5055 { 5011 PPDMIAUDIOCONNECTOR pAudioCon = 5012 (PPDMIAUDIOCONNECTOR)pBase->pfnQueryInterface(pBase, PDMIAUDIOCONNECTOR_IID); 5013 5056 PPDMIAUDIOCONNECTOR pAudioCon = (PPDMIAUDIOCONNECTOR)pBase->pfnQueryInterface(pBase, 5057 PDMIAUDIOCONNECTOR_IID); 5014 5058 if ( pAudioCon 5015 5059 && pAudioCon->pfnEnable) … … 5061 5105 * @param pThis Pointer to the Console object. 5062 5106 * @param pUVM The VM handle. 5107 * @param pVMM The VMM vtable. 5063 5108 * @param pSerialPort The serial port whose attachment needs to be changed 5064 5109 * … … 5067 5112 * @note The VM must not be running. 5068 5113 */ 5069 DECLCALLBACK(int) Console::i_changeSerialPortAttachment(Console *pThis, PUVM pUVM, 5070 ISerialPort *pSerialPort) 5114 DECLCALLBACK(int) Console::i_changeSerialPortAttachment(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, ISerialPort *pSerialPort) 5071 5115 { 5072 5116 LogFlowFunc(("pThis=%p pUVM=%p pSerialPort=%p\n", pThis, pUVM, pSerialPort)); … … 5082 5126 * Check the VM for correct state. 5083 5127 */ 5084 VMSTATE enmVMState = VMR3GetStateU(pUVM);5128 VMSTATE enmVMState = pVMM->pfnVMR3GetStateU(pUVM); 5085 5129 AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE); 5086 5130 … … 5098 5142 if (SUCCEEDED(hrc)) 5099 5143 { 5100 PCFGMNODE pInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/serial/%d/", ulSlot);5144 PCFGMNODE pInst = pVMM->pfnCFGMR3GetChildF(pVMM->pfnCFGMR3GetRootU(pUVM), "Devices/serial/%d/", ulSlot); 5101 5145 AssertRelease(pInst); 5102 5146 … … 5104 5148 if (pThis->m_aeSerialPortMode[ulSlot] != PortMode_Disconnected) 5105 5149 { 5106 rc = PDMR3DeviceDetach(pUVM, "serial", ulSlot, 0, 0);5107 PCFGMNODE pLunL0 = CFGMR3GetChildF(pInst, "LUN#0");5108 CFGMR3RemoveNode(pLunL0);5150 rc = pVMM->pfnPDMR3DeviceDetach(pUVM, "serial", ulSlot, 0, 0); 5151 PCFGMNODE pLunL0 = pVMM->pfnCFGMR3GetChildF(pInst, "LUN#0"); 5152 pVMM->pfnCFGMR3RemoveNode(pLunL0); 5109 5153 } 5110 5154 … … 5128 5172 */ 5129 5173 PPDMIBASE pBase; 5130 rc = PDMR3DeviceAttach(pUVM, "serial", ulSlot, 0, 0, &pBase);5131 5132 CFGMR3Dump(pInst);5174 rc = pVMM->pfnPDMR3DeviceAttach(pUVM, "serial", ulSlot, 0, 0, &pBase); 5175 5176 pVMM->pfnCFGMR3Dump(pInst); 5133 5177 } 5134 5178 } … … 5179 5223 */ 5180 5224 bool fResume = false; 5181 HRESULT hr = i_suspendBeforeConfigChange(ptrVM.rawUVM(), NULL, &fResume);5225 HRESULT hr = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), NULL, &fResume); 5182 5226 if (FAILED(hr)) 5183 5227 return hr; … … 5187 5231 * using VM3ReqCallWait. 5188 5232 */ 5189 int rc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /*idDstCpu*/,5190 (PFNRT)i_changeSerialPortAttachment, 6,5191 this, ptrVM.rawUVM(), aSerialPort);5233 int rc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /*idDstCpu*/, 5234 (PFNRT)i_changeSerialPortAttachment, 4, 5235 this, ptrVM.rawUVM(), ptrVM.vtable(), aSerialPort); 5192 5236 5193 5237 if (fResume) 5194 i_resumeAfterConfigChange(ptrVM.rawUVM() );5238 i_resumeAfterConfigChange(ptrVM.rawUVM(), ptrVM.vtable()); 5195 5239 if (RT_SUCCESS(rc)) 5196 5240 m_aeSerialPortMode[ulSlot] = eHostMode; … … 5256 5300 if (ptrVM.isOk()) 5257 5301 { 5258 rc = i_doMediumChange(aMediumAttachment, !!aForce, ptrVM.rawUVM() );5302 rc = i_doMediumChange(aMediumAttachment, !!aForce, ptrVM.rawUVM(), ptrVM.vtable()); 5259 5303 ptrVM.release(); 5260 5304 } … … 5287 5331 { 5288 5332 if (aRemove) 5289 rc = i_doCPURemove(aCPU, ptrVM.rawUVM() );5333 rc = i_doCPURemove(aCPU, ptrVM.rawUVM(), ptrVM.vtable()); 5290 5334 else 5291 rc = i_doCPUAdd(aCPU, ptrVM.rawUVM() );5335 rc = i_doCPUAdd(aCPU, ptrVM.rawUVM(), ptrVM.vtable()); 5292 5336 ptrVM.release(); 5293 5337 } … … 5327 5371 { 5328 5372 /* No need to call in the EMT thread. */ 5329 rc = VMR3SetCpuExecutionCap(ptrVM.rawUVM(), aExecutionCap);5373 rc = ptrVM.vtable()->pfnVMR3SetCpuExecutionCap(ptrVM.rawUVM(), aExecutionCap); 5330 5374 } 5331 5375 else … … 5575 5619 { 5576 5620 #ifdef VBOX_WITH_AUDIO_VRDE 5577 mAudioVRDE->doAttachDriverViaEmt( mpUVM, NULL /*alock is not held*/);5621 mAudioVRDE->doAttachDriverViaEmt(ptrVM.rawUVM(), ptrVM.vtable(), NULL /*alock is not held*/); 5578 5622 #endif 5579 5623 mConsoleVRDPServer->EnableConnections(); … … 5584 5628 mConsoleVRDPServer->Stop(); 5585 5629 #ifdef VBOX_WITH_AUDIO_VRDE 5586 mAudioVRDE->doDetachDriverViaEmt( mpUVM, NULL /*alock is not held*/);5630 mAudioVRDE->doDetachDriverViaEmt(ptrVM.rawUVM(), ptrVM.vtable(), NULL /*alock is not held*/); 5587 5631 #endif 5588 5632 } … … 5639 5683 /* get the acpi device interface and press the sleep button. */ 5640 5684 PPDMIBASE pBase; 5641 int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase);5685 int vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase); 5642 5686 if (RT_SUCCESS(vrc)) 5643 5687 { … … 5675 5719 if (pDisplay) 5676 5720 { 5677 const bool fIsEnabled = Recording.mpCtx5678 && Recording.mpCtx->IsStarted();5721 const bool fIsEnabled = mRecording.mpCtx 5722 && mRecording.mpCtx->IsStarted(); 5679 5723 5680 5724 if (RT_BOOL(fEnable) != fIsEnabled) … … 5682 5726 LogRel(("Recording: %s\n", fEnable ? "Enabling" : "Disabling")); 5683 5727 5684 if (fEnable) 5728 SafeVMPtrQuiet ptrVM(this); 5729 if (ptrVM.isOk()) 5685 5730 { 5686 vrc = i_recordingCreate(); 5687 if (RT_SUCCESS(vrc)) 5731 if (fEnable) 5688 5732 { 5733 vrc = i_recordingCreate(); 5734 if (RT_SUCCESS(vrc)) 5735 { 5689 5736 # ifdef VBOX_WITH_AUDIO_RECORDING 5690 /* Attach the video recording audio driver if required. */ 5691 if ( Recording.mpCtx->IsFeatureEnabled(RecordingFeature_Audio) 5692 && Recording.mAudioRec) 5693 { 5694 vrc = Recording.mAudioRec->applyConfiguration(Recording.mpCtx->GetConfig()); 5695 if (RT_SUCCESS(vrc)) 5696 vrc = Recording.mAudioRec->doAttachDriverViaEmt(mpUVM, pAutoLock); 5737 /* Attach the video recording audio driver if required. */ 5738 if ( mRecording.mpCtx->IsFeatureEnabled(RecordingFeature_Audio) 5739 && mRecording.mAudioRec) 5740 { 5741 vrc = mRecording.mAudioRec->applyConfiguration(mRecording.mpCtx->GetConfig()); 5742 if (RT_SUCCESS(vrc)) 5743 vrc = mRecording.mAudioRec->doAttachDriverViaEmt(ptrVM.rawUVM(), ptrVM.vtable(), pAutoLock); 5744 } 5745 # endif 5746 if ( RT_SUCCESS(vrc) 5747 && mRecording.mpCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */ 5748 { 5749 vrc = pDisplay->i_recordingInvalidate(); 5750 if (RT_SUCCESS(vrc)) 5751 vrc = i_recordingStart(pAutoLock); 5752 } 5697 5753 } 5754 5755 if (RT_FAILURE(vrc)) 5756 LogRel(("Recording: Failed to enable with %Rrc\n", vrc)); 5757 } 5758 else 5759 { 5760 i_recordingStop(pAutoLock); 5761 # ifdef VBOX_WITH_AUDIO_RECORDING 5762 if (mRecording.mAudioRec) 5763 mRecording.mAudioRec->doDetachDriverViaEmt(ptrVM.rawUVM(), ptrVM.vtable(), pAutoLock); 5698 5764 # endif 5699 if ( RT_SUCCESS(vrc) 5700 && Recording.mpCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */ 5701 { 5702 vrc = pDisplay->i_recordingInvalidate(); 5703 if (RT_SUCCESS(vrc)) 5704 vrc = i_recordingStart(pAutoLock); 5705 } 5765 i_recordingDestroy(); 5706 5766 } 5707 5708 if (RT_FAILURE(vrc))5709 LogRel(("Recording: Failed to enable with %Rrc\n", vrc));5710 5767 } 5711 5768 else 5712 { 5713 i_recordingStop(pAutoLock); 5714 # ifdef VBOX_WITH_AUDIO_RECORDING 5715 if (Recording.mAudioRec) 5716 Recording.mAudioRec->doDetachDriverViaEmt(mpUVM, pAutoLock); 5717 # endif 5718 i_recordingDestroy(); 5719 } 5769 vrc = VERR_VM_INVALID_VM_STATE; 5720 5770 5721 5771 if (RT_FAILURE(vrc)) … … 5837 5887 * (e.g. it may be Saving or Stopping or just PoweredOff) -- 5838 5888 * autoVMCaller.rc() will return a failure in this case. */ 5839 LogFlowThisFunc(("Attach request ignored (mMachineState=%d).\n", 5840 mMachineState)); 5889 LogFlowThisFunc(("Attach request ignored (mMachineState=%d).\n", mMachineState)); 5841 5890 return ptrVM.rc(); 5842 5891 } … … 5851 5900 5852 5901 /* Don't proceed unless there's at least one USB hub. */ 5853 if (! PDMR3UsbHasHub(ptrVM.rawUVM()))5902 if (!ptrVM.vtable()->pfnPDMR3UsbHasHub(ptrVM.rawUVM())) 5854 5903 { 5855 5904 LogFlowThisFunc(("Attach request ignored (no USB controller).\n")); … … 6000 6049 { 6001 6050 /* No need to call in the EMT thread. */ 6002 Bstr strName;6003 rc = aBandwidthGroup->COMGETTER(Name)( strName.asOutParam());6051 Bstr bstrName; 6052 rc = aBandwidthGroup->COMGETTER(Name)(bstrName.asOutParam()); 6004 6053 if (SUCCEEDED(rc)) 6005 6054 { 6055 Utf8Str const strName(bstrName); 6006 6056 LONG64 cMax; 6007 6057 rc = aBandwidthGroup->COMGETTER(MaxBytesPerSec)(&cMax); … … 6014 6064 int vrc = VINF_SUCCESS; 6015 6065 if (enmType == BandwidthGroupType_Disk) 6016 vrc = PDMR3AsyncCompletionBwMgrSetMaxForFile(ptrVM.rawUVM(), Utf8Str(strName).c_str(), (uint32_t)cMax); 6066 vrc = ptrVM.vtable()->pfnPDMR3AsyncCompletionBwMgrSetMaxForFile(ptrVM.rawUVM(), strName.c_str(), 6067 (uint32_t)cMax); 6017 6068 #ifdef VBOX_WITH_NETSHAPER 6018 6069 else if (enmType == BandwidthGroupType_Network) 6019 vrc = PDMR3NsBwGroupSetLimit(ptrVM.rawUVM(), Utf8Str(strName).c_str(), cMax);6070 vrc = ptrVM.vtable()->pfnPDMR3NsBwGroupSetLimit(ptrVM.rawUVM(), strName.c_str(), cMax); 6020 6071 else 6021 6072 rc = E_NOTIMPL; … … 6061 6112 { 6062 6113 if (aRemove) 6063 rc = i_doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM(), RT_BOOL(aSilent));6114 rc = i_doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM(), ptrVM.vtable(), RT_BOOL(aSilent)); 6064 6115 else 6065 rc = i_doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM(), RT_BOOL(aSilent));6116 rc = i_doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM(), ptrVM.vtable(), RT_BOOL(aSilent)); 6066 6117 ptrVM.release(); 6067 6118 } … … 6093 6144 { 6094 6145 mfTurnResetIntoPowerOff = aVal == "1"; 6095 int vrc = VMR3SetPowerOffInsteadOfReset(ptrVM.rawUVM(), mfTurnResetIntoPowerOff);6146 int vrc = ptrVM.vtable()->pfnVMR3SetPowerOffInsteadOfReset(ptrVM.rawUVM(), mfTurnResetIntoPowerOff); 6096 6147 AssertRC(vrc); 6097 6148 … … 6413 6464 /* Pause the VM, as it might have pending IO on this drive */ 6414 6465 bool fResume = false; 6415 rc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), &alock, &fResume);6466 rc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), &alock, &fResume); 6416 6467 if (FAILED(rc)) 6417 6468 return rc; … … 6426 6477 6427 6478 alock.release(); 6428 vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,6429 (PFNRT)i_reconfigureMediumAttachment, 14,6430 this, ptrVM.rawUVM(), pcszDevice, uInstance, enmBus, fUseHostIOCache,6431 fBuiltinIOCache, fInsertDiskIntegrityDrv, true /* fSetupMerge */,6432 aSourceIdx, aTargetIdx, aMediumAttachment, mMachineState, &rc);6479 vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, 6480 (PFNRT)i_reconfigureMediumAttachment, 15, 6481 this, ptrVM.rawUVM(), ptrVM.vtable(), pcszDevice, uInstance, enmBus, 6482 fUseHostIOCache, fBuiltinIOCache, fInsertDiskIntegrityDrv, true /* fSetupMerge */, 6483 aSourceIdx, aTargetIdx, aMediumAttachment, mMachineState, &rc); 6433 6484 /* error handling is after resuming the VM */ 6434 6485 6435 6486 if (fResume) 6436 i_resumeAfterConfigChange(ptrVM.rawUVM() );6487 i_resumeAfterConfigChange(ptrVM.rawUVM(), ptrVM.vtable()); 6437 6488 6438 6489 if (RT_FAILURE(vrc)) … … 6443 6494 PPDMIBASE pIBase = NULL; 6444 6495 PPDMIMEDIA pIMedium = NULL; 6445 vrc = PDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, uInstance, uLUN, "VD", &pIBase);6496 vrc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, uInstance, uLUN, "VD", &pIBase); 6446 6497 if (RT_SUCCESS(vrc)) 6447 6498 { … … 6463 6514 alock.acquire(); 6464 6515 /* Pause the VM, as it might have pending IO on this drive */ 6465 rc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), &alock, &fResume);6516 rc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), &alock, &fResume); 6466 6517 if (FAILED(rc)) 6467 6518 return rc; … … 6471 6522 rc = mControl->FinishOnlineMergeMedium(); 6472 6523 6473 vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, 6474 (PFNRT)i_reconfigureMediumAttachment, 14, 6475 this, ptrVM.rawUVM(), pcszDevice, uInstance, enmBus, fUseHostIOCache, 6476 fBuiltinIOCache, fInsertDiskIntegrityDrv, false /* fSetupMerge */, 6477 0 /* uMergeSource */, 0 /* uMergeTarget */, aMediumAttachment, 6478 mMachineState, &rc); 6524 vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, 6525 (PFNRT)i_reconfigureMediumAttachment, 15, 6526 this, ptrVM.rawUVM(), ptrVM.vtable(), pcszDevice, uInstance, enmBus, 6527 fUseHostIOCache, fBuiltinIOCache, fInsertDiskIntegrityDrv, false /* fSetupMerge */, 6528 0 /* uMergeSource */, 0 /* uMergeTarget */, aMediumAttachment, mMachineState, &rc); 6479 6529 /* error handling is after resuming the VM */ 6480 6530 6481 6531 if (fResume) 6482 i_resumeAfterConfigChange(ptrVM.rawUVM() );6532 i_resumeAfterConfigChange(ptrVM.rawUVM(), ptrVM.vtable()); 6483 6533 6484 6534 if (RT_FAILURE(vrc)) … … 6522 6572 throw rc; 6523 6573 6524 rc = mMachine->GetStorageControllerByName(controllerName.raw(), 6525 pStorageController.asOutParam()); 6574 rc = mMachine->GetStorageControllerByName(controllerName.raw(), pStorageController.asOutParam()); 6526 6575 if (FAILED(rc)) 6527 6576 throw rc; … … 6558 6607 6559 6608 IMediumAttachment *pAttachment = aAttachments[i]; 6560 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,6561 (PFNRT)i_reconfigureMediumAttachment, 14,6562 this, ptrVM.rawUVM(), pcszDevice, lInstance, enmBus, fUseHostIOCache,6563 fBuiltinIOCache, fInsertDiskIntegrityDrv,6564 false /* fSetupMerge */, 0 /* uMergeSource */, 0 /* uMergeTarget */,6565 pAttachment, mMachineState, &rc);6609 int vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, 6610 (PFNRT)i_reconfigureMediumAttachment, 15, 6611 this, ptrVM.rawUVM(), ptrVM.vtable(), pcszDevice, lInstance, enmBus, 6612 fUseHostIOCache, fBuiltinIOCache, fInsertDiskIntegrityDrv, 6613 false /* fSetupMerge */, 0 /* uMergeSource */, 0 /* uMergeTarget */, 6614 pAttachment, mMachineState, &rc); 6566 6615 if (RT_FAILURE(vrc)) 6567 6616 throw setErrorBoth(E_FAIL, vrc, "%Rrc", vrc); … … 6584 6633 6585 6634 RTPROCPRIORITY enmProcPriority = RTPROCPRIORITY_DEFAULT; 6586 switch (priority)6635 switch (priority) 6587 6636 { 6588 6637 case VMProcPriority_Default: … … 6606 6655 int vrc = RTProcSetPriority(enmProcPriority); 6607 6656 if (RT_FAILURE(vrc)) 6608 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not set the priority of the process (%Rrc). Try to set it when VM is not started."), vrc); 6657 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, 6658 tr("Could not set the priority of the process (%Rrc). Try to set it when VM is not started."), vrc); 6609 6659 6610 6660 return rc; … … 6675 6725 /* get the VM handle. */ 6676 6726 SafeVMPtr ptrVM(this); 6677 if (!ptrVM.isOk()) 6678 return ptrVM.rc(); 6679 6680 /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */ 6681 alock.release(); 6682 6683 LogFlowThisFunc(("Sending PAUSE request...\n")); 6684 if (aReason != Reason_Unspecified) 6685 LogRel(("Pausing VM execution, reason '%s'\n", ::stringifyReason(aReason))); 6686 6687 /** @todo r=klaus make use of aReason */ 6688 VMSUSPENDREASON enmReason = VMSUSPENDREASON_USER; 6689 if (aReason == Reason_HostSuspend) 6690 enmReason = VMSUSPENDREASON_HOST_SUSPEND; 6691 else if (aReason == Reason_HostBatteryLow) 6692 enmReason = VMSUSPENDREASON_HOST_BATTERY_LOW; 6693 int vrc = VMR3Suspend(ptrVM.rawUVM(), enmReason); 6694 6695 HRESULT hrc = S_OK; 6696 if (RT_FAILURE(vrc)) 6697 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not suspend the machine execution (%Rrc)"), vrc); 6698 else if ( aReason == Reason_HostSuspend 6699 || aReason == Reason_HostBatteryLow) 6700 { 6701 alock.acquire(); 6702 i_removeSecretKeysOnSuspend(); 6727 HRESULT hrc = ptrVM.rc(); 6728 if (SUCCEEDED(hrc)) 6729 { 6730 /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */ 6731 alock.release(); 6732 6733 LogFlowThisFunc(("Sending PAUSE request...\n")); 6734 if (aReason != Reason_Unspecified) 6735 LogRel(("Pausing VM execution, reason '%s'\n", ::stringifyReason(aReason))); 6736 6737 /** @todo r=klaus make use of aReason */ 6738 VMSUSPENDREASON enmReason = VMSUSPENDREASON_USER; 6739 if (aReason == Reason_HostSuspend) 6740 enmReason = VMSUSPENDREASON_HOST_SUSPEND; 6741 else if (aReason == Reason_HostBatteryLow) 6742 enmReason = VMSUSPENDREASON_HOST_BATTERY_LOW; 6743 6744 int vrc = ptrVM.vtable()->pfnVMR3Suspend(ptrVM.rawUVM(), enmReason); 6745 6746 if (RT_FAILURE(vrc)) 6747 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not suspend the machine execution (%Rrc)"), vrc); 6748 else if ( aReason == Reason_HostSuspend 6749 || aReason == Reason_HostBatteryLow) 6750 { 6751 alock.acquire(); 6752 i_removeSecretKeysOnSuspend(); 6753 } 6703 6754 } 6704 6755 … … 6732 6783 6733 6784 int vrc; 6734 if (VMR3GetStateU(ptrVM.rawUVM()) == VMSTATE_CREATED) 6785 VMSTATE const enmVMState = mpVMM->pfnVMR3GetStateU(ptrVM.rawUVM()); 6786 if (enmVMState == VMSTATE_CREATED) 6735 6787 { 6736 6788 #ifdef VBOX_WITH_EXTPACK 6737 vrc = mptrExtPackManager->i_callAllVmPowerOnHooks(this, VMR3GetVM(ptrVM.rawUVM()));6789 vrc = mptrExtPackManager->i_callAllVmPowerOnHooks(this, ptrVM.vtable()->pfnVMR3GetVM(ptrVM.rawUVM())); 6738 6790 #else 6739 6791 vrc = VINF_SUCCESS; 6740 6792 #endif 6741 6793 if (RT_SUCCESS(vrc)) 6742 vrc = VMR3PowerOn(ptrVM.rawUVM()); /* (PowerUpPaused) */6794 vrc = ptrVM.vtable()->pfnVMR3PowerOn(ptrVM.rawUVM()); /* (PowerUpPaused) */ 6743 6795 } 6744 6796 else … … 6754 6806 * Also, don't resume the VM through a host-resume unless it was suspended due to a host-suspend. 6755 6807 */ 6756 if ( VMR3GetStateU(ptrVM.rawUVM())!= VMSTATE_SUSPENDED)6808 if (enmVMState != VMSTATE_SUSPENDED) 6757 6809 { 6758 LogRel(("Ignoring VM resume request, VM is currently not suspended \n"));6810 LogRel(("Ignoring VM resume request, VM is currently not suspended (%d)\n", enmVMState)); 6759 6811 return S_OK; 6760 6812 } 6761 if (VMR3GetSuspendReason(ptrVM.rawUVM()) != VMSUSPENDREASON_HOST_SUSPEND) 6813 VMSUSPENDREASON const enmSuspendReason = ptrVM.vtable()->pfnVMR3GetSuspendReason(ptrVM.rawUVM()); 6814 if (enmSuspendReason != VMSUSPENDREASON_HOST_SUSPEND) 6762 6815 { 6763 LogRel(("Ignoring VM resume request, VM was not suspended due to host-suspend \n"));6816 LogRel(("Ignoring VM resume request, VM was not suspended due to host-suspend (%d)\n", enmSuspendReason)); 6764 6817 return S_OK; 6765 6818 } … … 6773 6826 * See @bugref{7836}. 6774 6827 */ 6775 if ( VMR3GetStateU(ptrVM.rawUVM())== VMSTATE_SUSPENDED6776 && VMR3GetSuspendReason(ptrVM.rawUVM()) == VMSUSPENDREASON_HOST_SUSPEND)6828 if ( enmVMState == VMSTATE_SUSPENDED 6829 && ptrVM.vtable()->pfnVMR3GetSuspendReason(ptrVM.rawUVM()) == VMSUSPENDREASON_HOST_SUSPEND) 6777 6830 return setError(VBOX_E_INVALID_VM_STATE, tr("VM is paused due to host power management")); 6778 6831 … … 6783 6836 if (aReason == Reason_Snapshot) 6784 6837 mVMStateChangeCallbackDisabled = true; 6785 vrc = VMR3Resume(ptrVM.rawUVM(), enmReason); 6838 6839 vrc = ptrVM.vtable()->pfnVMR3Resume(ptrVM.rawUVM(), enmReason); 6840 6786 6841 if (aReason == Reason_Snapshot) 6787 6842 mVMStateChangeCallbackDisabled = false; 6788 6843 } 6789 6844 6790 HRESULT rc = RT_SUCCESS(vrc) ? S_OK6791 : setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not resume the machine execution (%Rrc)"), vrc);6792 6793 LogFlowThisFunc((" rc=%Rhrc\n",rc));6845 HRESULT hrc = RT_SUCCESS(vrc) ? S_OK 6846 : setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not resume the machine execution (%Rrc)"), vrc); 6847 6848 LogFlowThisFunc(("hrc=%Rhrc\n", hrc)); 6794 6849 LogFlowThisFuncLeave(); 6795 return rc;6850 return hrc; 6796 6851 } 6797 6852 … … 6806 6861 * @note Locks this object for writing. 6807 6862 */ 6808 HRESULT Console::i_saveState(Reason_T aReason, const ComPtr<IProgress> &aProgress, 6809 const ComPtr<ISnapshot> &aSnapshot, 6863 HRESULT Console::i_saveState(Reason_T aReason, const ComPtr<IProgress> &aProgress, const ComPtr<ISnapshot> &aSnapshot, 6810 6864 const Utf8Str &aStateFilePath, bool aPauseVM, bool &aLeftPaused) 6811 6865 { … … 6828 6882 && mMachineState != MachineState_Teleporting 6829 6883 && mMachineState != MachineState_TeleportingPausedVM) 6830 {6831 6884 return setError(VBOX_E_INVALID_VM_STATE, 6832 6885 tr("Cannot save the execution state as the machine is not running or paused (machine state: %s)"), 6833 6886 Global::stringifyMachineState(mMachineState)); 6834 }6835 6887 bool fContinueAfterwards = mMachineState != MachineState_Saving; 6836 6888 … … 6859 6911 /* Get the VM handle early, we need it in several places. */ 6860 6912 SafeVMPtr ptrVM(this); 6861 if (!ptrVM.isOk()) 6862 return ptrVM.rc(); 6863 6864 bool fPaused = false; 6865 if (aPauseVM) 6866 { 6867 /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */ 6868 alock.release(); 6869 VMSUSPENDREASON enmReason = VMSUSPENDREASON_USER; 6870 if (aReason == Reason_HostSuspend) 6871 enmReason = VMSUSPENDREASON_HOST_SUSPEND; 6872 else if (aReason == Reason_HostBatteryLow) 6873 enmReason = VMSUSPENDREASON_HOST_BATTERY_LOW; 6874 int vrc = VMR3Suspend(ptrVM.rawUVM(), enmReason); 6875 alock.acquire(); 6876 6877 if (RT_FAILURE(vrc)) 6878 return setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not suspend the machine execution (%Rrc)"), vrc); 6879 fPaused = true; 6880 } 6881 6882 LogFlowFunc(("Saving the state to '%s'...\n", aStateFilePath.c_str())); 6883 6884 mpVmm2UserMethods->pISnapshot = aSnapshot; 6885 mptrCancelableProgress = aProgress; 6886 alock.release(); 6887 int vrc = VMR3Save(ptrVM.rawUVM(), 6888 aStateFilePath.c_str(), 6889 fContinueAfterwards, 6890 Console::i_stateProgressCallback, 6891 static_cast<IProgress *>(aProgress), 6892 &aLeftPaused); 6893 alock.acquire(); 6894 mpVmm2UserMethods->pISnapshot = NULL; 6895 mptrCancelableProgress.setNull(); 6896 if (RT_FAILURE(vrc)) 6897 { 6898 if (fPaused) 6899 { 6913 HRESULT hrc = ptrVM.rc(); 6914 if (SUCCEEDED(hrc)) 6915 { 6916 bool fPaused = false; 6917 if (aPauseVM) 6918 { 6919 /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */ 6900 6920 alock.release(); 6901 VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_STATE_RESTORED); 6921 VMSUSPENDREASON enmReason = VMSUSPENDREASON_USER; 6922 if (aReason == Reason_HostSuspend) 6923 enmReason = VMSUSPENDREASON_HOST_SUSPEND; 6924 else if (aReason == Reason_HostBatteryLow) 6925 enmReason = VMSUSPENDREASON_HOST_BATTERY_LOW; 6926 int vrc = ptrVM.vtable()->pfnVMR3Suspend(ptrVM.rawUVM(), enmReason); 6902 6927 alock.acquire(); 6903 } 6904 return setErrorBoth(E_FAIL, vrc, tr("Failed to save the machine state to '%s' (%Rrc)"), aStateFilePath.c_str(), vrc); 6905 } 6906 Assert(fContinueAfterwards || !aLeftPaused); 6907 6908 if (!fContinueAfterwards) 6909 { 6910 /* 6911 * The machine has been successfully saved, so power it down 6912 * (vmstateChangeCallback() will set state to Saved on success). 6913 * Note: we release the VM caller, otherwise it will deadlock. 6914 */ 6915 ptrVM.release(); 6916 alock.release(); 6917 autoCaller.release(); 6918 HRESULT rc = i_powerDown(); 6919 AssertComRC(rc); 6920 autoCaller.add(); 6921 alock.acquire(); 6922 } 6923 else 6924 { 6925 if (fPaused) 6926 aLeftPaused = true; 6928 6929 if (RT_SUCCESS(vrc)) 6930 fPaused = true; 6931 else 6932 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not suspend the machine execution (%Rrc)"), vrc); 6933 } 6934 if (SUCCEEDED(hrc)) 6935 { 6936 LogFlowFunc(("Saving the state to '%s'...\n", aStateFilePath.c_str())); 6937 6938 mpVmm2UserMethods->pISnapshot = aSnapshot; 6939 mptrCancelableProgress = aProgress; 6940 alock.release(); 6941 6942 int vrc = ptrVM.vtable()->pfnVMR3Save(ptrVM.rawUVM(), 6943 aStateFilePath.c_str(), 6944 fContinueAfterwards, 6945 Console::i_stateProgressCallback, 6946 static_cast<IProgress *>(aProgress), 6947 &aLeftPaused); 6948 6949 alock.acquire(); 6950 mpVmm2UserMethods->pISnapshot = NULL; 6951 mptrCancelableProgress.setNull(); 6952 if (RT_SUCCESS(vrc)) 6953 { 6954 Assert(fContinueAfterwards || !aLeftPaused); 6955 6956 if (!fContinueAfterwards) 6957 { 6958 /* 6959 * The machine has been successfully saved, so power it down 6960 * (vmstateChangeCallback() will set state to Saved on success). 6961 * Note: we release the VM caller, otherwise it will deadlock. 6962 */ 6963 ptrVM.release(); 6964 alock.release(); 6965 autoCaller.release(); 6966 6967 HRESULT rc = i_powerDown(); 6968 AssertComRC(rc); 6969 6970 autoCaller.add(); 6971 alock.acquire(); 6972 } 6973 else if (fPaused) 6974 aLeftPaused = true; 6975 } 6976 else 6977 { 6978 if (fPaused) 6979 { 6980 alock.release(); 6981 ptrVM.vtable()->pfnVMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_STATE_RESTORED); 6982 alock.acquire(); 6983 } 6984 hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to save the machine state to '%s' (%Rrc)"), 6985 aStateFilePath.c_str(), vrc); 6986 } 6987 } 6927 6988 } 6928 6989 … … 6947 7008 /* Get the VM handle. */ 6948 7009 SafeVMPtr ptrVM(this); 6949 if (!ptrVM.isOk()) 6950 return ptrVM.rc(); 6951 6952 SSMR3Cancel(ptrVM.rawUVM()); 7010 HRESULT hrc = ptrVM.rc(); 7011 if (SUCCEEDED(hrc)) 7012 ptrVM.vtable()->pfnSSMR3Cancel(ptrVM.rawUVM()); 6953 7013 6954 7014 LogFlowFuncLeave(); 6955 return S_OK;7015 return hrc; 6956 7016 } 6957 7017 … … 6967 7027 HRESULT Console::i_recordingSendAudio(const void *pvData, size_t cbData, uint64_t uTimestampMs) 6968 7028 { 6969 if (! Recording.mpCtx)7029 if (!mRecording.mpCtx) 6970 7030 return S_OK; 6971 7031 6972 if ( Recording.mpCtx->IsStarted() 6973 && Recording.mpCtx->IsFeatureEnabled(RecordingFeature_Audio)) 6974 { 6975 return Recording.mpCtx->SendAudioFrame(pvData, cbData, uTimestampMs); 6976 } 7032 if ( mRecording.mpCtx->IsStarted() 7033 && mRecording.mpCtx->IsFeatureEnabled(RecordingFeature_Audio)) 7034 return mRecording.mpCtx->SendAudioFrame(pvData, cbData, uTimestampMs); 6977 7035 6978 7036 return S_OK; … … 6981 7039 6982 7040 #ifdef VBOX_WITH_RECORDING 7041 6983 7042 int Console::i_recordingGetSettings(settings::RecordingSettings &Settings) 6984 7043 { … … 7043 7102 int Console::i_recordingCreate(void) 7044 7103 { 7045 AssertReturn( Recording.mpCtx == NULL, VERR_WRONG_ORDER);7104 AssertReturn(mRecording.mpCtx == NULL, VERR_WRONG_ORDER); 7046 7105 7047 7106 settings::RecordingSettings recordingSettings; … … 7051 7110 try 7052 7111 { 7053 Recording.mpCtx = new RecordingContext(this /* pConsole */, recordingSettings);7112 mRecording.mpCtx = new RecordingContext(this /* pConsole */, recordingSettings); 7054 7113 } 7055 7114 catch (std::bad_alloc &) … … 7072 7131 void Console::i_recordingDestroy(void) 7073 7132 { 7074 if ( Recording.mpCtx)7075 { 7076 delete Recording.mpCtx;7077 Recording.mpCtx = NULL;7133 if (mRecording.mpCtx) 7134 { 7135 delete mRecording.mpCtx; 7136 mRecording.mpCtx = NULL; 7078 7137 } 7079 7138 … … 7089 7148 { 7090 7149 RT_NOREF(pAutoLock); 7091 AssertPtrReturn( Recording.mpCtx, VERR_WRONG_ORDER);7092 7093 if ( Recording.mpCtx->IsStarted())7150 AssertPtrReturn(mRecording.mpCtx, VERR_WRONG_ORDER); 7151 7152 if (mRecording.mpCtx->IsStarted()) 7094 7153 return VINF_SUCCESS; 7095 7154 7096 7155 LogRel(("Recording: Starting ...\n")); 7097 7156 7098 int rc = Recording.mpCtx->Start();7157 int rc = mRecording.mpCtx->Start(); 7099 7158 if (RT_SUCCESS(rc)) 7100 7159 { 7101 for (unsigned uScreen = 0; uScreen < Recording.mpCtx->GetStreamCount(); uScreen++)7160 for (unsigned uScreen = 0; uScreen < mRecording.mpCtx->GetStreamCount(); uScreen++) 7102 7161 mDisplay->i_recordingScreenChanged(uScreen); 7103 7162 } … … 7112 7171 int Console::i_recordingStop(util::AutoWriteLock *pAutoLock /* = NULL */) 7113 7172 { 7114 if ( ! Recording.mpCtx7115 || ! Recording.mpCtx->IsStarted())7173 if ( !mRecording.mpCtx 7174 || !mRecording.mpCtx->IsStarted()) 7116 7175 return VINF_SUCCESS; 7117 7176 7118 7177 LogRel(("Recording: Stopping ...\n")); 7119 7178 7120 int rc = Recording.mpCtx->Stop();7179 int rc = mRecording.mpCtx->Stop(); 7121 7180 if (RT_SUCCESS(rc)) 7122 7181 { 7123 const size_t cStreams = Recording.mpCtx->GetStreamCount();7182 const size_t cStreams = mRecording.mpCtx->GetStreamCount(); 7124 7183 for (unsigned uScreen = 0; uScreen < cStreams; ++uScreen) 7125 7184 mDisplay->i_recordingScreenChanged(uScreen); … … 7141 7200 return rc; 7142 7201 } 7202 7143 7203 #endif /* VBOX_WITH_RECORDING */ 7144 7204 … … 7194 7254 7195 7255 MachineState_T enmMachineState = MachineState_Null; 7196 VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM());7256 VMSTATE enmVMState = ptrVM.vtable()->pfnVMR3GetStateU(ptrVM.rawUVM()); 7197 7257 switch (enmVMState) 7198 7258 { … … 7245 7305 break; 7246 7306 default: 7247 AssertMsgFailed(("%s\n", VMR3GetStateName(enmVMState)));7307 AssertMsgFailed(("%s\n", ptrVM.vtable()->pfnVMR3GetStateName(enmVMState))); 7248 7308 enmMachineState = MachineState_PoweredOff; 7249 7309 } … … 7270 7330 7271 7331 if (!mMouse.isNull()) 7272 mMouse->updateMousePointerShape(fVisible, fAlpha, xHot, yHot, width, height, 7273 pu8Shape, cbShape); 7332 mMouse->updateMousePointerShape(fVisible, fAlpha, xHot, yHot, width, height, pu8Shape, cbShape); 7274 7333 7275 7334 com::SafeArray<BYTE> shape(cbShape); … … 7287 7346 { 7288 7347 LogFlowThisFunc(("supportsAbsolute=%d supportsRelative=%d needsHostCursor=%d\n", 7289 7348 supportsAbsolute, supportsRelative, needsHostCursor)); 7290 7349 7291 7350 AutoCaller autoCaller(this); … … 7419 7478 7420 7479 /** 7480 * Loads the VMM if needed. 7481 * 7482 * @returns COM status. 7483 * @remarks Caller must write lock the console object. 7484 */ 7485 HRESULT Console::i_loadVMM(void) RT_NOEXCEPT 7486 { 7487 if ( mhModVMM == NIL_RTLDRMOD 7488 || mpVMM == NULL) 7489 { 7490 Assert(!mpVMM); 7491 7492 HRESULT hrc; 7493 RTERRINFOSTATIC ErrInfo; 7494 RTLDRMOD hModVMM = NIL_RTLDRMOD; 7495 int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxVMM", &hModVMM, RTLDRLOAD_FLAGS_LOCAL, RTErrInfoInitStatic(&ErrInfo)); 7496 if (RT_SUCCESS(vrc)) 7497 { 7498 PFNVMMGETVTABLE pfnGetVTable = NULL; 7499 vrc = RTLdrGetSymbol(hModVMM, VMMR3VTABLE_GETTER_NAME, (void **)&pfnGetVTable); 7500 if (pfnGetVTable) 7501 { 7502 PCVMMR3VTABLE pVMM = pfnGetVTable(); 7503 if (pVMM) 7504 { 7505 if (VMMR3VTABLE_IS_COMPATIBLE(pVMM->uMagicVersion)) 7506 { 7507 if (pVMM->uMagicVersion == pVMM->uMagicVersionEnd) 7508 { 7509 mhModVMM = hModVMM; 7510 mpVMM = pVMM; 7511 LogFunc(("mhLdrVMM=%p phVMM=%p uMagicVersion=%#RX64\n", hModVMM, pVMM, pVMM->uMagicVersion)); 7512 return S_OK; 7513 } 7514 7515 hrc = setErrorVrc(vrc, "Bogus VMM vtable: uMagicVersion=%#RX64 uMagicVersionEnd=%#RX64", 7516 pVMM->uMagicVersion, pVMM->uMagicVersionEnd); 7517 } 7518 else 7519 hrc = setErrorVrc(vrc, "Incompatible of bogus VMM version magic: %#RX64", pVMM->uMagicVersion); 7520 } 7521 else 7522 hrc = setErrorVrc(vrc, "pfnGetVTable return NULL!"); 7523 } 7524 else 7525 hrc = setErrorVrc(vrc, "Failed to locate symbol '%s' in VBoxVMM: %Rrc", VMMR3VTABLE_GETTER_NAME, vrc); 7526 RTLdrClose(hModVMM); 7527 } 7528 else 7529 hrc = setErrorVrc(vrc, "Failed to load VBoxVMM: %#RTeic", &ErrInfo.Core); 7530 return hrc; 7531 } 7532 7533 return S_OK; 7534 } 7535 7536 /** 7421 7537 * Increases the usage counter of the mpUVM pointer. 7422 7538 * … … 7502 7618 7503 7619 7504 HRESULT Console::i_safeVMPtrRetainer(PUVM *a_ppUVM, bool a_Quiet) 7620 /** 7621 * Helper for SafeVMPtrBase. 7622 */ 7623 HRESULT Console::i_safeVMPtrRetainer(PUVM *a_ppUVM, PCVMMR3VTABLE *a_ppVMM, bool a_Quiet) RT_NOEXCEPT 7505 7624 { 7506 7625 *a_ppUVM = NULL; 7626 *a_ppVMM = NULL; 7507 7627 7508 7628 AutoCaller autoCaller(this); … … 7517 7637 ? E_ACCESSDENIED 7518 7638 : setError(E_ACCESSDENIED, tr("The virtual machine is being powered down")); 7519 PUVM pUVM = mpUVM;7639 PUVM const pUVM = mpUVM; 7520 7640 if (!pUVM) 7521 7641 return a_Quiet 7522 7642 ? E_ACCESSDENIED 7523 7643 : setError(E_ACCESSDENIED, tr("The virtual machine is powered off")); 7644 PCVMMR3VTABLE const pVMM = mpVMM; 7645 if (!pVMM) 7646 return a_Quiet 7647 ? E_ACCESSDENIED 7648 : setError(E_ACCESSDENIED, tr("No VMM loaded!")); 7524 7649 7525 7650 /* 7526 7651 * Retain a reference to the user mode VM handle and get the global handle. 7527 7652 */ 7528 uint32_t cRefs = VMR3RetainUVM(pUVM);7653 uint32_t cRefs = pVMM->pfnVMR3RetainUVM(pUVM); 7529 7654 if (cRefs == UINT32_MAX) 7530 7655 return a_Quiet … … 7534 7659 /* done */ 7535 7660 *a_ppUVM = pUVM; 7661 *a_ppVMM = pVMM; 7536 7662 return S_OK; 7537 7663 } … … 7539 7665 void Console::i_safeVMPtrReleaser(PUVM *a_ppUVM) 7540 7666 { 7541 if (*a_ppUVM) 7542 VMR3ReleaseUVM(*a_ppUVM); 7667 PUVM const pUVM = *a_ppUVM; 7543 7668 *a_ppUVM = NULL; 7669 if (pUVM) 7670 { 7671 PCVMMR3VTABLE const pVMM = mpVMM; 7672 if (pVMM) 7673 pVMM->pfnVMR3ReleaseUVM(pUVM); 7674 } 7544 7675 } 7545 7676 … … 7675 7806 #endif 7676 7807 7808 PCVMMR3VTABLE const pVMM = mpVMM; 7809 AssertPtrReturn(pVMM, E_UNEXPECTED); 7810 7677 7811 ComObjPtr<Progress> pPowerupProgress; 7678 7812 bool fBeganPoweringUp = false; … … 7697 7831 progressDesc = tr("Starting virtual machine"); 7698 7832 7699 Bstr savedStateFile;7700 7701 7833 /* 7702 7834 * Saved VMs will have to prove that their saved states seem kosher. 7703 7835 */ 7836 Utf8Str strSavedStateFile; 7704 7837 if (mMachineState == MachineState_Saved || mMachineState == MachineState_AbortedSaved) 7705 7838 { 7706 rc = mMachine->COMGETTER(StateFilePath)(savedStateFile.asOutParam()); 7839 Bstr bstrSavedStateFile; 7840 rc = mMachine->COMGETTER(StateFilePath)(bstrSavedStateFile.asOutParam()); 7707 7841 if (FAILED(rc)) 7708 7842 throw rc; 7709 ComAssertRet(!savedStateFile.isEmpty(), E_FAIL); 7710 int vrc = SSMR3ValidateFile(Utf8Str(savedStateFile).c_str(), false /* fChecksumIt */); 7843 strSavedStateFile = bstrSavedStateFile; 7844 7845 ComAssertRet(bstrSavedStateFile.isNotEmpty(), E_FAIL); 7846 int vrc = pVMM->pfnSSMR3ValidateFile(strSavedStateFile.c_str(), false /* fChecksumIt */); 7711 7847 if (RT_FAILURE(vrc)) 7712 7848 { … … 7715 7851 { 7716 7852 case VERR_FILE_NOT_FOUND: 7717 errMsg = Utf8StrFmt(tr("VM failed to start because the saved state file '%ls' does not exist."),7718 savedStateFile.raw());7853 errMsg.printf(tr("VM failed to start because the saved state file '%ls' does not exist."), 7854 strSavedStateFile.c_str()); 7719 7855 break; 7720 7856 default: 7721 errMsg = Utf8StrFmt(tr("VM failed to start because the saved state file '%ls' is invalid (%Rrc). "7722 "Delete the saved state prior to starting the VM."), savedStateFile.raw(), vrc);7857 errMsg.printf(tr("VM failed to start because the saved state file '%ls' is invalid (%Rrc). " 7858 "Delete the saved state prior to starting the VM."), strSavedStateFile.c_str(), vrc); 7723 7859 break; 7724 7860 } … … 7778 7914 throw task->rc(); 7779 7915 7780 task->m ConfigConstructor = i_configConstructor;7916 task->mpfnConfigConstructor = i_configConstructor; 7781 7917 task->mSharedFolders = sharedFolders; 7782 7918 task->mStartPaused = aPaused; 7783 7919 if (mMachineState == MachineState_Saved || mMachineState == MachineState_AbortedSaved) 7784 try { task->mSavedStateFile = s avedStateFile; }7920 try { task->mSavedStateFile = strSavedStateFile; } 7785 7921 catch (std::bad_alloc &) { throw rc = E_OUTOFMEMORY; } 7786 7922 task->mTeleporterEnabled = fTeleporterEnabled; … … 7807 7943 } 7808 7944 7809 if (s avedStateFile.isEmpty() && !fCurrentSnapshotIsOnline)7945 if (strSavedStateFile.isEmpty() && !fCurrentSnapshotIsOnline) 7810 7946 { 7811 7947 LogFlowThisFunc(("Looking for immutable images to reset\n")); … … 7894 8030 vrc = RTDirCreateFullPath(pszDumpDir, 0700); 7895 8031 if (RT_FAILURE(vrc)) 7896 throw setErrorBoth(E_FAIL, vrc, "Failed to setup CoreDumper. Couldn't create dump directory '%s' (%Rrc)\n",8032 throw setErrorBoth(E_FAIL, vrc, tr("Failed to setup CoreDumper. Couldn't create dump directory '%s' (%Rrc)"), 7897 8033 pszDumpDir, vrc); 7898 8034 } … … 7900 8036 vrc = RTCoreDumperSetup(pszDumpDir, fCoreFlags); 7901 8037 if (RT_FAILURE(vrc)) 7902 throw setErrorBoth(E_FAIL, vrc, "Failed to setup CoreDumper (%Rrc)", vrc);8038 throw setErrorBoth(E_FAIL, vrc, tr("Failed to setup CoreDumper (%Rrc)"), vrc); 7903 8039 LogRel(("CoreDumper setup successful. pszDumpDir=%s fFlags=%#x\n", pszDumpDir ? pszDumpDir : ".", fCoreFlags)); 7904 8040 } … … 7920 8056 cOperations, 7921 8057 ulTotalOperationsWeight, 7922 Bstr(tr("Starting Hard Disk operations")).raw(),8058 tr("Starting Hard Disk operations"), 7923 8059 1); 7924 8060 AssertComRCReturnRC(rc); … … 7927 8063 || mMachineState == MachineState_AbortedSaved 7928 8064 || !fTeleporterEnabled) 7929 {7930 8065 rc = pPowerupProgress->init(static_cast<IConsole *>(this), 7931 8066 progressDesc.raw(), 7932 8067 FALSE /* aCancelable */); 7933 }7934 8068 else if (fTeleporterEnabled) 7935 {7936 8069 rc = pPowerupProgress->init(static_cast<IConsole *>(this), 7937 8070 progressDesc.raw(), … … 7939 8072 3 /* cOperations */, 7940 8073 10 /* ulTotalOperationsWeight */, 7941 Bstr(tr("Teleporting virtual machine")).raw(),8074 tr("Teleporting virtual machine"), 7942 8075 1 /* ulFirstOperationWeight */); 7943 }7944 8076 7945 8077 if (FAILED(rc)) … … 8009 8141 pVirtualBox->COMGETTER(Host)(pHost.asOutParam()); 8010 8142 ComPtr<IHostNetworkInterface> pHostInterface; 8011 if (!SUCCEEDED(pHost->FindHostNetworkInterfaceByName(hostif.raw(), 8012 pHostInterface.asOutParam()))) 8013 { 8143 if (!SUCCEEDED(pHost->FindHostNetworkInterfaceByName(hostif.raw(), pHostInterface.asOutParam()))) 8014 8144 throw setError(VBOX_E_HOST_ERROR, 8015 8145 tr("VM cannot start because the host interface '%ls' does not exist"), hostif.raw()); 8016 }8017 8146 break; 8018 8147 } … … 8131 8260 Assert(mVMDestroying == false); 8132 8261 8133 PUVM pUVM = mpUVM; Assert(pUVM != NULL); 8134 uint32_t cRefs = VMR3RetainUVM(pUVM); Assert(cRefs != UINT32_MAX); NOREF(cRefs); 8262 PCVMMR3VTABLE const pVMM = mpVMM; 8263 AssertPtrReturn(pVMM, E_UNEXPECTED); 8264 PUVM pUVM = mpUVM; 8265 AssertPtrReturn(pUVM, E_UNEXPECTED); 8266 8267 uint32_t cRefs = pVMM->pfnVMR3RetainUVM(pUVM); 8268 Assert(cRefs != UINT32_MAX); NOREF(cRefs); 8135 8269 8136 8270 AssertMsg( mMachineState == MachineState_Running … … 8252 8386 LogFlowThisFunc(("Powering off the VM...\n")); 8253 8387 alock.release(); 8254 vrc = VMR3PowerOff(pUVM);8388 vrc = pVMM->pfnVMR3PowerOff(pUVM); 8255 8389 #ifdef VBOX_WITH_EXTPACK 8256 mptrExtPackManager->i_callAllVmPowerOffHooks(this, VMR3GetVM(pUVM));8390 mptrExtPackManager->i_callAllVmPowerOffHooks(this, pVMM->pfnVMR3GetVM(pUVM)); 8257 8391 #endif 8258 8392 alock.acquire(); … … 8318 8452 /* Set mpUVM to NULL early just in case if some old code is not using 8319 8453 * addVMCaller()/releaseVMCaller(). (We have our own ref on pUVM.) */ 8320 VMR3ReleaseUVM(mpUVM);8454 pVMM->pfnVMR3ReleaseUVM(mpUVM); 8321 8455 mpUVM = NULL; 8322 8456 … … 8325 8459 alock.release(); 8326 8460 8327 vrc = VMR3Destroy(pUVM);8461 vrc = pVMM->pfnVMR3Destroy(pUVM); 8328 8462 8329 8463 /* take the lock again */ … … 8378 8512 */ 8379 8513 if (pUVM != NULL) 8380 VMR3ReleaseUVM(pUVM);8514 pVMM->pfnVMR3ReleaseUVM(pUVM); 8381 8515 else 8382 8516 mVMDestroying = false; … … 8389 8523 * @note Locks this object for writing. 8390 8524 */ 8391 HRESULT Console::i_setMachineState(MachineState_T aMachineState, 8392 bool aUpdateServer /* = true */) 8525 HRESULT Console::i_setMachineState(MachineState_T aMachineState, bool aUpdateServer /* = true */) 8393 8526 { 8394 8527 AutoCaller autoCaller(this); … … 8454 8587 * @note The caller must lock this object for writing. 8455 8588 */ 8456 HRESULT Console::i_findSharedFolder(const Utf8Str &strName, 8457 ComObjPtr<SharedFolder> &aSharedFolder, 8458 bool aSetError /* = false */) 8589 HRESULT Console::i_findSharedFolder(const Utf8Str &strName, ComObjPtr<SharedFolder> &aSharedFolder, bool aSetError /* = false */) 8459 8590 { 8460 8591 /* sanity check */ … … 8470 8601 if (aSetError) 8471 8602 setError(VBOX_E_FILE_ERROR, tr("Could not find a shared folder named '%s'."), strName.c_str()); 8472 8473 8603 return VBOX_E_FILE_ERROR; 8474 8604 } … … 8689 8819 this also checks that the length is within bounds of a SHFLSTRING. */ 8690 8820 if (RTPathCompare(aData.m_strHostPath.c_str(), szAbsHostPath) != 0) 8691 return setError(E_INVALIDARG, 8692 tr("Shared folder path '%s' is not absolute"), 8693 aData.m_strHostPath.c_str()); 8821 return setError(E_INVALIDARG, tr("Shared folder path '%s' is not absolute"), aData.m_strHostPath.c_str()); 8694 8822 8695 8823 bool const fMissing = !RTPathExists(szAbsHostPath); … … 8699 8827 */ 8700 8828 if (strName.length() >= _2K) 8701 return setError(E_INVALIDARG, tr("Shared folder name is too long: %zu bytes", "", strName.length()), 8702 strName.length()); 8829 return setError(E_INVALIDARG, tr("Shared folder name is too long: %zu bytes", "", strName.length()), strName.length()); 8703 8830 if (aData.m_strAutoMountPoint.length() >= RTPATH_MAX) 8704 8831 return setError(E_INVALIDARG, tr("Shared folder mount point too long: %zu bytes", "", … … 8731 8858 8732 8859 else if (fMissing) 8733 hrc = setError(E_INVALIDARG, 8734 tr("Shared folder path '%s' does not exist on the host"), 8735 aData.m_strHostPath.c_str()); 8860 hrc = setError(E_INVALIDARG, tr("Shared folder path '%s' does not exist on the host"), aData.m_strHostPath.c_str()); 8736 8861 else 8737 8862 hrc = S_OK; … … 8782 8907 parms.u.pointer.size = ShflStringSizeOfBuffer(pMapName); 8783 8908 8784 int vrc = m_pVMMDev->hgcmHostCall("VBoxSharedFolders", 8785 SHFL_FN_REMOVE_MAPPING, 8786 1, &parms); 8909 int vrc = m_pVMMDev->hgcmHostCall("VBoxSharedFolders", SHFL_FN_REMOVE_MAPPING, 1, &parms); 8787 8910 RTMemFree(pMapName); 8788 8911 if (RT_FAILURE(vrc)) … … 8798 8921 * calls after the VM was destroyed. 8799 8922 */ 8800 DECLCALLBACK(void) Console::i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser) 8923 /*static*/ DECLCALLBACK(void) 8924 Console::i_vmstateChangeCallback(PUVM pUVM, PCVMMR3VTABLE pVMM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser) 8801 8925 { 8802 8926 LogFlowFunc(("Changing state from %s to %s (pUVM=%p)\n", 8803 VMR3GetStateName(enmOldState), VMR3GetStateName(enmState), pUVM)); 8927 pVMM->pfnVMR3GetStateName(enmOldState), pVMM->pfnVMR3GetStateName(enmState), pUVM)); 8928 RT_NOREF(pVMM); 8804 8929 8805 8930 Console *that = static_cast<Console *>(pvUser); … … 9073 9198 default: 9074 9199 AssertMsgFailed(("%s/%s -> %s\n", ::stringifyMachineState(that->mMachineState), 9075 VMR3GetStateName(enmOldState),VMR3GetStateName(enmState) ));9200 pVMM->pfnVMR3GetStateName(enmOldState), pVMM->pfnVMR3GetStateName(enmState) )); 9076 9201 that->i_setMachineState(MachineState_Paused); 9077 9202 break; … … 9110 9235 || that->mMachineState == MachineState_Teleporting, 9111 9236 ("%s/%s -> %s\n", ::stringifyMachineState(that->mMachineState), 9112 VMR3GetStateName(enmOldState),VMR3GetStateName(enmState) ));9237 pVMM->pfnVMR3GetStateName(enmOldState), pVMM->pfnVMR3GetStateName(enmState) )); 9113 9238 break; 9114 9239 … … 9271 9396 } 9272 9397 9273 int rc = pVMMDev->hgcmHostCall("VBoxDragAndDropSvc", 9274 DragAndDropSvc::HOST_DND_FN_SET_MODE, 1 /* cParms */, &parm); 9398 int rc = pVMMDev->hgcmHostCall("VBoxDragAndDropSvc", DragAndDropSvc::HOST_DND_FN_SET_MODE, 1 /* cParms */, &parm); 9275 9399 if (RT_FAILURE(rc)) 9276 9400 LogRel(("Error changing drag and drop mode: %Rrc\n", rc)); … … 9289 9413 * @note Synchronously calls EMT. 9290 9414 */ 9291 HRESULT Console::i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs, 9292 const Utf8Str &aCaptureFilename) 9415 HRESULT Console::i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs, const Utf8Str &aCaptureFilename) 9293 9416 { 9294 9417 AssertReturn(aHostDevice, E_FAIL); … … 9301 9424 * method in EMT (using usbAttachCallback()). 9302 9425 */ 9303 Bstr BstrAddress;9304 hrc = aHostDevice->COMGETTER(Address)( BstrAddress.asOutParam());9426 Bstr bstrAddress; 9427 hrc = aHostDevice->COMGETTER(Address)(bstrAddress.asOutParam()); 9305 9428 ComAssertComRCRetRC(hrc); 9306 9307 Utf8Str Address(BstrAddress); 9429 Utf8Str const Address(bstrAddress); 9308 9430 9309 9431 Bstr id; 9310 9432 hrc = aHostDevice->COMGETTER(Id)(id.asOutParam()); 9311 9433 ComAssertComRCRetRC(hrc); 9312 Guid uuid(id);9434 Guid const uuid(id); 9313 9435 9314 9436 BOOL fRemote = FALSE; … … 9316 9438 ComAssertComRCRetRC(hrc); 9317 9439 9318 Bstr BstrBackend;9319 hrc = aHostDevice->COMGETTER(Backend)( BstrBackend.asOutParam());9440 Bstr bstrBackend; 9441 hrc = aHostDevice->COMGETTER(Backend)(bstrBackend.asOutParam()); 9320 9442 ComAssertComRCRetRC(hrc); 9321 9322 Utf8Str Backend(BstrBackend); 9443 Utf8Str const strBackend(bstrBackend); 9323 9444 9324 9445 /* Get the VM handle. */ … … 9327 9448 return ptrVM.rc(); 9328 9449 9329 LogFlowThisFunc(("Proxying USB device '%s' {%RTuuid}...\n", 9330 Address.c_str(), uuid.raw())); 9450 LogFlowThisFunc(("Proxying USB device '%s' {%RTuuid}...\n", Address.c_str(), uuid.raw())); 9331 9451 9332 9452 void *pvRemoteBackend = NULL; … … 9343 9463 AssertComRCReturnRC(hrc); 9344 9464 9345 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */,9346 (PFNRT)i_usbAttachCallback, 10,9347 this, ptrVM.rawUVM(), aHostDevice, uuid.raw(), Backend.c_str(),9348 Address.c_str(), pvRemoteBackend, enmSpeed, aMaskedIfs,9349 aCaptureFilename.isEmpty() ? NULL : aCaptureFilename.c_str());9465 int vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */, 9466 (PFNRT)i_usbAttachCallback, 11, 9467 this, ptrVM.rawUVM(), ptrVM.vtable(), aHostDevice, uuid.raw(), 9468 strBackend.c_str(), Address.c_str(), pvRemoteBackend, enmSpeed, aMaskedIfs, 9469 aCaptureFilename.isEmpty() ? NULL : aCaptureFilename.c_str()); 9350 9470 if (RT_SUCCESS(vrc)) 9351 9471 { … … 9367 9487 { 9368 9488 Log1WarningThisFunc(("Failed to create proxy device for '%s' {%RTuuid} (%Rrc)\n", Address.c_str(), uuid.raw(), vrc)); 9369 9370 9489 switch (vrc) 9371 9490 { … … 9396 9515 //static 9397 9516 DECLCALLBACK(int) 9398 Console::i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid, const char *pszBackend,9399 const char * aAddress, void *pvRemoteBackend, USBConnectionSpeed_T aEnmSpeed, ULONG aMaskedIfs,9400 const char *pszCaptureFilename)9517 Console::i_usbAttachCallback(Console *that, PUVM pUVM, PCVMMR3VTABLE pVMM, IUSBDevice *aHostDevice, PCRTUUID aUuid, 9518 const char *pszBackend, const char *aAddress, void *pvRemoteBackend, USBConnectionSpeed_T aEnmSpeed, 9519 ULONG aMaskedIfs, const char *pszCaptureFilename) 9401 9520 { 9402 9521 RT_NOREF(aHostDevice); … … 9418 9537 } 9419 9538 9420 int vrc = PDMR3UsbCreateProxyDevice(pUVM, aUuid, pszBackend, aAddress, pvRemoteBackend,9421 enmSpeed, aMaskedIfs, pszCaptureFilename);9539 int vrc = pVMM->pfnPDMR3UsbCreateProxyDevice(pUVM, aUuid, pszBackend, aAddress, pvRemoteBackend, 9540 enmSpeed, aMaskedIfs, pszCaptureFilename); 9422 9541 LogFlowFunc(("vrc=%Rrc\n", vrc)); 9423 9542 LogFlowFuncLeave(); … … 9444 9563 9445 9564 /* if the device is attached, then there must at least one USB hub. */ 9446 AssertReturn( PDMR3UsbHasHub(ptrVM.rawUVM()), E_FAIL);9565 AssertReturn(ptrVM.vtable()->pfnPDMR3UsbHasHub(ptrVM.rawUVM()), E_FAIL); 9447 9566 9448 9567 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 9449 LogFlowThisFunc(("Detaching USB proxy device {%RTuuid}...\n", 9450 aHostDevice->i_id().raw())); 9568 LogFlowThisFunc(("Detaching USB proxy device {%RTuuid}...\n", aHostDevice->i_id().raw())); 9451 9569 9452 9570 /* … … 9468 9586 9469 9587 alock.release(); 9470 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */,9471 (PFNRT)i_usbDetachCallback, 5,9472 this, ptrVM.rawUVM(), pUuid);9588 int vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */, 9589 (PFNRT)i_usbDetachCallback, 4, 9590 this, ptrVM.rawUVM(), ptrVM.vtable(), pUuid); 9473 9591 if (RT_SUCCESS(vrc)) 9474 9592 { … … 9495 9613 //static 9496 9614 DECLCALLBACK(int) 9497 Console::i_usbDetachCallback(Console *that, PUVM pUVM, PC RTUUID aUuid)9615 Console::i_usbDetachCallback(Console *that, PUVM pUVM, PCVMMR3VTABLE pVMM, PCRTUUID aUuid) 9498 9616 { 9499 9617 LogFlowFuncEnter(); … … 9503 9621 AssertReturn(!that->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 9504 9622 9505 int vrc = PDMR3UsbDetachDevice(pUVM, aUuid);9623 int vrc = pVMM->pfnPDMR3UsbDetachDevice(pUVM, aUuid); 9506 9624 9507 9625 LogFlowFunc(("vrc=%Rrc\n", vrc)); … … 9513 9631 /* Note: FreeBSD needs this whether netflt is used or not. */ 9514 9632 #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD)) 9633 9515 9634 /** 9516 9635 * Helper function to handle host interface device creation and attachment. … … 9736 9855 return rc; 9737 9856 } 9857 9738 9858 #endif /* (RT_OS_LINUX || RT_OS_FREEBSD) && !VBOX_WITH_NETFLT */ 9739 9859 … … 9825 9945 */ 9826 9946 /*static*/ DECLCALLBACK(void) 9827 Console::i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL, 9828 const char *pszFormat, va_list args) 9947 Console::i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list args) 9829 9948 { 9830 9949 RT_SRC_POS_NOREF(); … … 9837 9956 9838 9957 /* Append to any the existing error message. */ 9839 if (pErrorText->length()) 9840 *pErrorText = Utf8StrFmt("%s.\n%N (%Rrc)", pErrorText->c_str(), 9841 pszFormat, &va2, rc, rc); 9842 else 9843 *pErrorText = Utf8StrFmt("%N (%Rrc)", pszFormat, &va2, rc, rc); 9958 try 9959 { 9960 if (pErrorText->length()) 9961 pErrorText->appendPrintf(".\n%N (%Rrc)", pszFormat, &va2, rc, rc); 9962 else 9963 pErrorText->printf("%N (%Rrc)", pszFormat, &va2, rc, rc); 9964 } 9965 catch (std::bad_alloc &) 9966 { 9967 } 9844 9968 9845 9969 va_end(va2); … … 9874 9998 Utf8Str message(pszFormat, va); 9875 9999 9876 LogRel(("Console: VM runtime error: fatal=%RTbool, errorID=%s message=\"%s\"\n", 9877 fFatal, pszErrorId, message.c_str())); 9878 9879 that->i_onRuntimeError(BOOL(fFatal), Bstr(pszErrorId).raw(), Bstr(message).raw()); 9880 10000 LogRel(("Console: VM runtime error: fatal=%RTbool, errorID=%s message=\"%s\"\n", fFatal, pszErrorId, message.c_str())); 10001 try 10002 { 10003 that->i_onRuntimeError(BOOL(fFatal), Bstr(pszErrorId).raw(), Bstr(message).raw()); 10004 } 10005 catch (std::bad_alloc &) 10006 { 10007 } 9881 10008 LogFlowFuncLeave(); NOREF(pUVM); 9882 10009 } … … 9986 10113 RTStrPurgeEncoding((char *)e + e->oSerialNumber); 9987 10114 9988 LogFlowThisFunc(("vendor %04X, product %04X, name = %s\n", 9989 e->idVendor, e->idProduct, 9990 e->oProduct? (char *)e + e->oProduct: "")); 10115 LogFlowThisFunc(("vendor %04x, product %04x, name = %s\n", 10116 e->idVendor, e->idProduct, e->oProduct ? (char *)e + e->oProduct : "")); 9991 10117 9992 10118 bool fNewDevice = true; … … 9996 10122 ++it) 9997 10123 { 9998 if ( (*it)->devId() == e->id10124 if ( (*it)->devId() == e->id 9999 10125 && (*it)->clientId() == u32ClientId) 10000 10126 { … … 10019 10145 10020 10146 /* Check if the device is ok for current USB filters. */ 10021 BOOL fMatched= FALSE;10147 BOOL fMatched = FALSE; 10022 10148 ULONG fMaskedIfs = 0; 10023 10024 10149 HRESULT hrc = mControl->RunUSBDeviceFilters(pUSBDevice, &fMatched, &fMaskedIfs); 10025 10150 … … 10088 10213 pUSBDevice->COMGETTER(Product)(product.asOutParam()); 10089 10214 10090 LogRel(("Remote USB: ---- Vendor %04X. Product %04X. Name = [%ls].\n", 10091 vendorId, productId, product.raw())); 10215 LogRel(("Remote USB: ---- Vendor %04x. Product %04x. Name = [%ls].\n", vendorId, productId, product.raw())); 10092 10216 10093 10217 /* Detach the device from VM. */ … … 10225 10349 pConsole->i_onVMProcessPriorityChange(enmVMPriority); 10226 10350 10227 PVM pVM; 10228 vrc = VMR3Create(cCpus, 10229 pConsole->mpVmm2UserMethods, 10230 Console::i_genericVMSetErrorCallback, 10231 &pTask->mErrorMsg, 10232 pTask->mConfigConstructor, 10233 static_cast<Console *>(pConsole), 10234 &pVM, NULL); 10351 PCVMMR3VTABLE pVMM = pConsole->mpVMM; 10352 PVM pVM = NULL; 10353 vrc = pVMM->pfnVMR3Create(cCpus, 10354 pConsole->mpVmm2UserMethods, 10355 Console::i_genericVMSetErrorCallback, 10356 &pTask->mErrorMsg, 10357 pTask->mpfnConfigConstructor, 10358 static_cast<Console *>(pConsole), 10359 &pVM, NULL); 10235 10360 alock.acquire(); 10236 10361 if (RT_SUCCESS(vrc)) 10237 10362 { 10238 do 10363 do /* break "loop" */ 10239 10364 { 10240 10365 /* 10241 10366 * Register our load/save state file handlers 10242 10367 */ 10243 vrc = SSMR3RegisterExternal(pConsole->mpUVM, sSSMConsoleUnit, 0 /*iInstance*/,10244 CONSOLE_SAVED_STATE_VERSION, 0 /* cbGuess */,10245 NULL, NULL, NULL,10246 NULL, i_saveStateFileExec, NULL,10247 NULL, i_loadStateFileExec, NULL,10248 static_cast<Console *>(pConsole));10368 vrc = pVMM->pfnSSMR3RegisterExternal(pConsole->mpUVM, sSSMConsoleUnit, 0 /*iInstance*/, 10369 CONSOLE_SAVED_STATE_VERSION, 0 /* cbGuess */, 10370 NULL, NULL, NULL, 10371 NULL, i_saveStateFileExec, NULL, 10372 NULL, i_loadStateFileExec, NULL, 10373 static_cast<Console *>(pConsole)); 10249 10374 AssertRCBreak(vrc); 10250 10375 … … 10305 10430 if ( fVRDEEnabled 10306 10431 && pConsole->mAudioVRDE) 10307 pConsole->mAudioVRDE->doAttachDriverViaEmt(pConsole->mpUVM, &alock);10432 pConsole->mAudioVRDE->doAttachDriverViaEmt(pConsole->mpUVM, pVMM, &alock); 10308 10433 } 10309 10434 #endif … … 10360 10485 LogFlowFunc(("Restoring saved state from '%s'...\n", pTask->mSavedStateFile.c_str())); 10361 10486 10362 vrc = VMR3LoadFromFile(pConsole->mpUVM,10363 pTask->mSavedStateFile.c_str(),10364 Console::i_stateProgressCallback,10365 static_cast<IProgress *>(pTask->mProgress));10487 vrc = pVMM->pfnVMR3LoadFromFile(pConsole->mpUVM, 10488 pTask->mSavedStateFile.c_str(), 10489 Console::i_stateProgressCallback, 10490 static_cast<IProgress *>(pTask->mProgress)); 10366 10491 if (RT_SUCCESS(vrc)) 10367 10492 { … … 10376 10501 #endif 10377 10502 if (RT_SUCCESS(vrc)) 10378 vrc = VMR3Resume(pConsole->mpUVM, VMRESUMEREASON_STATE_RESTORED);10503 vrc = pVMM->pfnVMR3Resume(pConsole->mpUVM, VMRESUMEREASON_STATE_RESTORED); 10379 10504 AssertLogRelRC(vrc); 10380 10505 } … … 10384 10509 if (RT_FAILURE(vrc)) 10385 10510 { 10386 int vrc2 = VMR3PowerOff(pConsole->mpUVM); AssertLogRelRC(vrc2);10511 int vrc2 = pVMM->pfnVMR3PowerOff(pConsole->mpUVM); AssertLogRelRC(vrc2); 10387 10512 #ifdef VBOX_WITH_EXTPACK 10388 10513 pConsole->mptrExtPackManager->i_callAllVmPowerOffHooks(pConsole, pVM); … … 10394 10519 /* -> ConsoleImplTeleporter.cpp */ 10395 10520 bool fPowerOffOnFailure; 10396 rc = pConsole->i_teleporterTrg(pConsole->mpUVM, p Machine, &pTask->mErrorMsg, pTask->mStartPaused,10397 pTask->m Progress, &fPowerOffOnFailure);10521 rc = pConsole->i_teleporterTrg(pConsole->mpUVM, pConsole->mpVMM, pMachine, &pTask->mErrorMsg, 10522 pTask->mStartPaused, pTask->mProgress, &fPowerOffOnFailure); 10398 10523 if (FAILED(rc) && fPowerOffOnFailure) 10399 10524 { 10400 10525 ErrorInfoKeeper eik; 10401 int vrc2 = VMR3PowerOff(pConsole->mpUVM); AssertLogRelRC(vrc2);10526 int vrc2 = pVMM->pfnVMR3PowerOff(pConsole->mpUVM); AssertLogRelRC(vrc2); 10402 10527 #ifdef VBOX_WITH_EXTPACK 10403 10528 pConsole->mptrExtPackManager->i_callAllVmPowerOffHooks(pConsole, pVM); … … 10415 10540 #endif 10416 10541 if (RT_SUCCESS(vrc)) 10417 vrc = VMR3PowerOn(pConsole->mpUVM);10542 vrc = pVMM->pfnVMR3PowerOn(pConsole->mpUVM); 10418 10543 AssertLogRelRC(vrc); 10419 10544 } … … 10445 10570 */ 10446 10571 alock.release(); 10447 VMR3AtErrorDeregister(pConsole->mpUVM, Console::i_genericVMSetErrorCallback, &pTask->mErrorMsg);10572 pVMM->pfnVMR3AtErrorDeregister(pConsole->mpUVM, Console::i_genericVMSetErrorCallback, &pTask->mErrorMsg); 10448 10573 /** @todo register another VMSetError callback? */ 10449 10574 alock.acquire(); … … 10461 10586 alock.acquire(); 10462 10587 } 10463 VMR3ReleaseUVM(pConsole->mpUVM);10588 pVMM->pfnVMR3ReleaseUVM(pConsole->mpUVM); 10464 10589 pConsole->mpUVM = NULL; 10465 10590 } … … 10509 10634 10510 10635 Assert(pConsole->mpUVM == NULL); 10511 i_vmstateChangeCallback(NULL, VMSTATE_TERMINATED, VMSTATE_CREATING, pConsole);10636 i_vmstateChangeCallback(NULL, pConsole->mpVMM, VMSTATE_TERMINATED, VMSTATE_CREATING, pConsole); 10512 10637 } 10513 10638 … … 10549 10674 * @param pThis Reference to the console object. 10550 10675 * @param pUVM The VM handle. 10676 * @param pVMM The VMM vtable. 10551 10677 * @param pcszDevice The name of the controller type. 10552 10678 * @param uInstance The instance of the controller. … … 10567 10693 DECLCALLBACK(int) Console::i_reconfigureMediumAttachment(Console *pThis, 10568 10694 PUVM pUVM, 10695 PCVMMR3VTABLE pVMM, 10569 10696 const char *pcszDevice, 10570 10697 unsigned uInstance, … … 10611 10738 false /* fHotplug */, 10612 10739 pUVM, 10740 pVMM, 10613 10741 NULL /* paLedDevType */, 10614 10742 NULL /* ppLunL0)*/); … … 10804 10932 */ 10805 10933 /*static*/ DECLCALLBACK(int) 10806 Console::i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, const uint8_t **ppbKey, 10807 size_t *pcbKey) 10934 Console::i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, const uint8_t **ppbKey, size_t *pcbKey) 10808 10935 { 10809 10936 Console *pConsole = ((MYPDMISECKEY *)pInterface)->pConsole; … … 11059 11186 * Validate configuration. 11060 11187 */ 11061 if (!CFGMR3AreValuesValid(pCfg, "papLeds\0pmapMediumAttachments\0DeviceInstance\0pConsole\0First\0Last\0")) 11062 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 11188 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, 11189 "papLeds|" 11190 "pmapMediumAttachments|" 11191 "DeviceInstance|" 11192 "pConsole|" 11193 "First|" 11194 "Last", 11195 ""); 11063 11196 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 11064 11197 ("Configuration error: Not possible to attach anything to this driver!\n"), … … 11077 11210 * Read config. 11078 11211 */ 11079 int rc = CFGMR3QueryPtr(pCfg, "papLeds", (void **)&pThis->papLeds); 11080 if (RT_FAILURE(rc)) 11081 { 11082 AssertMsgFailed(("Configuration error: Failed to query the \"papLeds\" value! rc=%Rrc\n", rc)); 11083 return rc; 11084 } 11085 11086 rc = CFGMR3QueryPtrDef(pCfg, "pmapMediumAttachments", (void **)&pThis->pmapMediumAttachments, NULL); 11087 if (RT_FAILURE(rc)) 11088 { 11089 AssertMsgFailed(("Configuration error: Failed to query the \"pmapMediumAttachments\" value! rc=%Rrc\n", rc)); 11090 return rc; 11091 } 11212 PCPDMDRVHLPR3 const pHlp = pDrvIns->pHlpR3; 11213 int rc = pHlp->pfnCFGMQueryPtr(pCfg, "papLeds", (void **)&pThis->papLeds); 11214 AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query the \"papLeds\" value! rc=%Rrc\n", rc), rc); 11215 11216 rc = pHlp->pfnCFGMQueryPtrDef(pCfg, "pmapMediumAttachments", (void **)&pThis->pmapMediumAttachments, NULL); 11217 AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query the \"pmapMediumAttachments\" value! rc=%Rrc\n", rc), rc); 11092 11218 if (pThis->pmapMediumAttachments) 11093 11219 { 11094 rc = CFGMR3QueryStringAlloc(pCfg, "DeviceInstance", &pThis->pszDeviceInstance); 11095 if (RT_FAILURE(rc)) 11096 { 11097 AssertMsgFailed(("Configuration error: Failed to query the \"DeviceInstance\" value! rc=%Rrc\n", rc)); 11098 return rc; 11099 } 11100 rc = CFGMR3QueryPtr(pCfg, "pConsole", (void **)&pThis->pConsole); 11101 if (RT_FAILURE(rc)) 11102 { 11103 AssertMsgFailed(("Configuration error: Failed to query the \"pConsole\" value! rc=%Rrc\n", rc)); 11104 return rc; 11105 } 11106 } 11107 11108 rc = CFGMR3QueryU32(pCfg, "First", &pThis->iFirstLUN); 11109 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 11110 pThis->iFirstLUN = 0; 11111 else if (RT_FAILURE(rc)) 11112 { 11113 AssertMsgFailed(("Configuration error: Failed to query the \"First\" value! rc=%Rrc\n", rc)); 11114 return rc; 11115 } 11116 11117 rc = CFGMR3QueryU32(pCfg, "Last", &pThis->iLastLUN); 11118 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 11119 pThis->iLastLUN = 0; 11120 else if (RT_FAILURE(rc)) 11121 { 11122 AssertMsgFailed(("Configuration error: Failed to query the \"Last\" value! rc=%Rrc\n", rc)); 11123 return rc; 11124 } 11125 if (pThis->iFirstLUN > pThis->iLastLUN) 11126 { 11127 AssertMsgFailed(("Configuration error: Invalid unit range %u-%u\n", pThis->iFirstLUN, pThis->iLastLUN)); 11128 return VERR_GENERAL_FAILURE; 11129 } 11220 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "DeviceInstance", &pThis->pszDeviceInstance); 11221 AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query the \"DeviceInstance\" value! rc=%Rrc\n", rc), rc); 11222 rc = pHlp->pfnCFGMQueryPtr(pCfg, "pConsole", (void **)&pThis->pConsole); 11223 AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query the \"pConsole\" value! rc=%Rrc\n", rc), rc); 11224 } 11225 11226 rc = pHlp->pfnCFGMQueryU32Def(pCfg, "First", &pThis->iFirstLUN, 0); 11227 AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query the \"First\" value! rc=%Rrc\n", rc), rc); 11228 11229 rc = pHlp->pfnCFGMQueryU32Def(pCfg, "Last", &pThis->iLastLUN, 0); 11230 AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query the \"Last\" value! rc=%Rrc\n", rc), rc); 11231 11232 AssertLogRelMsgReturn(pThis->iFirstLUN <= pThis->iLastLUN, 11233 ("Configuration error: Invalid unit range %u-%u\n", pThis->iFirstLUN, pThis->iLastLUN), 11234 VERR_INVALID_PARAMETER); 11130 11235 11131 11236 /* -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r93313 r93444 67 67 #include <iprt/stream.h> 68 68 69 #include <VBox/vmm/vmmr3vtable.h> 69 70 #include <VBox/vmm/vmapi.h> 70 71 #include <VBox/err.h> … … 292 293 * @param pcszValue The string value. 293 294 */ 294 static void InsertConfigString(PCFGMNODE pNode, 295 const char *pcszName, 296 const char *pcszValue) 295 void Console::InsertConfigString(PCFGMNODE pNode, const char *pcszName, const char *pcszValue) 297 296 { 298 int vrc = CFGMR3InsertString(pNode, 299 pcszName, 300 pcszValue); 297 int vrc = mpVMM->pfnCFGMR3InsertString(pNode, pcszName, pcszValue); 301 298 if (RT_FAILURE(vrc)) 302 299 throw ConfigError("CFGMR3InsertString", vrc, pcszName); … … 310 307 * @param rStrValue The string value. 311 308 */ 312 static void InsertConfigString(PCFGMNODE pNode, 313 const char *pcszName, 314 const Utf8Str &rStrValue) 309 void Console::InsertConfigString(PCFGMNODE pNode, const char *pcszName, const Utf8Str &rStrValue) 315 310 { 316 int vrc = CFGMR3InsertStringN(pNode, 317 pcszName, 318 rStrValue.c_str(), 319 rStrValue.length()); 311 int vrc = mpVMM->pfnCFGMR3InsertStringN(pNode, pcszName, rStrValue.c_str(), rStrValue.length()); 320 312 if (RT_FAILURE(vrc)) 321 313 throw ConfigError("CFGMR3InsertStringLengthKnown", vrc, pcszName); … … 330 322 * @param rBstrValue The string value. 331 323 */ 332 static void InsertConfigString(PCFGMNODE pNode, 333 const char *pcszName, 334 const Bstr &rBstrValue) 324 void Console::InsertConfigString(PCFGMNODE pNode, const char *pcszName, const Bstr &rBstrValue) 335 325 { 336 326 InsertConfigString(pNode, pcszName, Utf8Str(rBstrValue)); 337 327 } 338 328 339 #ifdef VBOX_WITH_CLOUD_NET340 329 /** 341 330 * Helper that calls CFGMR3InsertPassword and throws an RTCError if that … … 345 334 * @param rStrValue The string value. 346 335 */ 347 static void InsertConfigPassword(PCFGMNODE pNode, 348 const char *pcszName, 349 const Utf8Str &rStrValue) 336 void Console::InsertConfigPassword(PCFGMNODE pNode, const char *pcszName, const Utf8Str &rStrValue) 350 337 { 351 int vrc = CFGMR3InsertPasswordN(pNode, 352 pcszName, 353 rStrValue.c_str(), 354 rStrValue.length()); 338 int vrc = mpVMM->pfnCFGMR3InsertPasswordN(pNode, pcszName, rStrValue.c_str(), rStrValue.length()); 355 339 if (RT_FAILURE(vrc)) 356 340 throw ConfigError("CFGMR3InsertPasswordLengthKnown", vrc, pcszName); 357 341 } 358 #endif /* VBOX_WITH_CLOUD_NET */359 342 360 343 /** … … 366 349 * @param cbBytes See CFGMR3InsertBytes. 367 350 */ 368 static void InsertConfigBytes(PCFGMNODE pNode, 369 const char *pcszName, 370 const void *pvBytes, 371 size_t cbBytes) 351 void Console::InsertConfigBytes(PCFGMNODE pNode, const char *pcszName, const void *pvBytes, size_t cbBytes) 372 352 { 373 int vrc = CFGMR3InsertBytes(pNode, 374 pcszName, 375 pvBytes, 376 cbBytes); 353 int vrc = mpVMM->pfnCFGMR3InsertBytes(pNode, pcszName, pvBytes, cbBytes); 377 354 if (RT_FAILURE(vrc)) 378 355 throw ConfigError("CFGMR3InsertBytes", vrc, pcszName); … … 387 364 * @param u64Integer See CFGMR3InsertInteger. 388 365 */ 389 static void InsertConfigInteger(PCFGMNODE pNode, 390 const char *pcszName, 391 uint64_t u64Integer) 366 void Console::InsertConfigInteger(PCFGMNODE pNode, const char *pcszName, uint64_t u64Integer) 392 367 { 393 int vrc = CFGMR3InsertInteger(pNode, 394 pcszName, 395 u64Integer); 368 int vrc = mpVMM->pfnCFGMR3InsertInteger(pNode, pcszName, u64Integer); 396 369 if (RT_FAILURE(vrc)) 397 370 throw ConfigError("CFGMR3InsertInteger", vrc, pcszName); … … 405 378 * @param ppChild See CFGMR3InsertNode. 406 379 */ 407 static void InsertConfigNode(PCFGMNODE pNode, 408 const char *pcszName, 409 PCFGMNODE *ppChild) 380 void Console::InsertConfigNode(PCFGMNODE pNode, const char *pcszName, PCFGMNODE *ppChild) 410 381 { 411 int vrc = CFGMR3InsertNode(pNode, pcszName, ppChild);382 int vrc = mpVMM->pfnCFGMR3InsertNode(pNode, pcszName, ppChild); 412 383 if (RT_FAILURE(vrc)) 413 384 throw ConfigError("CFGMR3InsertNode", vrc, pcszName); … … 422 393 * @param ... Format arguments. 423 394 */ 424 static void InsertConfigNodeF(PCFGMNODE pNode, 425 PCFGMNODE *ppChild, 426 const char *pszNameFormat, 427 ...) 395 void Console::InsertConfigNodeF(PCFGMNODE pNode, PCFGMNODE *ppChild, const char *pszNameFormat, ...) 428 396 { 429 397 va_list va; 430 398 va_start(va, pszNameFormat); 431 int vrc = CFGMR3InsertNodeF(pNode, ppChild, "%N", pszNameFormat, &va);399 int vrc = mpVMM->pfnCFGMR3InsertNodeF(pNode, ppChild, "%N", pszNameFormat, &va); 432 400 va_end(va); 433 401 if (RT_FAILURE(vrc)) … … 441 409 * @param pcszName See CFGMR3RemoveValue. 442 410 */ 443 static void RemoveConfigValue(PCFGMNODE pNode, 444 const char *pcszName) 411 void Console::RemoveConfigValue(PCFGMNODE pNode, const char *pcszName) 445 412 { 446 int vrc = CFGMR3RemoveValue(pNode, pcszName);413 int vrc = mpVMM->pfnCFGMR3RemoveValue(pNode, pcszName); 447 414 if (RT_FAILURE(vrc)) 448 415 throw ConfigError("CFGMR3RemoveValue", vrc, pcszName); … … 498 465 #define MAX_BIOS_LUN_COUNT 4 499 466 500 static intSetBiosDiskInfo(ComPtr<IMachine> pMachine, PCFGMNODE pCfg, PCFGMNODE pBiosCfg,501 Bstr controllerName, const char * const s_apszBiosConfig[4])467 int Console::SetBiosDiskInfo(ComPtr<IMachine> pMachine, PCFGMNODE pCfg, PCFGMNODE pBiosCfg, 468 Bstr controllerName, const char * const s_apszBiosConfig[4]) 502 469 { 503 470 RT_NOREF(pCfg); … … 532 499 { 533 500 DeviceType_T lType; 534 hrc = pMediumAtt->COMGETTER(Type)(&lType); 501 hrc = pMediumAtt->COMGETTER(Type)(&lType); H(); 535 502 if (SUCCEEDED(hrc) && lType == DeviceType_HardDisk) 536 503 { … … 552 519 u32MaxPortCount = u32HDCount; 553 520 for (size_t j = 1; j < u32MaxPortCount; j++) 554 lPortLUN[j] = GetNextUsedPort(lPortUsed, 555 lPortLUN[j-1], 556 u32HDCount); 521 lPortLUN[j] = GetNextUsedPort(lPortUsed, lPortLUN[j-1], u32HDCount); 557 522 if (pBiosCfg) 558 523 { … … 595 560 if (!mptrExtPackManager->i_isExtPackUsable(s_pszPCIRawExtPackName)) 596 561 /* Always fatal! */ 597 return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,598 N_("Implementation of the PCI passthrough framework not found!\n"599 "The VM cannot be started. To fix this problem, either "600 "install the '%s' or disable PCI passthrough via VBoxManage"),601 s_pszPCIRawExtPackName);562 return pVMM->pfnVMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 563 N_("Implementation of the PCI passthrough framework not found!\n" 564 "The VM cannot be started. To fix this problem, either " 565 "install the '%s' or disable PCI passthrough via VBoxManage"), 566 s_pszPCIRawExtPackName); 602 567 # endif 603 568 … … 742 707 743 708 /** 744 * 709 * Construct the VM configuration tree (CFGM). 745 710 * 746 * This is a callback for VMR3Create() call. It is called from CFGMR3Init()747 * in the emulation thread (EMT). Any per thread COM/XPCOM initialization748 * is donehere.711 * This is a callback for VMR3Create() call. It is called from CFGMR3Init() in 712 * the emulation thread (EMT). Any per thread COM/XPCOM initialization is done 713 * here. 749 714 * 750 * @param pUVM The user mode VM handle. 751 * @param pVM The cross context VM handle. 752 * @param pvConsole Pointer to the VMPowerUpTask object. 753 * @return VBox status code. 715 * @returns VBox status code. 716 * @param pUVM The user mode VM handle. 717 * @param pVM The cross context VM handle. 718 * @param pVMM The VMM ring-3 vtable. 719 * @param pvConsole Pointer to the VMPowerUpTask object. 754 720 * 755 * 721 * @note Locks the Console object for writing. 756 722 */ 757 DECLCALLBACK(int) Console::i_configConstructor(PUVM pUVM, PVM pVM, void *pvConsole) 723 /*static*/ DECLCALLBACK(int) 724 Console::i_configConstructor(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, void *pvConsole) 758 725 { 759 726 LogFlowFuncEnter(); … … 773 740 */ 774 741 pConsole->mpUVM = pUVM; 775 VMR3RetainUVM(pUVM);742 pVMM->pfnVMR3RetainUVM(pUVM); 776 743 int vrc; 777 744 try 778 745 { 779 vrc = pConsole->i_configConstructorInner(pUVM, pVM, &alock);746 vrc = pConsole->i_configConstructorInner(pUVM, pVM, pVMM, &alock); 780 747 } 781 748 catch (...) … … 786 753 { 787 754 pConsole->mpUVM = NULL; 788 VMR3ReleaseUVM(pUVM);755 pVMM->pfnVMR3ReleaseUVM(pUVM); 789 756 } 790 757 … … 799 766 * @param pUVM The user mode VM handle. 800 767 * @param pVM The cross context VM handle. 768 * @param pVMM The VMM vtable. 801 769 * @param pAlock The automatic lock instance. This is for when we have 802 770 * to leave it in order to avoid deadlocks (ext packs and 803 771 * more). 804 772 */ 805 int Console::i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)773 int Console::i_configConstructorInner(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, AutoWriteLock *pAlock) 806 774 { 807 775 RT_NOREF(pVM /* when everything is disabled */); … … 850 818 uint32_t cbMcfgLength = 0; 851 819 852 ParavirtProvider_T paravirtProvider;853 hrc = pMachine->GetEffectiveParavirtProvider(& paravirtProvider);H();820 ParavirtProvider_T enmParavirtProvider; 821 hrc = pMachine->GetEffectiveParavirtProvider(&enmParavirtProvider); H(); 854 822 855 823 Bstr strParavirtDebug; … … 925 893 { 926 894 if (chipsetType != ChipsetType_ICH9) 927 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,928 N_("IOMMU uses MSIs which requires the ICH9 chipset implementation."));895 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 896 N_("IOMMU uses MSIs which requires the ICH9 chipset implementation.")); 929 897 if (!fIOAPIC) 930 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,931 N_("IOMMU requires an I/O APIC for remapping interrupts."));898 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 899 N_("IOMMU requires an I/O APIC for remapping interrupts.")); 932 900 } 933 901 #else … … 935 903 #endif 936 904 Assert(iommuType != IommuType_Automatic); 937 BusAssignmentManager *pBusMgr = mBusMgr = BusAssignmentManager::createInstance( chipsetType, iommuType);905 BusAssignmentManager *pBusMgr = mBusMgr = BusAssignmentManager::createInstance(pVMM, chipsetType, iommuType); 938 906 939 907 ULONG cCpus = 1; … … 987 955 * This is the only node in the tree. 988 956 */ 989 PCFGMNODE pRoot = CFGMR3GetRootU(pUVM);957 PCFGMNODE pRoot = pVMM->pfnCFGMR3GetRootU(pUVM); 990 958 Assert(pRoot); 991 959 … … 1188 1156 { 1189 1157 if (fIsGuest64Bit) 1190 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, N_("Cannot disable the APIC for a 64-bit guest.")); 1158 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 1159 N_("Cannot disable the APIC for a 64-bit guest.")); 1191 1160 if (cCpus > 1) 1192 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, N_("Cannot disable the APIC for an SMP guest.")); 1161 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 1162 N_("Cannot disable the APIC for an SMP guest.")); 1193 1163 if (fIOAPIC) 1194 { 1195 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 1196 N_("Cannot disable the APIC when the I/O APIC is present.")); 1197 } 1164 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 1165 N_("Cannot disable the APIC when the I/O APIC is present.")); 1198 1166 } 1199 1167 … … 1334 1302 const char *pcszParavirtProvider; 1335 1303 bool fGimDeviceNeeded = true; 1336 switch ( paravirtProvider)1304 switch (enmParavirtProvider) 1337 1305 { 1338 1306 case ParavirtProvider_None: … … 1354 1322 1355 1323 default: 1356 AssertMsgFailed(("Invalid paravirtProvider=%d\n", paravirtProvider));1357 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, N_("Invalid paravirt. provider '%d'"),1358 paravirtProvider);1324 AssertMsgFailed(("Invalid enmParavirtProvider=%d\n", enmParavirtProvider)); 1325 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, N_("Invalid paravirt. provider '%d'"), 1326 enmParavirtProvider); 1359 1327 } 1360 1328 InsertConfigString(pParavirtNode, "Provider", pcszParavirtProvider); … … 1369 1337 { 1370 1338 /* Hyper-V debug options. */ 1371 if ( paravirtProvider == ParavirtProvider_HyperV)1339 if (enmParavirtProvider == ParavirtProvider_HyperV) 1372 1340 { 1373 1341 bool fGimHvDebug = false; … … 1409 1377 { 1410 1378 AssertMsgFailed(("Unrecognized Hyper-V debug option '%s'\n", strKey.c_str())); 1411 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,1412 N_("Unrecognized Hyper-V debug option '%s' in '%s'"), strKey.c_str(),1413 strDebugOptions.c_str());1379 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 1380 N_("Unrecognized Hyper-V debug option '%s' in '%s'"), strKey.c_str(), 1381 strDebugOptions.c_str()); 1414 1382 } 1415 1383 } … … 1503 1471 1504 1472 if (strName.isEmpty()) 1505 return VMR3SetError(pUVM, VERR_CFGM_NO_NODE, RT_SRC_POS, 1506 N_("No bandwidth group name specified")); 1473 return pVMM->pfnVMR3SetError(pUVM, VERR_CFGM_NO_NODE, RT_SRC_POS, N_("No bandwidth group name specified")); 1507 1474 1508 1475 if (enmType == BandwidthGroupType_Disk) … … 1642 1609 } 1643 1610 else 1644 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,1645 N_("Failed to find PCI address of the assigned IOMMU device!"));1611 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 1612 N_("Failed to find PCI address of the assigned IOMMU device!")); 1646 1613 } 1647 1614 … … 1853 1820 default: 1854 1821 AssertMsgFailed(("Invalid graphicsController=%d\n", enmGraphicsController)); 1855 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,1856 N_("Invalid graphics controller type '%d'"), enmGraphicsController);1822 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 1823 N_("Invalid graphics controller type '%d'"), enmGraphicsController); 1857 1824 } 1858 1825 … … 1893 1860 InsertConfigInteger(pBiosCfg, "McfgLength", cbMcfgLength); 1894 1861 1895 DeviceType_T bootDevice;1896 1862 AssertMsgReturn(SchemaDefs::MaxBootPosition <= 9, ("Too many boot devices %d\n", SchemaDefs::MaxBootPosition), 1897 1863 VERR_INVALID_PARAMETER); … … 1899 1865 for (ULONG pos = 1; pos <= SchemaDefs::MaxBootPosition; ++pos) 1900 1866 { 1901 hrc = pMachine->GetBootOrder(pos, &bootDevice); H(); 1867 DeviceType_T enmBootDevice; 1868 hrc = pMachine->GetBootOrder(pos, &enmBootDevice); H(); 1902 1869 1903 1870 char szParamName[] = "BootDeviceX"; … … 1905 1872 1906 1873 const char *pszBootDevice; 1907 switch ( bootDevice)1874 switch (enmBootDevice) 1908 1875 { 1909 1876 case DeviceType_Null: … … 1923 1890 break; 1924 1891 default: 1925 AssertMsgFailed(("Invalid bootDevice=%d\n", bootDevice));1926 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,1927 N_("Invalid boot device '%d'"), bootDevice);1892 AssertMsgFailed(("Invalid enmBootDevice=%d\n", enmBootDevice)); 1893 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 1894 N_("Invalid boot device '%d'"), enmBootDevice); 1928 1895 } 1929 1896 InsertConfigString(pBiosCfg, szParamName, pszBootDevice); … … 2147 2114 /* Always fatal! Up to VBox 4.0.4 we allowed to start the VM anyway 2148 2115 * but this induced problems when the user saved + restored the VM! */ 2149 return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,2116 return pVMM->pfnVMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 2150 2117 N_("Implementation of the USB 2.0 controller not found!\n" 2151 2118 "Because the USB 2.0 controller state is part of the saved " … … 2198 2165 { 2199 2166 /* Always fatal. */ 2200 return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,2167 return pVMM->pfnVMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 2201 2168 N_("Implementation of the USB 3.0 controller not found!\n" 2202 2169 "Because the USB 3.0 controller state is part of the saved " … … 2535 2502 } 2536 2503 else 2537 return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,2504 return pVMM->pfnVMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 2538 2505 N_("There is no USB controller enabled but there\n" 2539 2506 "is at least one USB storage device configured for this VM.\n" … … 2612 2579 false /* fHotplug */, 2613 2580 pUVM, 2581 pVMM, 2614 2582 paLedDevType, 2615 2583 NULL /* ppLunL0 */); … … 2676 2644 default: 2677 2645 AssertMsgFailed(("Invalid network adapter type '%d' for slot '%d'", adapterType, uInstance)); 2678 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,2679 N_("Invalid network adapter type '%d' for slot '%d'"), adapterType, uInstance);2646 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 2647 N_("Invalid network adapter type '%d' for slot '%d'"), adapterType, uInstance); 2680 2648 } 2681 2649 … … 2835 2803 pInst, 2836 2804 false /*fAttachDetach*/, 2837 fIgnoreConnectFailure); 2805 fIgnoreConnectFailure, 2806 pUVM, 2807 pVMM); 2838 2808 if (RT_FAILURE(rc)) 2839 2809 return rc; … … 3253 3223 AudioDriverCfg DrvCfgVideoRec(pszAudioDevice, 0 /* Instance */, idxAudioLun, "AudioVideoRec", 3254 3224 false /*a_fEnabledIn*/, true /*a_fEnabledOut*/); 3255 rc = Recording.mAudioRec->InitializeConfig(&DrvCfgVideoRec);3225 rc = mRecording.mAudioRec->InitializeConfig(&DrvCfgVideoRec); 3256 3226 AssertRCStmt(rc, throw ConfigError(__FUNCTION__, rc, "Recording.mAudioRec->InitializeConfig failed")); 3257 3227 idxAudioLun++; … … 3553 3523 } 3554 3524 else 3555 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,3556 N_("AMD IOMMU is enabled, but the I/O APIC is not assigned a PCI address!"));3525 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 3526 N_("AMD IOMMU is enabled, but the I/O APIC is not assigned a PCI address!")); 3557 3527 } 3558 3528 } … … 3571 3541 } 3572 3542 else 3573 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,3574 N_("Intel IOMMU is enabled, but the I/O APIC is not assigned a PCI address!"));3543 return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 3544 N_("Intel IOMMU is enabled, but the I/O APIC is not assigned a PCI address!")); 3575 3545 } 3576 3546 } … … 3731 3701 { 3732 3702 // InsertConfig threw something: 3733 VMR3SetError(pUVM, x.m_vrc, RT_SRC_POS, "Caught ConfigError: %Rrc - %s", x.m_vrc, x.what());3703 pVMM->pfnVMR3SetError(pUVM, x.m_vrc, RT_SRC_POS, "Caught ConfigError: %Rrc - %s", x.m_vrc, x.what()); 3734 3704 return x.m_vrc; 3735 3705 } … … 3770 3740 * Register VM state change handler. 3771 3741 */ 3772 int rc2 = VMR3AtStateRegister(pUVM, Console::i_vmstateChangeCallback, this);3742 int rc2 = pVMM->pfnVMR3AtStateRegister(pUVM, Console::i_vmstateChangeCallback, this); 3773 3743 AssertRC(rc2); 3774 3744 if (RT_SUCCESS(rc)) … … 3778 3748 * Register VM runtime error handler. 3779 3749 */ 3780 rc2 = VMR3AtRuntimeErrorRegister(pUVM, Console::i_atVMRuntimeErrorCallback, this);3750 rc2 = pVMM->pfnVMR3AtRuntimeErrorRegister(pUVM, Console::i_atVMRuntimeErrorCallback, this); 3781 3751 AssertRC(rc2); 3782 3752 if (RT_SUCCESS(rc)) … … 3982 3952 if (i2 < cGlobalValues) 3983 3953 // this is still one of the global values: 3984 hrc = pVirtualBox->GetExtraData(Bstr(strKey).raw(), 3985 bstrExtraDataValue.asOutParam()); 3954 hrc = pVirtualBox->GetExtraData(Bstr(strKey).raw(), bstrExtraDataValue.asOutParam()); 3986 3955 else 3987 hrc = pMachine->GetExtraData(Bstr(strKey).raw(), 3988 bstrExtraDataValue.asOutParam()); 3956 hrc = pMachine->GetExtraData(Bstr(strKey).raw(), bstrExtraDataValue.asOutParam()); 3989 3957 if (FAILED(hrc)) 3990 3958 LogRel(("Warning: Cannot get extra data key %s, rc = %Rhrc\n", strKey.c_str(), hrc)); … … 4012 3980 4013 3981 /* does the node already exist? */ 4014 pNode = CFGMR3GetChild(pRoot, pszExtraDataKey);3982 pNode = mpVMM->pfnCFGMR3GetChild(pRoot, pszExtraDataKey); 4015 3983 if (pNode) 4016 CFGMR3RemoveValue(pNode, pszCFGMValueName);3984 mpVMM->pfnCFGMR3RemoveValue(pNode, pszCFGMValueName); 4017 3985 else 4018 3986 { 4019 3987 /* create the node */ 4020 rc = CFGMR3InsertNode(pRoot, pszExtraDataKey, &pNode);3988 rc = mpVMM->pfnCFGMR3InsertNode(pRoot, pszExtraDataKey, &pNode); 4021 3989 if (RT_FAILURE(rc)) 4022 3990 { … … 4033 4001 pszCFGMValueName = pszExtraDataKey; 4034 4002 pszExtraDataKey--; 4035 CFGMR3RemoveValue(pNode, pszCFGMValueName);4003 mpVMM->pfnCFGMR3RemoveValue(pNode, pszCFGMValueName); 4036 4004 } 4037 4005 … … 4042 4010 */ 4043 4011 Utf8Str strCFGMValueUtf8(bstrExtraDataValue); 4044 if ( !strCFGMValueUtf8.isEmpty())4012 if (strCFGMValueUtf8.isNotEmpty()) 4045 4013 { 4046 4014 uint64_t u64Value; … … 4048 4016 /* check for type prefix first. */ 4049 4017 if (!strncmp(strCFGMValueUtf8.c_str(), RT_STR_TUPLE("string:"))) 4050 InsertConfigString(pNode, pszCFGMValueName, strCFGMValueUtf8.c_str() + sizeof("string:") - 1);4018 rc = mpVMM->pfnCFGMR3InsertString(pNode, pszCFGMValueName, strCFGMValueUtf8.c_str() + sizeof("string:") - 1); 4051 4019 else if (!strncmp(strCFGMValueUtf8.c_str(), RT_STR_TUPLE("integer:"))) 4052 4020 { 4053 4021 rc = RTStrToUInt64Full(strCFGMValueUtf8.c_str() + sizeof("integer:") - 1, 0, &u64Value); 4054 4022 if (RT_SUCCESS(rc)) 4055 rc = CFGMR3InsertInteger(pNode, pszCFGMValueName, u64Value);4023 rc = mpVMM->pfnCFGMR3InsertInteger(pNode, pszCFGMValueName, u64Value); 4056 4024 } 4057 4025 else if (!strncmp(strCFGMValueUtf8.c_str(), RT_STR_TUPLE("bytes:"))) … … 4066 4034 rc = RTBase64Decode(pszBase64, pvBytes, cbValue, NULL, NULL); 4067 4035 if (RT_SUCCESS(rc)) 4068 rc = CFGMR3InsertBytes(pNode, pszCFGMValueName, pvBytes, cbValue);4036 rc = mpVMM->pfnCFGMR3InsertBytes(pNode, pszCFGMValueName, pvBytes, cbValue); 4069 4037 RTMemTmpFree(pvBytes); 4070 4038 } … … 4073 4041 } 4074 4042 else if (cbValue == 0) 4075 rc = CFGMR3InsertBytes(pNode, pszCFGMValueName, NULL, 0);4043 rc = mpVMM->pfnCFGMR3InsertBytes(pNode, pszCFGMValueName, NULL, 0); 4076 4044 else 4077 4045 rc = VERR_INVALID_BASE64_ENCODING; … … 4079 4047 /* auto detect type. */ 4080 4048 else if (RT_SUCCESS(RTStrToUInt64Full(strCFGMValueUtf8.c_str(), 0, &u64Value))) 4081 rc = CFGMR3InsertInteger(pNode, pszCFGMValueName, u64Value);4049 rc = mpVMM->pfnCFGMR3InsertInteger(pNode, pszCFGMValueName, u64Value); 4082 4050 else 4083 InsertConfigString(pNode, pszCFGMValueName, strCFGMValueUtf8);4051 rc = mpVMM->pfnCFGMR3InsertString(pNode, pszCFGMValueName, strCFGMValueUtf8.c_str()); 4084 4052 AssertLogRelMsgRCBreak(rc, ("failed to insert CFGM value '%s' to key '%s'\n", 4085 4053 strCFGMValueUtf8.c_str(), pszExtraDataKey)); … … 4350 4318 if (uCaps & MediumFormatCapabilities_File) 4351 4319 { 4352 Bstr strFile; 4353 hrc = pMedium->COMGETTER(Location)(strFile.asOutParam()); H(); 4354 Utf8Str utfFile = Utf8Str(strFile); 4355 Bstr strSnap; 4320 Bstr bstrFile; 4321 hrc = pMedium->COMGETTER(Location)(bstrFile.asOutParam()); H(); 4322 Utf8Str const strFile(bstrFile); 4323 4324 Bstr bstrSnap; 4356 4325 ComPtr<IMachine> pMachine = i_machine(); 4357 hrc = pMachine->COMGETTER(SnapshotFolder)(strSnap.asOutParam()); H(); 4358 Utf8Str utfSnap = Utf8Str(strSnap); 4326 hrc = pMachine->COMGETTER(SnapshotFolder)(bstrSnap.asOutParam()); H(); 4327 Utf8Str const strSnap(bstrSnap); 4328 4359 4329 RTFSTYPE enmFsTypeFile = RTFSTYPE_UNKNOWN; 4360 RTFSTYPE enmFsTypeSnap = RTFSTYPE_UNKNOWN;4361 int rc2 = RTFsQueryType(utfFile.c_str(), &enmFsTypeFile);4362 AssertMsgRCReturn(rc2, ("Querying the file type of '%s' failed!\n", utfFile.c_str()), rc2); 4330 int rc2 = RTFsQueryType(strFile.c_str(), &enmFsTypeFile); 4331 AssertMsgRCReturn(rc2, ("Querying the file type of '%s' failed!\n", strFile.c_str()), rc2); 4332 4363 4333 /* Ignore the error code. On error, the file system type is still 'unknown' so 4364 4334 * none of the following paths are taken. This can happen for new VMs which 4365 4335 * still don't have a snapshot folder. */ 4366 (void)RTFsQueryType(utfSnap.c_str(), &enmFsTypeSnap); 4336 RTFSTYPE enmFsTypeSnap = RTFSTYPE_UNKNOWN; 4337 (void)RTFsQueryType(strSnap.c_str(), &enmFsTypeSnap); 4367 4338 if (!mfSnapshotFolderDiskTypeShown) 4368 4339 { 4369 LogRel(("File system of '%s' (snapshots) is %s\n", 4370 utfSnap.c_str(), RTFsTypeName(enmFsTypeSnap))); 4340 LogRel(("File system of '%s' (snapshots) is %s\n", strSnap.c_str(), RTFsTypeName(enmFsTypeSnap))); 4371 4341 mfSnapshotFolderDiskTypeShown = true; 4372 4342 } 4373 LogRel(("File system of '%s' is %s\n", utfFile.c_str(), RTFsTypeName(enmFsTypeFile)));4343 LogRel(("File system of '%s' is %s\n", strFile.c_str(), RTFsTypeName(enmFsTypeFile))); 4374 4344 LONG64 i64Size; 4375 4345 hrc = pMedium->COMGETTER(LogicalSize)(&i64Size); H(); … … 4381 4351 uint64_t u64Print = formatDiskSize((uint64_t)i64Size, &pszUnit); 4382 4352 i_atVMRuntimeErrorCallbackF(0, "FatPartitionDetected", 4383 N_("The medium '%ls' has a logical size of %RU64%s "4384 "but the file system the medium is located on seems "4385 "to be FAT(32) which cannot handle files bigger than 4GB.\n"4386 "We strongly recommend to put all your virtual disk images and "4387 "the snapshot folder onto an NTFS partition"),4388 strFile.raw(), u64Print, pszUnit);4353 N_("The medium '%s' has a logical size of %RU64%s " 4354 "but the file system the medium is located on seems " 4355 "to be FAT(32) which cannot handle files bigger than 4GB.\n" 4356 "We strongly recommend to put all your virtual disk images and " 4357 "the snapshot folder onto an NTFS partition"), 4358 strFile.c_str(), u64Print, pszUnit); 4389 4359 } 4390 4360 #else /* !RT_OS_WINDOWS */ … … 4396 4366 { 4397 4367 RTFILE file; 4398 int rc = RTFileOpen(&file, utfFile.c_str(), RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);4368 int rc = RTFileOpen(&file, strFile.c_str(), RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 4399 4369 if (RT_SUCCESS(rc)) 4400 4370 { … … 4412 4382 uint64_t u64PrintMax = formatDiskSize(maxSize, &pszUnitMax); 4413 4383 i_atVMRuntimeErrorCallbackF(0, "FatPartitionDetected", /* <= not exact but ... */ 4414 N_("The medium '%ls' has a logical size of %RU64%s "4415 "but the file system the medium is located on can "4416 "only handle files up to %RU64%s in theory.\n"4417 "We strongly recommend to put all your virtual disk "4418 "images and the snapshot folder onto a proper "4419 "file system (e.g. ext3) with a sufficient size"),4420 strFile.raw(), u64PrintSiz, pszUnitSiz, u64PrintMax, pszUnitMax);4384 N_("The medium '%s' has a logical size of %RU64%s " 4385 "but the file system the medium is located on can " 4386 "only handle files up to %RU64%s in theory.\n" 4387 "We strongly recommend to put all your virtual disk " 4388 "images and the snapshot folder onto a proper " 4389 "file system (e.g. ext3) with a sufficient size"), 4390 strFile.c_str(), u64PrintSiz, pszUnitSiz, u64PrintMax, pszUnitMax); 4421 4391 } 4422 4392 } … … 4436 4406 i_atVMRuntimeErrorCallbackF(0, "FatPartitionDetected", 4437 4407 #ifdef RT_OS_WINDOWS 4438 N_("The snapshot folder of this VM '%ls' seems to be located on "4439 "a FAT(32) file system. The logical size of the medium '%ls' "4440 "(%RU64%s) is bigger than the maximum file size this file "4441 "system can handle (4GB).\n"4442 "We strongly recommend to put all your virtual disk images and "4443 "the snapshot folder onto an NTFS partition"),4408 N_("The snapshot folder of this VM '%s' seems to be located on " 4409 "a FAT(32) file system. The logical size of the medium '%s' " 4410 "(%RU64%s) is bigger than the maximum file size this file " 4411 "system can handle (4GB).\n" 4412 "We strongly recommend to put all your virtual disk images and " 4413 "the snapshot folder onto an NTFS partition"), 4444 4414 #else 4445 N_("The snapshot folder of this VM '%ls' seems to be located on "4446 "a FAT(32) file system. The logical size of the medium '%ls' "4447 "(%RU64%s) is bigger than the maximum file size this file "4448 "system can handle (4GB).\n"4449 "We strongly recommend to put all your virtual disk images and "4450 "the snapshot folder onto a proper file system (e.g. ext3)"),4415 N_("The snapshot folder of this VM '%s' seems to be located on " 4416 "a FAT(32) file system. The logical size of the medium '%s' " 4417 "(%RU64%s) is bigger than the maximum file size this file " 4418 "system can handle (4GB).\n" 4419 "We strongly recommend to put all your virtual disk images and " 4420 "the snapshot folder onto a proper file system (e.g. ext3)"), 4451 4421 #endif 4452 strSnap.raw(), strFile.raw(), u64Print, pszUnit);4422 strSnap.c_str(), strFile.c_str(), u64Print, pszUnit); 4453 4423 /* Show this particular warning only once */ 4454 4424 mfSnapshotFolderSizeWarningShown = true; … … 4476 4446 { 4477 4447 i_atVMRuntimeErrorCallbackF(0, "Ext4PartitionDetected", 4478 N_("The host I/O cache for at least one controller is disabled "4479 "and the medium '%ls' for this VM "4480 "is located on an %s partition. There is a known Linux "4481 "kernel bug which can lead to the corruption of the virtual "4482 "disk image under these conditions.\n"4483 "Either enable the host I/O cache permanently in the VM "4484 "settings or put the disk image and the snapshot folder "4485 "onto a different file system.\n"4486 "The host I/O cache will now be enabled for this medium"),4487 strFile.raw(), enmFsTypeFile == RTFSTYPE_EXT4 ? "ext4" : "xfs");4448 N_("The host I/O cache for at least one controller is disabled " 4449 "and the medium '%s' for this VM " 4450 "is located on an %s partition. There is a known Linux " 4451 "kernel bug which can lead to the corruption of the virtual " 4452 "disk image under these conditions.\n" 4453 "Either enable the host I/O cache permanently in the VM " 4454 "settings or put the disk image and the snapshot folder " 4455 "onto a different file system.\n" 4456 "The host I/O cache will now be enabled for this medium"), 4457 strFile.c_str(), enmFsTypeFile == RTFSTYPE_EXT4 ? "ext4" : "xfs"); 4488 4458 *pfUseHostIOCache = true; 4489 4459 } … … 4493 4463 { 4494 4464 i_atVMRuntimeErrorCallbackF(0, "Ext4PartitionDetected", 4495 N_("The host I/O cache for at least one controller is disabled "4496 "and the snapshot folder for this VM "4497 "is located on an %s partition. There is a known Linux "4498 "kernel bug which can lead to the corruption of the virtual "4499 "disk image under these conditions.\n"4500 "Either enable the host I/O cache permanently in the VM "4501 "settings or put the disk image and the snapshot folder "4502 "onto a different file system.\n"4503 "The host I/O cache will now be enabled for this medium"),4504 enmFsTypeSnap == RTFSTYPE_EXT4 ? "ext4" : "xfs");4465 N_("The host I/O cache for at least one controller is disabled " 4466 "and the snapshot folder for this VM " 4467 "is located on an %s partition. There is a known Linux " 4468 "kernel bug which can lead to the corruption of the virtual " 4469 "disk image under these conditions.\n" 4470 "Either enable the host I/O cache permanently in the VM " 4471 "settings or put the disk image and the snapshot folder " 4472 "onto a different file system.\n" 4473 "The host I/O cache will now be enabled for this medium"), 4474 enmFsTypeSnap == RTFSTYPE_EXT4 ? "ext4" : "xfs"); 4505 4475 *pfUseHostIOCache = true; 4506 4476 mfSnapshotFolderExt4WarningShown = true; … … 4522 4492 { 4523 4493 i_atVMRuntimeErrorCallbackF(0, "Linux2618TooOld", 4524 N_("The host I/O cache for at least one controller is disabled. "4525 "There is a known Linux kernel bug which can lead to kernel "4526 "oopses under heavy load. To our knowledge this bug affects "4527 "all 2.6.18 kernels.\n"4528 "Either enable the host I/O cache permanently in the VM "4529 "settings or switch to a newer host kernel.\n"4530 "The host I/O cache will now be enabled for this medium"));4494 N_("The host I/O cache for at least one controller is disabled. " 4495 "There is a known Linux kernel bug which can lead to kernel " 4496 "oopses under heavy load. To our knowledge this bug affects " 4497 "all 2.6.18 kernels.\n" 4498 "Either enable the host I/O cache permanently in the VM " 4499 "settings or switch to a newer host kernel.\n" 4500 "The host I/O cache will now be enabled for this medium")); 4531 4501 *pfUseHostIOCache = true; 4532 4502 } … … 4542 4512 * 4543 4513 * @returns VBox status code. 4544 * @param pUVM The usermode VM handle. 4545 * @param enmBus The storage bus. 4546 * @param enmDevType The device type. 4547 * @param pcszDevice The device emulation. 4548 * @param uInstance Instance of the device. 4549 * @param uLUN The LUN on the device. 4550 * @param fForceUnmount Whether to force unmounting. 4514 * @param pUVM The usermode VM handle. 4515 * @param pVMM The VMM vtable. 4516 * @param enmBus The storage bus. 4517 * @param enmDevType The device type. 4518 * @param pcszDevice The device emulation. 4519 * @param uInstance Instance of the device. 4520 * @param uLUN The LUN on the device. 4521 * @param fForceUnmount Whether to force unmounting. 4551 4522 */ 4552 int Console::i_unmountMediumFromGuest(PUVM pUVM, StorageBus_T enmBus, DeviceType_T enmDevType,4523 int Console::i_unmountMediumFromGuest(PUVM pUVM, PCVMMR3VTABLE pVMM, StorageBus_T enmBus, DeviceType_T enmDevType, 4553 4524 const char *pcszDevice, unsigned uInstance, unsigned uLUN, 4554 bool fForceUnmount) 4525 bool fForceUnmount) RT_NOEXCEPT 4555 4526 { 4556 4527 /* Unmount existing media only for floppy and DVD drives. */ … … 4558 4529 PPDMIBASE pBase; 4559 4530 if (enmBus == StorageBus_USB) 4560 rc = PDMR3UsbQueryDriverOnLun(pUVM, pcszDevice, uInstance, uLUN, "SCSI", &pBase);4531 rc = pVMM->pfnPDMR3UsbQueryDriverOnLun(pUVM, pcszDevice, uInstance, uLUN, "SCSI", &pBase); 4561 4532 else if ( (enmBus == StorageBus_SAS || enmBus == StorageBus_SCSI || enmBus == StorageBus_VirtioSCSI) 4562 4533 || (enmBus == StorageBus_SATA && enmDevType == DeviceType_DVD)) 4563 rc = PDMR3QueryDriverOnLun(pUVM, pcszDevice, uInstance, uLUN, "SCSI", &pBase);4534 rc = pVMM->pfnPDMR3QueryDriverOnLun(pUVM, pcszDevice, uInstance, uLUN, "SCSI", &pBase); 4564 4535 else /* IDE or Floppy */ 4565 rc = PDMR3QueryLun(pUVM, pcszDevice, uInstance, uLUN, &pBase);4536 rc = pVMM->pfnPDMR3QueryLun(pUVM, pcszDevice, uInstance, uLUN, &pBase); 4566 4537 4567 4538 if (RT_FAILURE(rc)) … … 4593 4564 * 4594 4565 * @returns VBox status code. 4595 * @param pCtlInst The controler instance node in the CFGM tree. 4596 * @param pcszDevice The device name. 4597 * @param uInstance The device instance. 4598 * @param uLUN The device LUN. 4599 * @param enmBus The storage bus. 4600 * @param fAttachDetach Flag whether this is a change while the VM is running 4601 * @param fHotplug Flag whether the guest should be notified about the device change. 4602 * @param fForceUnmount Flag whether to force unmounting the medium even if it is locked. 4603 * @param pUVM The usermode VM handle. 4604 * @param enmDevType The device type. 4605 * @param ppLunL0 Where to store the node to attach the new config to on success. 4566 * @param pCtlInst The controler instance node in the CFGM tree. 4567 * @param pcszDevice The device name. 4568 * @param uInstance The device instance. 4569 * @param uLUN The device LUN. 4570 * @param enmBus The storage bus. 4571 * @param fAttachDetach Flag whether this is a change while the VM is running 4572 * @param fHotplug Flag whether the guest should be notified about the device change. 4573 * @param fForceUnmount Flag whether to force unmounting the medium even if it is locked. 4574 * @param pUVM The usermode VM handle. 4575 * @param pVMM The VMM vtable. 4576 * @param enmDevType The device type. 4577 * @param ppLunL0 Where to store the node to attach the new config to on success. 4606 4578 */ 4607 4579 int Console::i_removeMediumDriverFromVm(PCFGMNODE pCtlInst, … … 4614 4586 bool fForceUnmount, 4615 4587 PUVM pUVM, 4588 PCVMMR3VTABLE pVMM, 4616 4589 DeviceType_T enmDevType, 4617 4590 PCFGMNODE *ppLunL0) … … 4621 4594 4622 4595 /* First check if the LUN already exists. */ 4623 PCFGMNODE pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN);4596 PCFGMNODE pLunL0 = pVMM->pfnCFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN); 4624 4597 AssertReturn(!RT_VALID_PTR(pLunL0) || fAttachDetach, VERR_INTERNAL_ERROR); 4625 4598 … … 4633 4606 && !fHotplug) 4634 4607 { 4635 rc = i_unmountMediumFromGuest(pUVM, enmBus, enmDevType, pcszDevice, 4636 uInstance, uLUN, fForceUnmount); 4608 rc = i_unmountMediumFromGuest(pUVM, pVMM, enmBus, enmDevType, pcszDevice, uInstance, uLUN, fForceUnmount); 4637 4609 if (RT_FAILURE(rc)) 4638 4610 return rc; … … 4652 4624 { 4653 4625 /* Get the current attached driver we have to detach. */ 4654 PCFGMNODE pDrvLun = CFGMR3GetChildF(pCtlInst, "LUN#%u/AttachedDriver/", uLUN);4626 PCFGMNODE pDrvLun = pVMM->pfnCFGMR3GetChildF(pCtlInst, "LUN#%u/AttachedDriver/", uLUN); 4655 4627 if (pDrvLun) 4656 4628 { 4657 4629 char szDriver[128]; 4658 4630 RT_ZERO(szDriver); 4659 rc = CFGMR3QueryString(pDrvLun, "Driver", &szDriver[0], sizeof(szDriver));4631 rc = pVMM->pfnCFGMR3QueryString(pDrvLun, "Driver", &szDriver[0], sizeof(szDriver)); 4660 4632 if (RT_SUCCESS(rc)) 4661 4633 pszDriverDetach = RTStrDup(&szDriver[0]); … … 4666 4638 4667 4639 if (enmBus == StorageBus_USB) 4668 rc = PDMR3UsbDriverDetach(pUVM, pcszDevice, uInstance, uLUN, 4669 pszDriverDetach, 0 /* iOccurence */, 4670 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 4640 rc = pVMM->pfnPDMR3UsbDriverDetach(pUVM, pcszDevice, uInstance, uLUN, pszDriverDetach, 4641 0 /* iOccurence */, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 4671 4642 else 4672 rc = PDMR3DriverDetach(pUVM, pcszDevice, uInstance, uLUN, 4673 pszDriverDetach, 0 /* iOccurence */, 4674 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 4643 rc = pVMM->pfnPDMR3DriverDetach(pUVM, pcszDevice, uInstance, uLUN, pszDriverDetach, 4644 0 /* iOccurence */, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 4675 4645 4676 4646 if (pszDriverDetach) … … 4678 4648 RTStrFree(pszDriverDetach); 4679 4649 /* Remove the complete node and create new for the new config. */ 4680 CFGMR3RemoveNode(pLunL0);4681 pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN);4650 pVMM->pfnCFGMR3RemoveNode(pLunL0); 4651 pLunL0 = pVMM->pfnCFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN); 4682 4652 if (pLunL0) 4683 4653 { … … 4708 4678 { 4709 4679 fAddLun = true; 4710 CFGMR3RemoveNode(pLunL0);4680 pVMM->pfnCFGMR3RemoveNode(pLunL0); 4711 4681 } 4712 4682 } … … 4717 4687 { 4718 4688 if (fAddLun) 4719 InsertConfigNode (pCtlInst, Utf8StrFmt("LUN#%u", uLUN).c_str(), &pLunL0);4689 InsertConfigNodeF(pCtlInst, &pLunL0, "LUN#%u", uLUN); 4720 4690 } 4721 4691 catch (ConfigError &x) … … 4747 4717 bool fHotplug, 4748 4718 PUVM pUVM, 4719 PCVMMR3VTABLE pVMM, 4749 4720 DeviceType_T *paLedDevType, 4750 4721 PCFGMNODE *ppLunL0) … … 4781 4752 /* Determine the base path for the device instance. */ 4782 4753 if (enmBus != StorageBus_USB) 4783 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance);4754 pCtlInst = pVMM->pfnCFGMR3GetChildF(pVMM->pfnCFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 4784 4755 else 4785 4756 { 4786 4757 /* If we hotplug a USB device create a new CFGM tree. */ 4787 4758 if (!fHotplug) 4788 pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "USB/%s/", pcszDevice);4759 pCtlInst = pVMM->pfnCFGMR3GetChildF(pVMM->pfnCFGMR3GetRootU(pUVM), "USB/%s/", pcszDevice); 4789 4760 else 4790 pCtlInst = CFGMR3CreateTree(pUVM);4761 pCtlInst = pVMM->pfnCFGMR3CreateTree(pUVM); 4791 4762 } 4792 4763 AssertReturn(pCtlInst, VERR_INTERNAL_ERROR); … … 4800 4771 { 4801 4772 if (!fAttachDetach) 4802 InsertConfigNode (pCtlInst, Utf8StrFmt("%d", lPort).c_str(), &pCtlInst);4773 InsertConfigNodeF(pCtlInst, &pCtlInst, "%d", lPort); 4803 4774 else 4804 pCtlInst = CFGMR3GetChildF(pCtlInst, "%d/", lPort);4775 pCtlInst = pVMM->pfnCFGMR3GetChildF(pCtlInst, "%d/", lPort); 4805 4776 } 4806 4777 … … 4834 4805 4835 4806 rc = i_removeMediumDriverFromVm(pCtlInst, pcszDevice, uInstance, uLUN, enmBus, fAttachDetach, 4836 fHotplug, fForceUnmount, pUVM, lType, &pLunL0);4807 fHotplug, fForceUnmount, pUVM, pVMM, lType, &pLunL0); 4837 4808 if (RT_FAILURE(rc)) 4838 4809 return rc; … … 4872 4843 * Informative logging. 4873 4844 */ 4874 Bstr strFile;4875 hrc = ptrMedium->COMGETTER(Location)( strFile.asOutParam());H();4876 Utf8Str utfFile = Utf8Str(strFile);4845 Bstr bstrFile; 4846 hrc = ptrMedium->COMGETTER(Location)(bstrFile.asOutParam()); H(); 4847 Utf8Str strFile(bstrFile); 4877 4848 RTFSTYPE enmFsTypeFile = RTFSTYPE_UNKNOWN; 4878 (void)RTFsQueryType( utfFile.c_str(), &enmFsTypeFile);4849 (void)RTFsQueryType(strFile.c_str(), &enmFsTypeFile); 4879 4850 LogRel(("File system of '%s' (%s) is %s\n", 4880 utfFile.c_str(), lType == DeviceType_DVD ? "DVD" : "Floppy", 4881 RTFsTypeName(enmFsTypeFile))); 4851 strFile.c_str(), lType == DeviceType_DVD ? "DVD" : "Floppy", RTFsTypeName(enmFsTypeFile))); 4882 4852 } 4883 4853 … … 4889 4859 4890 4860 ComObjPtr<IBandwidthGroup> pBwGroup; 4891 Bstr strBwGroup;4861 Bstr bstrBwGroup; 4892 4862 hrc = pMediumAtt->COMGETTER(BandwidthGroup)(pBwGroup.asOutParam()); H(); 4893 4863 4894 4864 if (!pBwGroup.isNull()) 4895 4865 { 4896 hrc = pBwGroup->COMGETTER(Name)( strBwGroup.asOutParam());H();4866 hrc = pBwGroup->COMGETTER(Name)(bstrBwGroup.asOutParam()); H(); 4897 4867 } 4898 4868 … … 4918 4888 uMergeSource, 4919 4889 uMergeTarget, 4920 strBwGroup.isEmpty() ? NULL : Utf8Str(strBwGroup).c_str(),4890 bstrBwGroup.isEmpty() ? NULL : Utf8Str(bstrBwGroup).c_str(), 4921 4891 !!fDiscard, 4922 4892 !!fNonRotational, … … 4937 4907 RTUuidCreate(&UsbMsd.mUuid); 4938 4908 UsbMsd.iPort = uInstance; 4939 rc = PDMR3UsbCreateEmulatedDevice(pUVM, pcszDevice, pCtlInst, &UsbMsd.mUuid, NULL);4909 rc = pVMM->pfnPDMR3UsbCreateEmulatedDevice(pUVM, pcszDevice, pCtlInst, &UsbMsd.mUuid, NULL); 4940 4910 if (RT_SUCCESS(rc)) 4941 4911 mUSBStorageDevices.push_back(UsbMsd); 4942 4912 } 4943 4913 else 4944 rc = PDMR3UsbDriverAttach(pUVM, pcszDevice, uInstance, uLUN,4945 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/);4914 rc = pVMM->pfnPDMR3UsbDriverAttach(pUVM, pcszDevice, uInstance, uLUN, 4915 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); 4946 4916 } 4947 4917 else if ( !fHotplug 4948 4918 && ( (enmBus == StorageBus_SAS || enmBus == StorageBus_SCSI || enmBus == StorageBus_VirtioSCSI) 4949 4919 || (enmBus == StorageBus_SATA && lType == DeviceType_DVD))) 4950 rc = PDMR3DriverAttach(pUVM, pcszDevice, uInstance, uLUN,4951 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/);4920 rc = pVMM->pfnPDMR3DriverAttach(pUVM, pcszDevice, uInstance, uLUN, 4921 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); 4952 4922 else 4953 rc = PDMR3DeviceAttach(pUVM, pcszDevice, uInstance, uLUN,4954 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/);4923 rc = pVMM->pfnPDMR3DeviceAttach(pUVM, pcszDevice, uInstance, uLUN, 4924 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); 4955 4925 AssertRCReturn(rc, rc); 4956 4926 … … 4960 4930 */ 4961 4931 PPDMIBASE pIBase = NULL; 4962 rc = PDMR3QueryDriverOnLun(pUVM, pcszDevice, uInstance, uLUN, "VD", &pIBase);4932 rc = pVMM->pfnPDMR3QueryDriverOnLun(pUVM, pcszDevice, uInstance, uLUN, "VD", &pIBase); 4963 4933 if (RT_SUCCESS(rc) && pIBase) 4964 4934 { … … 4982 4952 if ( aMachineState != MachineState_Starting 4983 4953 && aMachineState != MachineState_Restoring) 4984 CFGMR3Dump(pLunL0 ? pLunL0 : pCtlInst);4954 pVMM->pfnCFGMR3Dump(pLunL0 ? pLunL0 : pCtlInst); 4985 4955 } 4986 4956 catch (ConfigError &x) … … 5313 5283 break; 5314 5284 5315 PCFGMNODE pCfgFilterConfig = CFGMR3GetChild(pVDC, strFilter.c_str());5285 PCFGMNODE pCfgFilterConfig = mpVMM->pfnCFGMR3GetChild(pVDC, strFilter.c_str()); 5316 5286 if (!pCfgFilterConfig) 5317 5287 InsertConfigNode(pVDC, strFilter.c_str(), &pCfgFilterConfig); … … 5339 5309 5340 5310 /** 5341 * 5311 * Construct the Network configuration tree 5342 5312 * 5343 * 5313 * @returns VBox status code. 5344 5314 * 5345 * @param pszDevice The PDM device name. 5346 * @param uInstance The PDM device instance. 5347 * @param uLun The PDM LUN number of the drive. 5348 * @param aNetworkAdapter The network adapter whose attachment needs to be changed 5349 * @param pCfg Configuration node for the device 5350 * @param pLunL0 To store the pointer to the LUN#0. 5351 * @param pInst The instance CFGM node 5352 * @param fAttachDetach To determine if the network attachment should 5353 * be attached/detached after/before 5354 * configuration. 5355 * @param fIgnoreConnectFailure 5356 * True if connection failures should be ignored 5357 * (makes only sense for bridged/host-only networks). 5315 * @param pszDevice The PDM device name. 5316 * @param uInstance The PDM device instance. 5317 * @param uLun The PDM LUN number of the drive. 5318 * @param aNetworkAdapter The network adapter whose attachment needs to be changed 5319 * @param pCfg Configuration node for the device 5320 * @param pLunL0 To store the pointer to the LUN#0. 5321 * @param pInst The instance CFGM node 5322 * @param fAttachDetach To determine if the network attachment should 5323 * be attached/detached after/before 5324 * configuration. 5325 * @param fIgnoreConnectFailure 5326 * True if connection failures should be ignored 5327 * (makes only sense for bridged/host-only networks). 5328 * @param pUVM The usermode VM handle. 5329 * @param pVMM The VMM vtable. 5358 5330 * 5359 * 5360 * 5331 * @note Locks this object for writing. 5332 * @thread EMT 5361 5333 */ 5362 5334 int Console::i_configNetwork(const char *pszDevice, … … 5368 5340 PCFGMNODE pInst, 5369 5341 bool fAttachDetach, 5370 bool fIgnoreConnectFailure) 5342 bool fIgnoreConnectFailure, 5343 PUVM pUVM, 5344 PCVMMR3VTABLE pVMM) 5371 5345 { 5372 5346 RT_NOREF(fIgnoreConnectFailure); … … 5419 5393 if (fAttachDetach) 5420 5394 { 5421 rc = PDMR3DeviceDetach(mpUVM, pszDevice, uInstance, uLun, 0 /*fFlags*/);5395 rc = pVMM->pfnPDMR3DeviceDetach(pUVM, pszDevice, uInstance, uLun, 0 /*fFlags*/); 5422 5396 if (rc == VINF_PDM_NO_DRIVER_ATTACHED_TO_LUN) 5423 5397 rc = VINF_SUCCESS; … … 5425 5399 5426 5400 /* Nuke anything which might have been left behind. */ 5427 CFGMR3RemoveNode(CFGMR3GetChildF(pInst, "LUN#%u", uLun));5401 pVMM->pfnCFGMR3RemoveNode(pVMM->pfnCFGMR3GetChildF(pInst, "LUN#%u", uLun)); 5428 5402 } 5429 5403 … … 5434 5408 #ifdef VBOX_WITH_NETSHAPER 5435 5409 ComObjPtr<IBandwidthGroup> pBwGroup; 5436 Bstr strBwGroup;5410 Bstr bstrBwGroup; 5437 5411 hrc = aNetworkAdapter->COMGETTER(BandwidthGroup)(pBwGroup.asOutParam()); H(); 5438 5412 5439 5413 if (!pBwGroup.isNull()) 5440 5414 { 5441 hrc = pBwGroup->COMGETTER(Name)( strBwGroup.asOutParam());H();5415 hrc = pBwGroup->COMGETTER(Name)(bstrBwGroup.asOutParam()); H(); 5442 5416 } 5443 5417 #endif /* VBOX_WITH_NETSHAPER */ … … 5451 5425 */ 5452 5426 #ifdef VBOX_WITH_NETSHAPER 5453 if ( !strBwGroup.isEmpty()&& eAttachmentType != NetworkAttachmentType_Null)5427 if (bstrBwGroup.isNotEmpty() && eAttachmentType != NetworkAttachmentType_Null) 5454 5428 { 5455 5429 InsertConfigString(pLunL0, "Driver", "NetShaper"); 5456 5430 InsertConfigNode(pLunL0, "Config", &pCfg); 5457 InsertConfigString(pCfg, "BwGroup", strBwGroup);5431 InsertConfigString(pCfg, "BwGroup", bstrBwGroup); 5458 5432 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL0); 5459 5433 } … … 5640 5614 { 5641 5615 case E_ACCESSDENIED: 5642 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(5643 "Failed to open '/dev/net/tun' for read/write access. Please check the "5644 "permissions of that node. Either run 'chmod 0666 /dev/net/tun' or "5645 "change the group of that node and make yourself a member of that group. Make"5646 "sure that these changes are permanent, especially if you are "5647 "using udev"));5616 return pVMM->pfnVMR3SetError(pUVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( 5617 "Failed to open '/dev/net/tun' for read/write access. Please check the " 5618 "permissions of that node. Either run 'chmod 0666 /dev/net/tun' or " 5619 "change the group of that node and make yourself a member of that group. " 5620 "Make sure that these changes are permanent, especially if you are " 5621 "using udev")); 5648 5622 default: 5649 5623 AssertMsgFailed(("Could not attach to host interface! Bad!\n")); 5650 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(5651 "Failed to initialize Host Interface Networking"));5624 return pVMM->pfnVMR3SetError(pUVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, 5625 N_("Failed to initialize Host Interface Networking")); 5652 5626 } 5653 5627 } … … 5682 5656 { 5683 5657 AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: FindByName failed, rc=%Rhrc (0x%x)\n", hrc, hrc)); 5684 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS,5685 N_("Nonexistent host networking interface, name '%ls'"),5686 BridgedIfName.raw());5658 return pVMM->pfnVMR3SetError(pUVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 5659 N_("Nonexistent host networking interface, name '%ls'"), 5660 BridgedIfName.raw()); 5687 5661 } 5688 5662 … … 5741 5715 5742 5716 if (eIfType != HostNetworkInterfaceType_Bridged) 5743 { 5744 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 5745 N_("Interface ('%ls') is not a Bridged Adapter interface"), 5746 BridgedIfName.raw()); 5747 } 5717 return pVMM->pfnVMR3SetError(pUVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 5718 N_("Interface ('%ls') is not a Bridged Adapter interface"), 5719 BridgedIfName.raw()); 5748 5720 5749 5721 hrc = hostInterface->COMGETTER(Id)(bstr.asOutParam()); … … 5842 5814 { 5843 5815 case E_ACCESSDENIED: 5844 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(5845 "Failed to open '/dev/%s' for read/write access. Please check the "5846 "permissions of that node, and that the net.link.tap.user_open "5847 "sysctl is set. Either run 'chmod 0666 /dev/%s' or"5848 "change the group of that node to vboxusers and make yourself "5849 "a member ofthat group. Make sure that these changes are permanent."),5850 pszBridgedIfName, pszBridgedIfName);5816 return pVMM->pfnVMR3SetError(pUVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( 5817 "Failed to open '/dev/%s' for read/write access. Please check the " 5818 "permissions of that node, and that the net.link.tap.user_open " 5819 "sysctl is set. Either run 'chmod 0666 /dev/%s' or change the " 5820 "group of that node to vboxusers and make yourself a member of " 5821 "that group. Make sure that these changes are permanent."), 5822 pszBridgedIfName, pszBridgedIfName); 5851 5823 default: 5852 5824 AssertMsgFailed(("Could not attach to tap interface! Bad!\n")); 5853 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(5854 "Failed to initialize Host Interface Networking"));5825 return pVMM->pfnVMR3SetError(pUVM, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, 5826 N_("Failed to initialize Host Interface Networking")); 5855 5827 } 5856 5828 } … … 6123 6095 } 6124 6096 } 6125 return VMSetError(VMR3GetVM(mpUVM), VERR_NOT_FOUND, RT_SRC_POS,6126 N_("Host-only adapters are no longer supported!\n"6127 "For your convenience a host-only network named '%ls' has been "6128 "created with network mask '%ls' and IP address range '%ls' - '%ls'.\n"6129 "To fix this problem, switch to 'Host-only Network' "6130 "attachment type in the VM settings.\n"),6131 bstrNetworkName.raw(), bstrNetworkMask.raw(),6132 bstrLowerIP.raw(), bstrUpperIP.raw());6097 return pVMM->pfnVMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 6098 N_("Host-only adapters are no longer supported!\n" 6099 "For your convenience a host-only network named '%ls' has been " 6100 "created with network mask '%ls' and IP address range '%ls' - '%ls'.\n" 6101 "To fix this problem, switch to 'Host-only Network' " 6102 "attachment type in the VM settings.\n"), 6103 bstrNetworkName.raw(), bstrNetworkMask.raw(), 6104 bstrLowerIP.raw(), bstrUpperIP.raw()); 6133 6105 #endif /* VBOX_WITH_VMNET */ 6134 6106 ComPtr<IHostNetworkInterface> hostInterface; … … 6138 6110 { 6139 6111 LogRel(("NetworkAttachmentType_HostOnly: FindByName failed, rc (0x%x)\n", rc)); 6140 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 6141 N_("Nonexistent host networking interface, name '%ls'"), 6142 HostOnlyName.raw()); 6112 return pVMM->pfnVMR3SetError(pUVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 6113 N_("Nonexistent host networking interface, name '%ls'"), HostOnlyName.raw()); 6143 6114 } 6144 6115 … … 6163 6134 6164 6135 if (eIfType != HostNetworkInterfaceType_HostOnly) 6165 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS,6166 N_("Interface ('%ls') is not a Host-Only Adapter interface"),6167 HostOnlyName.raw());6136 return pVMM->pfnVMR3SetError(pUVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 6137 N_("Interface ('%ls') is not a Host-Only Adapter interface"), 6138 HostOnlyName.raw()); 6168 6139 6169 6140 hrc = hostInterface->COMGETTER(Id)(bstr.asOutParam()); … … 6392 6363 # endif 6393 6364 { 6394 return VMSetError(VMR3GetVM(mpUVM), VERR_NOT_FOUND, RT_SRC_POS, 6395 N_("Implementation of the cloud network attachment not found!\n" 6396 "To fix this problem, either install the '%s' or switch to " 6397 "another network attachment type in the VM settings.\n" 6398 ), 6399 s_pszCloudExtPackName); 6365 return pVMM->pfnVMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 6366 N_("Implementation of the cloud network attachment not found!\n" 6367 "To fix this problem, either install the '%s' or switch to " 6368 "another network attachment type in the VM settings."), 6369 s_pszCloudExtPackName); 6400 6370 } 6401 6371 … … 6408 6378 { 6409 6379 if (hrc == E_NOTIMPL) 6410 return VMSetError(VMR3GetVM(mpUVM), VERR_NOT_FOUND, RT_SRC_POS, 6411 N_("Failed to generate a key pair due to missing libssh\n" 6412 "To fix this problem, either build VirtualBox with libssh " 6413 "support or switch to another network attachment type in " 6414 "the VM settings.\n")); 6415 else 6416 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 6417 N_("Failed to generate a key pair due to libssh error!\n")); 6380 return pVMM->pfnVMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS, 6381 N_("Failed to generate a key pair due to missing libssh\n" 6382 "To fix this problem, either build VirtualBox with libssh " 6383 "support or switch to another network attachment type in " 6384 "the VM settings.")); 6385 return pVMM->pfnVMR3SetError(pUVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 6386 N_("Failed to generate a key pair due to libssh error!")); 6418 6387 } 6419 6388 hrc = startCloudGateway(virtualBox, network, mGateway); H(); … … 6444 6413 { 6445 6414 LogRel(("NetworkAttachmentType_HostOnlyNetwork: FindByName failed, hrc (0x%x)\n", hrc)); 6446 return VMSetError(VMR3GetVM(mpUVM), VERR_INTERNAL_ERROR, RT_SRC_POS, 6447 N_("Nonexistent host-only network '%ls'"), 6448 bstr.raw()); 6415 return pVMM->pfnVMR3SetError(pUVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 6416 N_("Nonexistent host-only network '%ls'"), bstr.raw()); 6449 6417 } 6450 6418 hrc = network->COMGETTER(Id)(bstrId.asOutParam()); H(); … … 6501 6469 if (fAttachDetach) 6502 6470 { 6503 rc = PDMR3DriverAttach(mpUVM, pszDevice, uInstance, uLun, 0 /*fFlags*/, NULL /* ppBase */);6471 rc = pVMM->pfnPDMR3DriverAttach(mpUVM, pszDevice, uInstance, uLun, 0 /*fFlags*/, NULL /* ppBase */); 6504 6472 //AssertRC(rc); 6505 6473 } … … 6525 6493 */ 6526 6494 ComPtr<IDHCPServer> dhcpServer; 6527 hrc = virtualBox->FindDHCPServerByNetworkName(networkName.raw(), 6528 dhcpServer.asOutParam()); 6495 hrc = virtualBox->FindDHCPServerByNetworkName(networkName.raw(), dhcpServer.asOutParam()); 6529 6496 if (SUCCEEDED(hrc)) 6530 6497 { … … 6539 6506 6540 6507 if (fEnabledDhcp) 6541 hrc = dhcpServer->Start(trunkName.raw(), 6542 trunkType.raw()); 6508 hrc = dhcpServer->Start(trunkName.raw(), trunkType.raw()); 6543 6509 } 6544 6510 else -
trunk/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
r93410 r93444 40 40 #include <VBox/vmm/vmapi.h> 41 41 #include <VBox/vmm/ssm.h> 42 #include <VBox/vmm/vmmr3vtable.h> 42 43 #include <VBox/err.h> 43 44 #include <VBox/version.h> … … 59 60 ComPtr<Console> mptrConsole; 60 61 PUVM mpUVM; 62 PCVMMR3VTABLE mpVMM; 61 63 ComObjPtr<Progress> mptrProgress; 62 64 Utf8Str mstrPassword; … … 73 75 /** @} */ 74 76 75 TeleporterState(Console *pConsole, PUVM pUVM, P rogress *pProgress, bool fIsSource)77 TeleporterState(Console *pConsole, PUVM pUVM, PCVMMR3VTABLE pVMM, Progress *pProgress, bool fIsSource) 76 78 : mptrConsole(pConsole) 77 79 , mpUVM(pUVM) 80 , mpVMM(pVMM) 78 81 , mptrProgress(pProgress) 79 82 , mfIsSource(fIsSource) … … 85 88 , mfIOError(false) 86 89 { 87 VMR3RetainUVM(mpUVM);90 pVMM->pfnVMR3RetainUVM(mpUVM); 88 91 } 89 92 90 93 ~TeleporterState() 91 94 { 92 VMR3ReleaseUVM(mpUVM); 95 if (mpVMM) 96 mpVMM->pfnVMR3ReleaseUVM(mpUVM); 93 97 mpUVM = NULL; 94 98 } … … 109 113 bool mfUnlockedMedia; 110 114 111 TeleporterStateSrc(Console *pConsole, PUVM pUVM, P rogress *pProgress, MachineState_T enmOldMachineState)112 : TeleporterState(pConsole, pUVM, p Progress, true /*fIsSource*/)115 TeleporterStateSrc(Console *pConsole, PUVM pUVM, PCVMMR3VTABLE pVMM, Progress *pProgress, MachineState_T enmOldMachineState) 116 : TeleporterState(pConsole, pUVM, pVMM, pProgress, true /*fIsSource*/) 113 117 , muPort(UINT32_MAX) 114 118 , mcMsMaxDowntime(250) … … 135 139 Utf8Str mErrorText; 136 140 137 TeleporterStateTrg(Console *pConsole, PUVM pUVM, P rogress *pProgress,141 TeleporterStateTrg(Console *pConsole, PUVM pUVM, PCVMMR3VTABLE pVMM, Progress *pProgress, 138 142 IMachine *pMachine, IInternalMachineControl *pControl, 139 143 PRTTIMERLR phTimerLR, bool fStartPaused) 140 : TeleporterState(pConsole, pUVM, p Progress, false /*fIsSource*/)144 : TeleporterState(pConsole, pUVM, pVMM, pProgress, false /*fIsSource*/) 141 145 , mpMachine(pMachine) 142 146 , mpControl(pControl) … … 233 237 */ 234 238 HRESULT 235 Console::i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, 236 const char *pszNAckMsg /*= NULL*/) 239 Console::i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg /*= NULL*/) 237 240 { 238 241 char szMsg[256]; … … 581 584 { 582 585 TeleporterState *pState = (TeleporterState *)pvUser; 583 SSMR3Cancel(pState->mpUVM);586 pState->mpVMM->pfnSSMR3Cancel(pState->mpUVM); 584 587 if (!pState->mfIsSource) 585 588 { … … 605 608 if (SUCCEEDED(hrc) && fCanceled) 606 609 { 607 SSMR3Cancel(pState->mpUVM);610 pState->mpVMM->pfnSSMR3Cancel(pState->mpUVM); 608 611 return VERR_SSM_CANCELLED; 609 612 } … … 694 697 RTSocketRetain(pState->mhSocket); 695 698 void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState)); 696 vrc = VMR3Teleport(pState->mpUVM,697 pState->mcMsMaxDowntime,698 &g_teleporterTcpOps, pvUser,699 teleporterProgressCallback, pvUser,700 &pState->mfSuspendedByUs);699 vrc = pState->mpVMM->pfnVMR3Teleport(pState->mpUVM, 700 pState->mcMsMaxDowntime, 701 &g_teleporterTcpOps, pvUser, 702 teleporterProgressCallback, pvUser, 703 &pState->mfSuspendedByUs); 701 704 RTSocketRelease(pState->mhSocket); 702 705 if (RT_FAILURE(vrc)) … … 804 807 pState->mptrConsole->mptrCancelableProgress.setNull(); 805 808 806 VMSTATE const enmVMState = VMR3GetStateU(pState->mpUVM);809 VMSTATE const enmVMState = pState->mpVMM->pfnVMR3GetStateU(pState->mpUVM); 807 810 MachineState_T const enmMachineState = pState->mptrConsole->mMachineState; 808 811 if (SUCCEEDED(hrc)) … … 814 817 * powerDown. 815 818 */ 816 AssertLogRelMsg(enmVMState == VMSTATE_SUSPENDED, ("%s\n", VMR3GetStateName(enmVMState)));819 AssertLogRelMsg(enmVMState == VMSTATE_SUSPENDED, ("%s\n", pState->mpVMM->pfnVMR3GetStateName(enmVMState))); 817 820 AssertLogRelMsg(enmMachineState == MachineState_TeleportingPausedVM, ("%s\n", ::stringifyMachineState(enmMachineState))); 818 821 … … 890 893 891 894 default: 892 AssertMsgFailed(("%s\n", VMR3GetStateName(enmVMState)));895 AssertMsgFailed(("%s\n", pState->mpVMM->pfnVMR3GetStateName(enmVMState))); 893 896 RT_FALL_THRU(); 894 897 case VMSTATE_SUSPENDED: … … 903 906 { 904 907 autoLock.release(); 905 int rc = VMR3Resume(pState->mpUVM, VMRESUMEREASON_TELEPORT_FAILED);908 int rc = pState->mpVMM->pfnVMR3Resume(pState->mpUVM, VMRESUMEREASON_TELEPORT_FAILED); 906 909 AssertLogRelMsgRC(rc, ("VMR3Resume -> %Rrc\n", rc)); 907 910 autoLock.acquire(); … … 988 991 return hrc; 989 992 990 TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpUVM, ptrProgress, mMachineState);993 TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpUVM, mpVMM, ptrProgress, mMachineState); 991 994 pState->mstrPassword = strPassword; 992 995 pState->mstrHostname = aHostname; … … 1030 1033 * @returns VBox status code. 1031 1034 * @param pUVM The user-mode VM handle 1035 * @param pVMM The VMM vtable. 1032 1036 * @param pMachine The IMachine for the virtual machine. 1033 1037 * @param pErrorMsg Pointer to the error string for VMSetError. … … 1041 1045 * @todo Check that all the possible failure paths sets error info... 1042 1046 */ 1043 HRESULT Console::i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,1047 HRESULT Console::i_teleporterTrg(PUVM pUVM, PCVMMR3VTABLE pVMM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused, 1044 1048 Progress *pProgress, bool *pfPowerOffOnFailure) 1045 1049 { 1046 LogThisFunc(("pUVM=%p p Machine=%p fStartPaused=%RTbool pProgress=%p\n", pUVM, pMachine, fStartPaused, pProgress));1050 LogThisFunc(("pUVM=%p pVMM=%p pMachine=%p fStartPaused=%RTbool pProgress=%p\n", pUVM, pVMM, pMachine, fStartPaused, pProgress)); 1047 1051 1048 1052 *pfPowerOffOnFailure = true; … … 1113 1117 * Do the job, when it returns we're done. 1114 1118 */ 1115 TeleporterStateTrg theState(this, pUVM, p Progress, pMachine, mControl, &hTimerLR, fStartPaused);1119 TeleporterStateTrg theState(this, pUVM, pVMM, pProgress, pMachine, mControl, &hTimerLR, fStartPaused); 1116 1120 theState.mstrPassword = strPassword; 1117 1121 theState.mhServer = hServer; … … 1137 1141 else 1138 1142 { 1139 VMSTATE enmVMState = VMR3GetStateU(pUVM);1143 VMSTATE enmVMState = pVMM->pfnVMR3GetStateU(pUVM); 1140 1144 if ( enmVMState != VMSTATE_OFF 1141 1145 && enmVMState != VMSTATE_POWERING_OFF) … … 1346 1350 break; 1347 1351 1348 int vrc2 = VMR3AtErrorRegister(pState->mpUVM, 1349 Console::i_genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2); 1352 int vrc2 = pState->mpVMM->pfnVMR3AtErrorRegister(pState->mpUVM, Console::i_genericVMSetErrorCallback, 1353 &pState->mErrorText); 1354 AssertRC(vrc2); 1350 1355 RTSocketRetain(pState->mhSocket); /* For concurrent access by I/O thread and EMT. */ 1351 1356 pState->moffStream = 0; 1352 1357 1353 1358 void *pvUser2 = static_cast<void *>(static_cast<TeleporterState *>(pState)); 1354 vrc = VMR3LoadFromStream(pState->mpUVM,1355 &g_teleporterTcpOps, pvUser2,1356 teleporterProgressCallback, pvUser2);1359 vrc = pState->mpVMM->pfnVMR3LoadFromStream(pState->mpUVM, 1360 &g_teleporterTcpOps, pvUser2, 1361 teleporterProgressCallback, pvUser2); 1357 1362 1358 1363 RTSocketRelease(pState->mhSocket); 1359 vrc2 = VMR3AtErrorDeregister(pState->mpUVM, Console::i_genericVMSetErrorCallback, &pState->mErrorText);1364 vrc2 = pState->mpVMM->pfnVMR3AtErrorDeregister(pState->mpUVM, Console::i_genericVMSetErrorCallback, &pState->mErrorText); 1360 1365 AssertRC(vrc2); 1361 1366 … … 1421 1426 { 1422 1427 if (!strcmp(szCmd, "hand-over-resume")) 1423 vrc = VMR3Resume(pState->mpUVM, VMRESUMEREASON_TELEPORTED);1428 vrc = pState->mpVMM->pfnVMR3Resume(pState->mpUVM, VMRESUMEREASON_TELEPORTED); 1424 1429 else 1425 1430 pState->mptrConsole->i_setMachineState(MachineState_Paused); -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r93115 r93444 38 38 #include <iprt/alloca.h> 39 39 40 #include <VBox/vmm/vmmr3vtable.h> 40 41 #include <VBox/vmm/pdmdrv.h> 41 42 … … 226 227 } 227 228 228 DECLCALLBACK(void) Display::i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser) 229 { 230 Display *that = static_cast<Display*>(pvUser); 229 /** 230 * @callback_method_impl{FNSSMEXTSAVEEXEC} 231 */ 232 DECLCALLBACK(int) Display::i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser) 233 { 234 Display * const pThat = static_cast<Display *>(pvUser); 235 AssertPtrReturn(pThat, VERR_INVALID_POINTER); 231 236 232 237 /* 32bpp small RGB image. */ … … 242 247 uint32_t cyPNG = 0; 243 248 244 Console::SafeVMPtr ptrVM( that->mParent);249 Console::SafeVMPtr ptrVM(pThat->mParent); 245 250 if (ptrVM.isOk()) 246 251 { … … 252 257 uint32_t cy = 0; 253 258 bool fFreeMem = false; 254 int rc = Display::i_displayTakeScreenshotEMT( that, VBOX_VIDEO_PRIMARY_SCREEN, &pbData, &cbData, &cx, &cy, &fFreeMem);259 int rc = Display::i_displayTakeScreenshotEMT(pThat, VBOX_VIDEO_PRIMARY_SCREEN, &pbData, &cbData, &cx, &cy, &fFreeMem); 255 260 256 261 /* … … 280 285 RTMemFree(pbData); 281 286 else 282 that->mpDrv->pUpPort->pfnFreeScreenshot(that->mpDrv->pUpPort, pbData);287 pThat->mpDrv->pUpPort->pfnFreeScreenshot(pThat->mpDrv->pUpPort, pbData); 283 288 } 284 289 } … … 303 308 * [image data] 304 309 */ 305 SSMR3PutU32(pSSM, 2); /* Write thumbnail and PNG screenshot. */310 pVMM->pfnSSMR3PutU32(pSSM, 2); /* Write thumbnail and PNG screenshot. */ 306 311 307 312 /* First block. */ 308 SSMR3PutU32(pSSM, (uint32_t)(cbThumbnail + 2 * sizeof(uint32_t)));309 SSMR3PutU32(pSSM, 0); /* Block type: thumbnail. */313 pVMM->pfnSSMR3PutU32(pSSM, (uint32_t)(cbThumbnail + 2 * sizeof(uint32_t))); 314 pVMM->pfnSSMR3PutU32(pSSM, 0); /* Block type: thumbnail. */ 310 315 311 316 if (cbThumbnail) 312 317 { 313 SSMR3PutU32(pSSM, cxThumbnail);314 SSMR3PutU32(pSSM, cyThumbnail);315 SSMR3PutMem(pSSM, pu8Thumbnail, cbThumbnail);318 pVMM->pfnSSMR3PutU32(pSSM, cxThumbnail); 319 pVMM->pfnSSMR3PutU32(pSSM, cyThumbnail); 320 pVMM->pfnSSMR3PutMem(pSSM, pu8Thumbnail, cbThumbnail); 316 321 } 317 322 318 323 /* Second block. */ 319 SSMR3PutU32(pSSM, (uint32_t)(cbPNG + 2 * sizeof(uint32_t)));320 SSMR3PutU32(pSSM, 1); /* Block type: png. */324 pVMM->pfnSSMR3PutU32(pSSM, (uint32_t)(cbPNG + 2 * sizeof(uint32_t))); 325 pVMM->pfnSSMR3PutU32(pSSM, 1); /* Block type: png. */ 321 326 322 327 if (cbPNG) 323 328 { 324 SSMR3PutU32(pSSM, cxPNG);325 SSMR3PutU32(pSSM, cyPNG);326 SSMR3PutMem(pSSM, pu8PNG, cbPNG);329 pVMM->pfnSSMR3PutU32(pSSM, cxPNG); 330 pVMM->pfnSSMR3PutU32(pSSM, cyPNG); 331 pVMM->pfnSSMR3PutMem(pSSM, pu8PNG, cbPNG); 327 332 } 328 333 329 334 RTMemFree(pu8PNG); 330 335 RTMemFree(pu8Thumbnail); 331 } 332 336 337 return VINF_SUCCESS; 338 } 339 340 /** 341 * @callback_method_impl{FNSSMEXTLOADEXEC} 342 */ 333 343 DECLCALLBACK(int) 334 Display::i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass) 335 { 336 RT_NOREF(pvUser); 344 Display::i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, uint32_t uVersion, uint32_t uPass) 345 { 346 Display * const pThat = static_cast<Display *>(pvUser); 347 AssertPtrReturn(pThat, VERR_INVALID_POINTER); 348 Assert(uPass == SSM_PASS_FINAL); RT_NOREF_PV(uPass); 349 337 350 if (uVersion != sSSMDisplayScreenshotVer) 338 351 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 339 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);340 352 341 353 /* Skip data. */ 342 354 uint32_t cBlocks; 343 int rc =SSMR3GetU32(pSSM, &cBlocks);344 AssertRCReturn( rc,rc);355 int vrc = pVMM->pfnSSMR3GetU32(pSSM, &cBlocks); 356 AssertRCReturn(vrc, vrc); 345 357 346 358 for (uint32_t i = 0; i < cBlocks; i++) 347 359 { 348 360 uint32_t cbBlock; 349 rc =SSMR3GetU32(pSSM, &cbBlock);350 AssertRC Break(rc);361 vrc = pVMM->pfnSSMR3GetU32(pSSM, &cbBlock); 362 AssertRCReturn(vrc, vrc); 351 363 352 364 uint32_t typeOfBlock; 353 rc =SSMR3GetU32(pSSM, &typeOfBlock);354 AssertRC Break(rc);365 vrc = pVMM->pfnSSMR3GetU32(pSSM, &typeOfBlock); 366 AssertRCReturn(vrc, vrc); 355 367 356 368 LogRelFlowFunc(("[%d] type %d, size %d bytes\n", i, typeOfBlock, cbBlock)); … … 358 370 /* Note: displaySSMSaveScreenshot writes size of a block = 8 and 359 371 * do not write any data if the image size was 0. 360 * @todo Fix and increase saved state version.361 372 */ 373 /** @todo Fix and increase saved state version. */ 362 374 if (cbBlock > 2 * sizeof(uint32_t)) 363 375 { 364 rc =SSMR3Skip(pSSM, cbBlock);365 AssertRC Break(rc);376 vrc = pVMM->pfnSSMR3Skip(pSSM, cbBlock); 377 AssertRCReturn(vrc, vrc); 366 378 } 367 379 } 368 380 369 return rc;381 return vrc; 370 382 } 371 383 372 384 /** 373 * Save/Load some important guest state385 * @callback_method_impl{FNSSMEXTSAVEEXEC, Save some important guest state} 374 386 */ 375 DECLCALLBACK(void) 376 Display::i_displaySSMSave(PSSMHANDLE pSSM, void *pvUser) 377 { 378 Display *that = static_cast<Display*>(pvUser); 379 380 SSMR3PutU32(pSSM, that->mcMonitors); 381 for (unsigned i = 0; i < that->mcMonitors; i++) 382 { 383 SSMR3PutU32(pSSM, that->maFramebuffers[i].u32Offset); 384 SSMR3PutU32(pSSM, that->maFramebuffers[i].u32MaxFramebufferSize); 385 SSMR3PutU32(pSSM, that->maFramebuffers[i].u32InformationSize); 386 SSMR3PutU32(pSSM, that->maFramebuffers[i].w); 387 SSMR3PutU32(pSSM, that->maFramebuffers[i].h); 388 SSMR3PutS32(pSSM, that->maFramebuffers[i].xOrigin); 389 SSMR3PutS32(pSSM, that->maFramebuffers[i].yOrigin); 390 SSMR3PutU32(pSSM, that->maFramebuffers[i].flags); 391 } 392 SSMR3PutS32(pSSM, that->xInputMappingOrigin); 393 SSMR3PutS32(pSSM, that->yInputMappingOrigin); 394 SSMR3PutU32(pSSM, that->cxInputMapping); 395 SSMR3PutU32(pSSM, that->cyInputMapping); 396 SSMR3PutU32(pSSM, that->mfGuestVBVACapabilities); 397 SSMR3PutU32(pSSM, that->mfHostCursorCapabilities); 398 } 399 400 DECLCALLBACK(int) 401 Display::i_displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass) 402 { 403 Display *that = static_cast<Display*>(pvUser); 387 /*static*/ DECLCALLBACK(int) 388 Display::i_displaySSMSave(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser) 389 { 390 Display * const pThat = static_cast<Display *>(pvUser); 391 AssertPtrReturn(pThat, VERR_INVALID_POINTER); 392 393 pVMM->pfnSSMR3PutU32(pSSM, pThat->mcMonitors); 394 for (unsigned i = 0; i < pThat->mcMonitors; i++) 395 { 396 pVMM->pfnSSMR3PutU32(pSSM, pThat->maFramebuffers[i].u32Offset); 397 pVMM->pfnSSMR3PutU32(pSSM, pThat->maFramebuffers[i].u32MaxFramebufferSize); 398 pVMM->pfnSSMR3PutU32(pSSM, pThat->maFramebuffers[i].u32InformationSize); 399 pVMM->pfnSSMR3PutU32(pSSM, pThat->maFramebuffers[i].w); 400 pVMM->pfnSSMR3PutU32(pSSM, pThat->maFramebuffers[i].h); 401 pVMM->pfnSSMR3PutS32(pSSM, pThat->maFramebuffers[i].xOrigin); 402 pVMM->pfnSSMR3PutS32(pSSM, pThat->maFramebuffers[i].yOrigin); 403 pVMM->pfnSSMR3PutU32(pSSM, pThat->maFramebuffers[i].flags); 404 } 405 pVMM->pfnSSMR3PutS32(pSSM, pThat->xInputMappingOrigin); 406 pVMM->pfnSSMR3PutS32(pSSM, pThat->yInputMappingOrigin); 407 pVMM->pfnSSMR3PutU32(pSSM, pThat->cxInputMapping); 408 pVMM->pfnSSMR3PutU32(pSSM, pThat->cyInputMapping); 409 pVMM->pfnSSMR3PutU32(pSSM, pThat->mfGuestVBVACapabilities); 410 return pVMM->pfnSSMR3PutU32(pSSM, pThat->mfHostCursorCapabilities); 411 } 412 413 /** 414 * @callback_method_impl{FNSSMEXTLOADEXEC, Load some important guest state} 415 */ 416 /*static*/ DECLCALLBACK(int) 417 Display::i_displaySSMLoad(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, uint32_t uVersion, uint32_t uPass) 418 { 419 Display * const pThat = static_cast<Display *>(pvUser); 420 AssertPtrReturn(pThat, VERR_INVALID_POINTER); 404 421 405 422 if ( uVersion != sSSMDisplayVer … … 412 429 413 430 uint32_t cMonitors; 414 int rc = SSMR3GetU32(pSSM, &cMonitors);431 int rc = pVMM->pfnSSMR3GetU32(pSSM, &cMonitors); 415 432 AssertRCReturn(rc, rc); 416 if (cMonitors != that->mcMonitors)417 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Number of monitors changed (%d->%d)!"), cMonitors, that->mcMonitors);433 if (cMonitors != pThat->mcMonitors) 434 return pVMM->pfnSSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Number of monitors changed (%d->%d)!"), cMonitors, pThat->mcMonitors); 418 435 419 436 for (uint32_t i = 0; i < cMonitors; i++) 420 437 { 421 SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32Offset);422 SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32MaxFramebufferSize);423 SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32InformationSize);438 pVMM->pfnSSMR3GetU32(pSSM, &pThat->maFramebuffers[i].u32Offset); 439 pVMM->pfnSSMR3GetU32(pSSM, &pThat->maFramebuffers[i].u32MaxFramebufferSize); 440 pVMM->pfnSSMR3GetU32(pSSM, &pThat->maFramebuffers[i].u32InformationSize); 424 441 if ( uVersion == sSSMDisplayVer2 425 442 || uVersion == sSSMDisplayVer3 … … 429 446 uint32_t w; 430 447 uint32_t h; 431 SSMR3GetU32(pSSM, &w); 432 SSMR3GetU32(pSSM, &h); 433 that->maFramebuffers[i].w = w; 434 that->maFramebuffers[i].h = h; 448 pVMM->pfnSSMR3GetU32(pSSM, &w); 449 rc = pVMM->pfnSSMR3GetU32(pSSM, &h); 450 AssertRCReturn(rc, rc); 451 pThat->maFramebuffers[i].w = w; 452 pThat->maFramebuffers[i].h = h; 435 453 } 436 454 if ( uVersion == sSSMDisplayVer3 … … 441 459 int32_t yOrigin; 442 460 uint32_t flags; 443 SSMR3GetS32(pSSM, &xOrigin); 444 SSMR3GetS32(pSSM, &yOrigin); 445 SSMR3GetU32(pSSM, &flags); 446 that->maFramebuffers[i].xOrigin = xOrigin; 447 that->maFramebuffers[i].yOrigin = yOrigin; 448 that->maFramebuffers[i].flags = (uint16_t)flags; 449 that->maFramebuffers[i].fDisabled = (that->maFramebuffers[i].flags & VBVA_SCREEN_F_DISABLED) != 0; 461 pVMM->pfnSSMR3GetS32(pSSM, &xOrigin); 462 pVMM->pfnSSMR3GetS32(pSSM, &yOrigin); 463 rc = pVMM->pfnSSMR3GetU32(pSSM, &flags); 464 AssertRCReturn(rc, rc); 465 pThat->maFramebuffers[i].xOrigin = xOrigin; 466 pThat->maFramebuffers[i].yOrigin = yOrigin; 467 pThat->maFramebuffers[i].flags = (uint16_t)flags; 468 pThat->maFramebuffers[i].fDisabled = (pThat->maFramebuffers[i].flags & VBVA_SCREEN_F_DISABLED) != 0; 450 469 } 451 470 } … … 453 472 || uVersion == sSSMDisplayVer5) 454 473 { 455 SSMR3GetS32(pSSM, &that->xInputMappingOrigin);456 SSMR3GetS32(pSSM, &that->yInputMappingOrigin);457 SSMR3GetU32(pSSM, &that->cxInputMapping);458 SSMR3GetU32(pSSM, &that->cyInputMapping);474 pVMM->pfnSSMR3GetS32(pSSM, &pThat->xInputMappingOrigin); 475 pVMM->pfnSSMR3GetS32(pSSM, &pThat->yInputMappingOrigin); 476 pVMM->pfnSSMR3GetU32(pSSM, &pThat->cxInputMapping); 477 pVMM->pfnSSMR3GetU32(pSSM, &pThat->cyInputMapping); 459 478 } 460 479 if (uVersion == sSSMDisplayVer5) 461 480 { 462 SSMR3GetU32(pSSM, &that->mfGuestVBVACapabilities);463 SSMR3GetU32(pSSM, &that->mfHostCursorCapabilities);481 pVMM->pfnSSMR3GetU32(pSSM, &pThat->mfGuestVBVACapabilities); 482 pVMM->pfnSSMR3GetU32(pSSM, &pThat->mfHostCursorCapabilities); 464 483 } 465 484 … … 598 617 int Display::i_registerSSM(PUVM pUVM) 599 618 { 619 PCVMMR3VTABLE const pVMM = mParent->i_getVMMVTable(); 620 AssertPtrReturn(pVMM, VERR_INTERNAL_ERROR_3); 621 600 622 /* Version 2 adds width and height of the framebuffer; version 3 adds 601 623 * the framebuffer offset in the virtual desktop and the framebuffer flags; … … 603 625 * guest VBVA and host cursor capabilities. 604 626 */ 605 int rc = SSMR3RegisterExternal(pUVM, "DisplayData", 0, sSSMDisplayVer5,606 mcMonitors * sizeof(uint32_t) * 8 + sizeof(uint32_t),607 NULL, NULL, NULL,608 NULL, i_displaySSMSave, NULL,609 NULL, i_displaySSMLoad, NULL, this);627 int rc = pVMM->pfnSSMR3RegisterExternal(pUVM, "DisplayData", 0, sSSMDisplayVer5, 628 mcMonitors * sizeof(uint32_t) * 8 + sizeof(uint32_t), 629 NULL, NULL, NULL, 630 NULL, i_displaySSMSave, NULL, 631 NULL, i_displaySSMLoad, NULL, this); 610 632 AssertRCReturn(rc, rc); 611 633 … … 614 636 * 3 * sizeof(uint32_t *) due to a code mistake. 615 637 */ 616 rc = SSMR3RegisterExternal(pUVM, "DisplayData", 12 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,617 NULL, NULL, NULL,618 NULL, NULL, NULL,619 NULL, i_displaySSMLoad, NULL, this);638 rc = pVMM->pfnSSMR3RegisterExternal(pUVM, "DisplayData", 12 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/, 639 NULL, NULL, NULL, 640 NULL, NULL, NULL, 641 NULL, i_displaySSMLoad, NULL, this); 620 642 AssertRCReturn(rc, rc); 621 643 622 rc = SSMR3RegisterExternal(pUVM, "DisplayData", 24 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,623 NULL, NULL, NULL,624 NULL, NULL, NULL,625 NULL, i_displaySSMLoad, NULL, this);644 rc = pVMM->pfnSSMR3RegisterExternal(pUVM, "DisplayData", 24 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/, 645 NULL, NULL, NULL, 646 NULL, NULL, NULL, 647 NULL, i_displaySSMLoad, NULL, this); 626 648 AssertRCReturn(rc, rc); 627 649 628 650 /* uInstance is an arbitrary value greater than 1024. Such a value will ensure a quick seek in saved state file. */ 629 rc = SSMR3RegisterExternal(pUVM, "DisplayScreenshot", 1100 /*uInstance*/, sSSMDisplayScreenshotVer, 0 /*cbGuess*/,630 NULL, NULL, NULL,631 NULL, i_displaySSMSaveScreenshot, NULL,632 NULL, i_displaySSMLoadScreenshot, NULL, this);651 rc = pVMM->pfnSSMR3RegisterExternal(pUVM, "DisplayScreenshot", 1100 /*uInstance*/, sSSMDisplayScreenshotVer, 0 /*cbGuess*/, 652 NULL, NULL, NULL, 653 NULL, i_displaySSMSaveScreenshot, NULL, 654 NULL, i_displaySSMLoadScreenshot, NULL, this); 633 655 634 656 AssertRCReturn(rc, rc); … … 1575 1597 Console::SafeVMPtrQuiet ptrVM(mParent); 1576 1598 if (ptrVM.isOk()) 1577 { 1578 VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 1579 3, this, aScreenId, false); 1580 } 1599 ptrVM.vtable()->pfnVMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 1600 3, this, aScreenId, false); 1581 1601 1582 1602 LogRelFlowFunc(("Attached to %d %RTuuid\n", aScreenId, aId.raw())); … … 1691 1711 aChangeOrigin ? aOriginY : ~0, 1692 1712 RT_BOOL(aEnabled), 1693 ( mfGuestVBVACapabilities 1694 & VBVACAPS_VIDEO_MODE_HINTS) 1713 (mfGuestVBVACapabilities & VBVACAPS_VIDEO_MODE_HINTS) 1695 1714 && aNotify); 1696 1715 if ( mfGuestVBVACapabilities & VBVACAPS_VIDEO_MODE_HINTS 1697 1716 && !(mfGuestVBVACapabilities & VBVACAPS_IRQ) 1698 1717 && aNotify) 1699 {1700 1718 mParent->i_sendACPIMonitorHotPlugEvent(); 1701 }1702 1719 1703 1720 /* We currently never suppress the VMMDev hint if the guest has requested … … 1875 1892 } 1876 1893 1877 static int i_displayTakeScreenshot(PUVM pUVM, Display *pDisplay, struct DRVMAINDISPLAY *pDrv, ULONG aScreenId,1878 BYTE *address, ULONG width, ULONG height)1894 static int i_displayTakeScreenshot(PUVM pUVM, PCVMMR3VTABLE pVMM, Display *pDisplay, struct DRVMAINDISPLAY *pDrv, 1895 ULONG aScreenId, BYTE *address, ULONG width, ULONG height) 1879 1896 { 1880 1897 uint8_t *pbData = NULL; … … 1891 1908 it would be nice to have an accurate screenshot for the bug 1892 1909 report if the VM deadlocks. */ 1893 vrc = VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)Display::i_displayTakeScreenshotEMT, 7,1894 pDisplay, aScreenId, &pbData, &cbData, &cx, &cy, &fFreeMem);1910 vrc = pVMM->pfnVMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)Display::i_displayTakeScreenshotEMT, 7, 1911 pDisplay, aScreenId, &pbData, &cbData, &cx, &cy, &fFreeMem); 1895 1912 if (vrc != VERR_TRY_AGAIN) 1896 1913 { … … 1968 1985 return ptrVM.rc(); 1969 1986 1970 int vrc = i_displayTakeScreenshot(ptrVM.rawUVM(), this, mpDrv, aScreenId, aAddress, aWidth, aHeight); 1971 1987 int vrc = i_displayTakeScreenshot(ptrVM.rawUVM(), ptrVM.vtable(), this, mpDrv, aScreenId, aAddress, aWidth, aHeight); 1972 1988 if (RT_SUCCESS(vrc)) 1973 1989 { … … 1986 2002 size_t cPixels = aWidth * aHeight; 1987 2003 while (cPixels--) 1988 {1989 2004 *pu32++ |= UINT32_C(0xFF000000); 1990 }1991 2005 } 1992 2006 else if (aBitmapFormat == BitmapFormat_RGBA) … … 2020 2034 } 2021 2035 else 2022 { 2023 rc = setError(E_FAIL, 2024 tr("PNG is larger than 32bpp bitmap")); 2025 } 2036 rc = setError(E_FAIL, tr("PNG is larger than 32bpp bitmap")); 2026 2037 } 2027 2038 else … … 2285 2296 * dirty conversion work. 2286 2297 */ 2287 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_drawToScreenEMT, 7,2288 this, aScreenId, aAddress, aX, aY, aWidth, aHeight);2298 int vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_drawToScreenEMT, 7, 2299 this, aScreenId, aAddress, aX, aY, aWidth, aHeight); 2289 2300 2290 2301 /* … … 2325 2336 if ( !pFBInfo->fVBVAEnabled 2326 2337 && uScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 2327 {2328 2338 pDisplay->mpDrv->pUpPort->pfnUpdateDisplayAll(pDisplay->mpDrv->pUpPort, /* fFailOnResize = */ true); 2329 }2330 2339 else 2331 2340 { … … 2377 2386 */ 2378 2387 if (ulWidth == pFBInfo->w && ulHeight == pFBInfo->h) 2379 {2380 2388 pDisplay->mpDrv->pUpPort->pfnCopyRect(pDisplay->mpDrv->pUpPort, 2381 2389 width, height, … … 2388 2396 u32DstWidth, u32DstHeight, 2389 2397 u32DstLineSize, u32DstBitsPerPixel); 2390 }2391 2398 } 2392 2399 } … … 2418 2425 2419 2426 Console::SafeVMPtr ptrVM(mParent); 2420 if (!ptrVM.isOk()) 2421 return ptrVM.rc(); 2422 2423 HRESULT rc = S_OK; 2424 2425 LogRelFlowFunc(("Sending DPYUPDATE request\n")); 2426 2427 /* Have to release the lock when calling EMT. */ 2428 alock.release(); 2429 2430 int vrc = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 2431 3, this, 0, true); 2432 alock.acquire(); 2433 2434 if (RT_FAILURE(vrc)) 2435 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not invalidate and update the screen (%Rrc)"), vrc); 2436 2437 LogRelFlowFunc(("rc=%Rhrc\n", rc)); 2438 return rc; 2427 HRESULT hrc = ptrVM.rc(); 2428 if (SUCCEEDED(hrc)) 2429 { 2430 LogRelFlowFunc(("Sending DPYUPDATE request\n")); 2431 2432 /* Have to release the lock when calling EMT. */ 2433 alock.release(); 2434 2435 int vrc = ptrVM.vtable()->pfnVMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 2436 3, this, 0, true); 2437 alock.acquire(); 2438 2439 if (RT_FAILURE(vrc)) 2440 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not invalidate and update the screen (%Rrc)"), vrc); 2441 } 2442 2443 LogRelFlowFunc(("hrc=%Rhrc\n", hrc)); 2444 return hrc; 2439 2445 } 2440 2446 … … 2443 2449 LogRelFlowFunc(("\n")); 2444 2450 2445 HRESULT rc = S_OK;2446 2447 2451 Console::SafeVMPtr ptrVM(mParent); 2448 if (!ptrVM.isOk()) 2449 return ptrVM.rc(); 2450 2451 int vrc = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 2452 3, this, aScreenId, false); 2453 if (RT_FAILURE(vrc)) 2454 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not invalidate and update the screen %d (%Rrc)"), aScreenId, vrc); 2455 2456 LogRelFlowFunc(("rc=%Rhrc\n", rc)); 2457 return rc; 2452 HRESULT hrc = ptrVM.rc(); 2453 if (SUCCEEDED(hrc)) 2454 { 2455 int vrc = ptrVM.vtable()->pfnVMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 2456 3, this, aScreenId, false); 2457 if (RT_FAILURE(vrc)) 2458 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not invalidate and update the screen %d (%Rrc)"), aScreenId, vrc); 2459 } 2460 2461 LogRelFlowFunc(("hrc=%Rhrc\n", hrc)); 2462 return hrc; 2458 2463 } 2459 2464 … … 2497 2502 2498 2503 if (aScreenId >= mcMonitors) 2499 return setError(E_INVALIDARG, tr("QuerySourceBitmap: Invalid screen %d (total %d)"), 2500 aScreenId, mcMonitors); 2504 return setError(E_INVALIDARG, tr("QuerySourceBitmap: Invalid screen %d (total %d)"), aScreenId, mcMonitors); 2501 2505 2502 2506 if (!mfSourceBitmapEnabled) … … 2572 2576 { 2573 2577 if (fSetRenderVRAM) 2574 {2575 2578 mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, true); 2576 }2577 2579 2578 2580 if (fInvalidate) … … 3734 3736 DECLCALLBACK(int) Display::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 3735 3737 { 3736 RT_NOREF(fFlags);3737 3738 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 3739 RT_NOREF(fFlags, pCfg); 3738 3740 PDRVMAINDISPLAY pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY); 3739 3741 LogRelFlowFunc(("iInstance=%d\n", pDrvIns->iInstance)); … … 3742 3744 * Validate configuration. 3743 3745 */ 3744 if (!CFGMR3AreValuesValid(pCfg, "")) 3745 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 3746 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "", ""); 3746 3747 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 3747 3748 ("Configuration error: Not possible to attach anything to this driver!\n"), -
trunk/src/VBox/Main/src-client/DrvAudioRec.cpp
r93115 r93444 96 96 #include <VBox/vmm/pdmaudioifs.h> 97 97 #include <VBox/vmm/pdmaudioinline.h> 98 #include <VBox/vmm/vmmr3vtable.h> 98 99 #include <VBox/err.h> 99 100 … … 321 322 322 323 323 /** 324 * @copydoc AudioDriver::configureDriver 325 */ 326 int AudioVideoRec::configureDriver(PCFGMNODE pLunCfg) 327 { 328 int rc = CFGMR3InsertInteger(pLunCfg, "Object", (uintptr_t)mpConsole->i_recordingGetAudioDrv()); 329 AssertRCReturn(rc, rc); 330 rc = CFGMR3InsertInteger(pLunCfg, "ObjectConsole", (uintptr_t)mpConsole); 324 int AudioVideoRec::configureDriver(PCFGMNODE pLunCfg, PCVMMR3VTABLE pVMM) 325 { 326 int rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "Object", (uintptr_t)mpConsole->i_recordingGetAudioDrv()); 327 AssertRCReturn(rc, rc); 328 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "ObjectConsole", (uintptr_t)mpConsole); 331 329 AssertRCReturn(rc, rc); 332 330 … … 335 333 const settings::RecordingScreenSettings &Screen0Settings = mVideoRecCfg.mapScreens[0]; 336 334 337 rc = CFGMR3InsertInteger(pLunCfg, "ContainerType", (uint64_t)Screen0Settings.enmDest);335 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "ContainerType", (uint64_t)Screen0Settings.enmDest); 338 336 AssertRCReturn(rc, rc); 339 337 if (Screen0Settings.enmDest == RecordingDestination_File) 340 338 { 341 rc = CFGMR3InsertString(pLunCfg, "ContainerFileName", Utf8Str(Screen0Settings.File.strName).c_str());339 rc = pVMM->pfnCFGMR3InsertString(pLunCfg, "ContainerFileName", Utf8Str(Screen0Settings.File.strName).c_str()); 342 340 AssertRCReturn(rc, rc); 343 341 } 344 rc = CFGMR3InsertInteger(pLunCfg, "CodecHz", Screen0Settings.Audio.uHz);345 AssertRCReturn(rc, rc); 346 rc = CFGMR3InsertInteger(pLunCfg, "CodecBits", Screen0Settings.Audio.cBits);347 AssertRCReturn(rc, rc); 348 rc = CFGMR3InsertInteger(pLunCfg, "CodecChannels", Screen0Settings.Audio.cChannels);349 AssertRCReturn(rc, rc); 350 rc = CFGMR3InsertInteger(pLunCfg, "CodecBitrate", 0); /* Let Opus decide for now. */351 AssertRCReturn(rc, rc); 352 353 return AudioDriver::configureDriver(pLunCfg );342 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecHz", Screen0Settings.Audio.uHz); 343 AssertRCReturn(rc, rc); 344 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecBits", Screen0Settings.Audio.cBits); 345 AssertRCReturn(rc, rc); 346 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecChannels", Screen0Settings.Audio.cChannels); 347 AssertRCReturn(rc, rc); 348 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecBitrate", 0); /* Let Opus decide for now. */ 349 AssertRCReturn(rc, rc); 350 351 return AudioDriver::configureDriver(pLunCfg, pVMM); 354 352 } 355 353 … … 1128 1126 1129 1127 /* 1128 * Read configuration. 1129 */ 1130 PCPDMDRVHLPR3 const pHlp = pDrvIns->pHlpR3; 1131 /** @todo validate it. */ 1132 1133 /* 1130 1134 * Get the Console object pointer. 1131 1135 */ 1136 /** @todo No pointers! */ 1132 1137 void *pvUser; 1133 int rc = CFGMR3QueryPtr(pCfg, "ObjectConsole", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */1138 int rc = pHlp->pfnCFGMQueryPtr(pCfg, "ObjectConsole", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */ 1134 1139 AssertRCReturn(rc, rc); 1135 1140 … … 1141 1146 * Get the pointer to the audio driver instance. 1142 1147 */ 1143 rc = CFGMR3QueryPtr(pCfg, "Object", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */1148 rc = pHlp->pfnCFGMQueryPtr(pCfg, "Object", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */ 1144 1149 AssertRCReturn(rc, rc); 1145 1150 … … 1156 1161 RT_ZERO(pThis->CodecParms); 1157 1162 1158 rc = CFGMR3QueryU32(pCfg, "ContainerType", (uint32_t *)&pConParams->enmType);1163 rc = pHlp->pfnCFGMQueryU32(pCfg, "ContainerType", (uint32_t *)&pConParams->enmType); 1159 1164 AssertRCReturn(rc, rc); 1160 1165 … … 1162 1167 { 1163 1168 case AVRECCONTAINERTYPE_WEBM: 1164 rc = CFGMR3QueryStringAlloc(pCfg, "ContainerFileName", &pConParams->WebM.pszFile);1169 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "ContainerFileName", &pConParams->WebM.pszFile); 1165 1170 AssertRCReturn(rc, rc); 1166 1171 break; … … 1171 1176 1172 1177 uint32_t uHz = 0; 1173 rc = CFGMR3QueryU32(pCfg, "CodecHz", &uHz);1178 rc = pHlp->pfnCFGMQueryU32(pCfg, "CodecHz", &uHz); 1174 1179 AssertRCReturn(rc, rc); 1175 1180 1176 1181 uint8_t cSampleBits = 0; 1177 rc = CFGMR3QueryU8(pCfg, "CodecBits", &cSampleBits); /** @todo CodecBits != CodecBytes */1182 rc = pHlp->pfnCFGMQueryU8(pCfg, "CodecBits", &cSampleBits); /** @todo CodecBits != CodecBytes */ 1178 1183 AssertRCReturn(rc, rc); 1179 1184 1180 1185 uint8_t cChannels = 0; 1181 rc = CFGMR3QueryU8(pCfg, "CodecChannels", &cChannels);1186 rc = pHlp->pfnCFGMQueryU8(pCfg, "CodecChannels", &cChannels); 1182 1187 AssertRCReturn(rc, rc); 1183 1188 … … 1186 1191 ("Configuration error: Audio configuration is invalid!\n"), VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES); /** @todo wrong status code. */ 1187 1192 1188 rc = CFGMR3QueryU32(pCfg, "CodecBitrate", &pCodecParms->uBitrate);1193 rc = pHlp->pfnCFGMQueryU32(pCfg, "CodecBitrate", &pCodecParms->uBitrate); 1189 1194 AssertRCReturn(rc, rc); 1190 1195 -
trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp
r93115 r93444 36 36 #include <VBox/vmm/pdmaudioifs.h> 37 37 #include <VBox/vmm/pdmaudioinline.h> 38 #include <VBox/vmm/vmmr3vtable.h> 38 39 #include <VBox/RemoteDesktop/VRDE.h> 39 40 #include <VBox/err.h> … … 111 112 112 113 113 /** 114 * @copydoc AudioDriver::configureDriver 115 */ 116 int AudioVRDE::configureDriver(PCFGMNODE pLunCfg) 117 { 118 int rc = CFGMR3InsertInteger(pLunCfg, "Object", (uintptr_t)this); 114 int AudioVRDE::configureDriver(PCFGMNODE pLunCfg, PCVMMR3VTABLE pVMM) 115 { 116 int rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "Object", (uintptr_t)this); 119 117 AssertRCReturn(rc, rc); 120 CFGMR3InsertInteger(pLunCfg, "ObjectVRDPServer", (uintptr_t)mpConsole->i_consoleVRDPServer()); 118 119 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "ObjectVRDPServer", (uintptr_t)mpConsole->i_consoleVRDPServer()); 121 120 AssertRCReturn(rc, rc); 122 121 123 return AudioDriver::configureDriver(pLunCfg );122 return AudioDriver::configureDriver(pLunCfg, pVMM); 124 123 } 125 124 … … 749 748 */ 750 749 void *pvUser; 751 int rc = CFGMR3QueryPtr(pCfg, "ObjectVRDPServer", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */750 int rc = pDrvIns->pHlpR3->pfnCFGMQueryPtr(pCfg, "ObjectVRDPServer", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */ 752 751 AssertMsgRCReturn(rc, ("Confguration error: No/bad \"ObjectVRDPServer\" value, rc=%Rrc\n", rc), rc); 753 752 … … 762 761 */ 763 762 pvUser = NULL; 764 rc = CFGMR3QueryPtr(pCfg, "Object", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */763 rc = pDrvIns->pHlpR3->pfnCFGMQueryPtr(pCfg, "Object", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */ 765 764 AssertMsgRCReturn(rc, ("Confguration error: No/bad \"Object\" value, rc=%Rrc\n", rc), rc); 766 765 -
trunk/src/VBox/Main/src-client/EmulatedUSBImpl.cpp
r93115 r93444 23 23 24 24 #include <VBox/vmm/pdmusb.h> 25 #include <VBox/vmm/vmmr3vtable.h> 25 26 26 27 … … 39 40 class EUSBWEBCAM /* : public EUSBDEVICE */ 40 41 { 41 private: 42 int32_t volatile mcRefs; 43 44 EmulatedUSB *mpEmulatedUSB; 45 46 RTUUID mUuid; 47 char mszUuid[RTUUID_STR_LENGTH]; 48 49 Utf8Str mPath; 50 Utf8Str mSettings; 51 52 EUSBSettingsMap mDevSettings; 53 EUSBSettingsMap mDrvSettings; 54 55 void *mpvObject; 56 57 static DECLCALLBACK(int) emulatedWebcamAttach(PUVM pUVM, EUSBWEBCAM *pThis, const char *pszDriver); 58 static DECLCALLBACK(int) emulatedWebcamDetach(PUVM pUVM, EUSBWEBCAM *pThis); 59 60 HRESULT settingsParse(void); 61 62 ~EUSBWEBCAM() 63 { 64 } 65 66 public: 67 EUSBWEBCAM() 68 : 69 mcRefs(1), 70 mpEmulatedUSB(NULL), 71 mpvObject(NULL), 72 enmStatus(EUSBDEVICE_CREATED) 73 { 74 RT_ZERO(mUuid); 75 RT_ZERO(mszUuid); 76 } 77 78 int32_t AddRef(void) 79 { 80 return ASMAtomicIncS32(&mcRefs); 81 } 82 83 void Release(void) 84 { 85 int32_t c = ASMAtomicDecS32(&mcRefs); 86 if (c == 0) 87 { 88 delete this; 89 } 90 } 91 92 HRESULT Initialize(Console *pConsole, 93 EmulatedUSB *pEmulatedUSB, 94 const com::Utf8Str *aPath, 95 const com::Utf8Str *aSettings, 96 void *pvObject); 97 HRESULT Attach(Console *pConsole, 98 PUVM pUVM, 99 const char *pszDriver); 100 HRESULT Detach(Console *pConsole, 101 PUVM pUVM); 102 103 bool HasId(const char *pszId) { return RTStrCmp(pszId, mszUuid) == 0;} 104 105 EUSBDEVICESTATUS enmStatus; 42 private: 43 int32_t volatile mcRefs; 44 45 EmulatedUSB *mpEmulatedUSB; 46 47 RTUUID mUuid; 48 char mszUuid[RTUUID_STR_LENGTH]; 49 50 Utf8Str mPath; 51 Utf8Str mSettings; 52 53 EUSBSettingsMap mDevSettings; 54 EUSBSettingsMap mDrvSettings; 55 56 void *mpvObject; 57 58 static DECLCALLBACK(int) emulatedWebcamAttach(PUVM pUVM, PCVMMR3VTABLE pVMM, EUSBWEBCAM *pThis, const char *pszDriver); 59 static DECLCALLBACK(int) emulatedWebcamDetach(PUVM pUVM, PCVMMR3VTABLE pVMM, EUSBWEBCAM *pThis); 60 61 HRESULT settingsParse(void); 62 63 ~EUSBWEBCAM() 64 { 65 } 66 67 public: 68 EUSBWEBCAM() 69 : 70 mcRefs(1), 71 mpEmulatedUSB(NULL), 72 mpvObject(NULL), 73 enmStatus(EUSBDEVICE_CREATED) 74 { 75 RT_ZERO(mUuid); 76 RT_ZERO(mszUuid); 77 } 78 79 int32_t AddRef(void) 80 { 81 return ASMAtomicIncS32(&mcRefs); 82 } 83 84 void Release(void) 85 { 86 int32_t c = ASMAtomicDecS32(&mcRefs); 87 if (c == 0) 88 { 89 delete this; 90 } 91 } 92 93 HRESULT Initialize(Console *pConsole, 94 EmulatedUSB *pEmulatedUSB, 95 const com::Utf8Str *aPath, 96 const com::Utf8Str *aSettings, 97 void *pvObject); 98 HRESULT Attach(Console *pConsole, PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDriver); 99 HRESULT Detach(Console *pConsole, PUVM pUVM, PCVMMR3VTABLE pVMM); 100 101 bool HasId(const char *pszId) { return RTStrCmp(pszId, mszUuid) == 0;} 102 103 EUSBDEVICESTATUS enmStatus; 106 104 }; 107 105 108 static int emulatedWebcamInsertSettings(PCFGMNODE pConfig, EUSBSettingsMap *pSettings) 109 { 110 int rc = VINF_SUCCESS; 111 112 EUSBSettingsMap::const_iterator it; 113 for (it = pSettings->begin(); it != pSettings->end(); ++it) 106 107 static int emulatedWebcamInsertSettings(PCFGMNODE pConfig, PCVMMR3VTABLE pVMM, EUSBSettingsMap *pSettings) 108 { 109 for (EUSBSettingsMap::const_iterator it = pSettings->begin(); it != pSettings->end(); ++it) 114 110 { 115 111 /* Convert some well known settings for backward compatibility. */ 112 int rc; 116 113 if ( RTStrCmp(it->first.c_str(), "MaxPayloadTransferSize") == 0 117 114 || RTStrCmp(it->first.c_str(), "MaxFramerate") == 0) … … 120 117 rc = RTStrToUInt32Full(it->second.c_str(), 10, &u32); 121 118 if (rc == VINF_SUCCESS) 122 { 123 rc = CFGMR3InsertInteger(pConfig, it->first.c_str(), u32); 124 } 125 else 126 { 127 if (RT_SUCCESS(rc)) /* VWRN_* */ 128 { 129 rc = VERR_INVALID_PARAMETER; 130 } 131 } 119 rc = pVMM->pfnCFGMR3InsertInteger(pConfig, it->first.c_str(), u32); 120 else if (RT_SUCCESS(rc)) /* VWRN_* */ 121 rc = VERR_INVALID_PARAMETER; 132 122 } 133 123 else 134 { 135 rc = CFGMR3InsertString(pConfig, it->first.c_str(), it->second.c_str()); 136 } 137 124 rc = pVMM->pfnCFGMR3InsertString(pConfig, it->first.c_str(), it->second.c_str()); 138 125 if (RT_FAILURE(rc)) 139 { 140 break; 141 } 142 } 143 144 return rc; 145 } 146 147 /* static */ DECLCALLBACK(int) EUSBWEBCAM::emulatedWebcamAttach(PUVM pUVM, EUSBWEBCAM *pThis, const char *pszDriver) 148 { 149 PCFGMNODE pInstance = CFGMR3CreateTree(pUVM); 126 return rc; 127 } 128 129 return VINF_SUCCESS; 130 } 131 132 /*static*/ DECLCALLBACK(int) 133 EUSBWEBCAM::emulatedWebcamAttach(PUVM pUVM, PCVMMR3VTABLE pVMM, EUSBWEBCAM *pThis, const char *pszDriver) 134 { 135 PCFGMNODE pInstance = pVMM->pfnCFGMR3CreateTree(pUVM); 150 136 PCFGMNODE pConfig; 151 CFGMR3InsertNode(pInstance, "Config", &pConfig); 152 int rc = emulatedWebcamInsertSettings(pConfig, &pThis->mDevSettings); 153 if (RT_FAILURE(rc)) 154 return rc; 137 int rc = pVMM->pfnCFGMR3InsertNode(pInstance, "Config", &pConfig); 138 AssertRCReturn(rc, rc); 139 rc = emulatedWebcamInsertSettings(pConfig, pVMM, &pThis->mDevSettings); 140 AssertRCReturn(rc, rc); 141 155 142 PCFGMNODE pEUSB; 156 CFGMR3InsertNode(pConfig, "EmulatedUSB", &pEUSB); 157 CFGMR3InsertString(pEUSB, "Id", pThis->mszUuid); 158 CFGMR3InsertInteger(pEUSB, "pfnCallback", (uintptr_t)EmulatedUSB::i_eusbCallback); 159 CFGMR3InsertInteger(pEUSB, "pvCallback", (uintptr_t)pThis->mpEmulatedUSB); 143 rc = pVMM->pfnCFGMR3InsertNode(pConfig, "EmulatedUSB", &pEUSB); 144 AssertRCReturn(rc, rc); 145 rc = pVMM->pfnCFGMR3InsertString(pEUSB, "Id", pThis->mszUuid); 146 AssertRCReturn(rc, rc); 147 /** @todo BUGBUG: No pointers via CFGM in 7.0! */ 148 rc = pVMM->pfnCFGMR3InsertInteger(pEUSB, "pfnCallback", (uintptr_t)EmulatedUSB::i_eusbCallback); 149 AssertRCReturn(rc, rc); 150 rc = pVMM->pfnCFGMR3InsertInteger(pEUSB, "pvCallback", (uintptr_t)pThis->mpEmulatedUSB); 151 AssertRCReturn(rc, rc); 160 152 161 153 PCFGMNODE pLunL0; 162 CFGMR3InsertNode(pInstance, "LUN#0", &pLunL0); 163 CFGMR3InsertString(pLunL0, "Driver", pszDriver); 164 CFGMR3InsertNode(pLunL0, "Config", &pConfig); 165 CFGMR3InsertString(pConfig, "DevicePath", pThis->mPath.c_str()); 166 CFGMR3InsertInteger(pConfig, "Object", (uintptr_t)pThis->mpvObject); 167 rc = emulatedWebcamInsertSettings(pConfig, &pThis->mDrvSettings); 168 if (RT_FAILURE(rc)) 169 return rc; 154 rc = pVMM->pfnCFGMR3InsertNode(pInstance, "LUN#0", &pLunL0); 155 AssertRCReturn(rc, rc); 156 rc = pVMM->pfnCFGMR3InsertString(pLunL0, "Driver", pszDriver); 157 AssertRCReturn(rc, rc); 158 rc = pVMM->pfnCFGMR3InsertNode(pLunL0, "Config", &pConfig); 159 AssertRCReturn(rc, rc); 160 rc = pVMM->pfnCFGMR3InsertString(pConfig, "DevicePath", pThis->mPath.c_str()); 161 AssertRCReturn(rc, rc); 162 /** @todo BUGBUG: No pointers via CFGM in 7.0! */ 163 rc = pVMM->pfnCFGMR3InsertInteger(pConfig, "Object", (uintptr_t)pThis->mpvObject); 164 AssertRCReturn(rc, rc); 165 rc = emulatedWebcamInsertSettings(pConfig, pVMM, &pThis->mDrvSettings); 166 AssertRCReturn(rc, rc); 170 167 171 168 /* pInstance will be used by PDM and deallocated on error. */ 172 rc = PDMR3UsbCreateEmulatedDevice(pUVM, "Webcam", pInstance, &pThis->mUuid, NULL);169 rc = pVMM->pfnPDMR3UsbCreateEmulatedDevice(pUVM, "Webcam", pInstance, &pThis->mUuid, NULL); 173 170 LogRelFlowFunc(("PDMR3UsbCreateEmulatedDevice %Rrc\n", rc)); 174 171 return rc; 175 172 } 176 173 177 /* static */ DECLCALLBACK(int) EUSBWEBCAM::emulatedWebcamDetach(PUVM pUVM, EUSBWEBCAM *pThis) 178 { 179 return PDMR3UsbDetachDevice(pUVM, &pThis->mUuid); 174 /*static*/ DECLCALLBACK(int) 175 EUSBWEBCAM::emulatedWebcamDetach(PUVM pUVM, PCVMMR3VTABLE pVMM, EUSBWEBCAM *pThis) 176 { 177 return pVMM->pfnPDMR3UsbDetachDevice(pUVM, &pThis->mUuid); 180 178 } 181 179 … … 189 187 190 188 int vrc = RTUuidCreate(&mUuid); 191 if (RT_SUCCESS(vrc)) 192 { 193 RTStrPrintf(mszUuid, sizeof(mszUuid), "%RTuuid", &mUuid); 194 hrc = mPath.assignEx(*aPath); 189 AssertRCReturn(vrc, pConsole->setError(vrc, EmulatedUSB::tr("Init emulated USB webcam (RTUuidCreate -> %Rrc)"), vrc)); 190 191 RTStrPrintf(mszUuid, sizeof(mszUuid), "%RTuuid", &mUuid); 192 hrc = mPath.assignEx(*aPath); 193 if (SUCCEEDED(hrc)) 194 { 195 hrc = mSettings.assignEx(*aSettings); 195 196 if (SUCCEEDED(hrc)) 196 197 { 197 hrc = mSettings.assignEx(*aSettings);198 }199 200 if (SUCCEEDED(hrc))201 {202 198 hrc = settingsParse(); 203 204 199 if (SUCCEEDED(hrc)) 205 200 { … … 208 203 } 209 204 } 210 }211 212 if (SUCCEEDED(hrc) && RT_FAILURE(vrc))213 {214 LogFlowThisFunc(("%Rrc\n", vrc));215 hrc = pConsole->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, EmulatedUSB::tr("Init emulated USB webcam (%Rrc)"), vrc);216 205 } 217 206 … … 246 235 } 247 236 248 char *pszEq = RTStrStr(pszSrc, "=");237 char *pszEq = strchr(pszSrc, '='); 249 238 if (!pszEq) 250 239 { … … 253 242 } 254 243 255 char *pszEnd = RTStrStr(pszEq, ";");244 char *pszEnd = strchr(pszEq, ';'); 256 245 if (!pszEnd) 257 {258 246 pszEnd = pszEq + strlen(pszEq); 259 }260 247 261 248 *pszEq = 0; … … 267 254 { 268 255 if (fDev) 269 {270 256 mDevSettings[pszSrc] = &pszEq[1]; 271 }272 257 if (fDrv) 273 {274 258 mDrvSettings[pszSrc] = &pszEq[1]; 275 }276 259 } 277 260 … … 281 264 pszSrc = pszEnd; 282 265 if (*pszSrc == ';') 283 {284 266 pszSrc++; 285 }286 267 } 287 268 … … 299 280 } 300 281 301 HRESULT EUSBWEBCAM::Attach(Console *pConsole, 302 PUVM pUVM, 303 const char *pszDriver) 304 { 305 HRESULT hrc = S_OK; 306 307 int vrc = VMR3ReqCallWaitU(pUVM, 0 /* idDstCpu (saved state, see #6232) */, 308 (PFNRT)emulatedWebcamAttach, 3, 309 pUVM, this, pszDriver); 310 311 if (SUCCEEDED(hrc) && RT_FAILURE(vrc)) 312 { 313 LogFlowThisFunc(("%Rrc\n", vrc)); 314 hrc = pConsole->setErrorBoth(VBOX_E_VM_ERROR, vrc, EmulatedUSB::tr("Attach emulated USB webcam (%Rrc)"), vrc); 315 } 316 317 return hrc; 318 } 319 320 HRESULT EUSBWEBCAM::Detach(Console *pConsole, 321 PUVM pUVM) 322 { 323 HRESULT hrc = S_OK; 324 325 int vrc = VMR3ReqCallWaitU(pUVM, 0 /* idDstCpu (saved state, see #6232) */, 326 (PFNRT)emulatedWebcamDetach, 2, 327 pUVM, this); 328 329 if (SUCCEEDED(hrc) && RT_FAILURE(vrc)) 330 { 331 LogFlowThisFunc(("%Rrc\n", vrc)); 332 hrc = pConsole->setErrorBoth(VBOX_E_VM_ERROR, vrc, EmulatedUSB::tr("Detach emulated USB webcam (%Rrc)"), vrc); 333 } 334 335 return hrc; 282 HRESULT EUSBWEBCAM::Attach(Console *pConsole, PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDriver) 283 { 284 int vrc = pVMM->pfnVMR3ReqCallWaitU(pUVM, 0 /* idDstCpu (saved state, see #6232) */, 285 (PFNRT)emulatedWebcamAttach, 4, 286 pUVM, pVMM, this, pszDriver); 287 if (RT_SUCCESS(vrc)) 288 return S_OK; 289 LogFlowThisFunc(("%Rrc\n", vrc)); 290 return pConsole->setErrorBoth(VBOX_E_VM_ERROR, vrc, EmulatedUSB::tr("Attach emulated USB webcam (%Rrc)"), vrc); 291 } 292 293 HRESULT EUSBWEBCAM::Detach(Console *pConsole, PUVM pUVM, PCVMMR3VTABLE pVMM) 294 { 295 int vrc = pVMM->pfnVMR3ReqCallWaitU(pUVM, 0 /* idDstCpu (saved state, see #6232) */, 296 (PFNRT)emulatedWebcamDetach, 3, 297 pUVM, pVMM, this); 298 if (RT_SUCCESS(vrc)) 299 return S_OK; 300 LogFlowThisFunc(("%Rrc\n", vrc)); 301 return pConsole->setErrorBoth(VBOX_E_VM_ERROR, vrc, EmulatedUSB::tr("Detach emulated USB webcam (%Rrc)"), vrc); 336 302 } 337 303 … … 488 454 489 455 if (SUCCEEDED(hrc)) 490 { 491 hrc = p->Attach(m.pConsole, ptrVM.rawUVM(), pszDriver); 492 } 456 hrc = p->Attach(m.pConsole, ptrVM.rawUVM(), ptrVM.vtable(), pszDriver); 493 457 494 458 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 495 459 if (SUCCEEDED(hrc)) 496 {497 460 p->enmStatus = EUSBDEVICE_ATTACHED; 498 } 499 else 500 { 501 if (p->enmStatus != EUSBDEVICE_CREATED) 502 { 503 m.webcams.erase(path); 504 } 505 } 461 else if (p->enmStatus != EUSBDEVICE_CREATED) 462 m.webcams.erase(path); 506 463 alock.release(); 507 464 … … 551 508 if (p) 552 509 { 553 hrc = p->Detach(m.pConsole, ptrVM.rawUVM() );510 hrc = p->Detach(m.pConsole, ptrVM.rawUVM(), ptrVM.vtable()); 554 511 p->Release(); 555 512 } … … 567 524 } 568 525 569 /* static */ DECLCALLBACK(int) EmulatedUSB::eusbCallbackEMT(EmulatedUSB *pThis, char *pszId, uint32_t iEvent,570 526 /*static*/ DECLCALLBACK(int) 527 EmulatedUSB::eusbCallbackEMT(EmulatedUSB *pThis, char *pszId, uint32_t iEvent, void *pvData, uint32_t cbData) 571 528 { 572 529 LogRelFlowFunc(("id %s event %d, data %p %d\n", pszId, iEvent, pvData, cbData)); … … 604 561 } 605 562 606 /* static */ DECLCALLBACK(int) EmulatedUSB::i_eusbCallback(void *pv, const char *pszId, uint32_t iEvent,607 563 /* static */ DECLCALLBACK(int) 564 EmulatedUSB::i_eusbCallback(void *pv, const char *pszId, uint32_t iEvent, const void *pvData, uint32_t cbData) 608 565 { 609 566 /* Make a copy of parameters, forward to EMT and leave the callback to not hold any lock in the device. */ 610 567 int rc = VINF_SUCCESS; 611 612 void *pvIdCopy = NULL;613 568 void *pvDataCopy = NULL; 614 569 if (cbData > 0) … … 616 571 pvDataCopy = RTMemDup(pvData, cbData); 617 572 if (!pvDataCopy) 618 {619 573 rc = VERR_NO_MEMORY; 620 } 621 } 622 574 } 623 575 if (RT_SUCCESS(rc)) 624 576 { 625 pvIdCopy = RTMemDup(pszId, strlen(pszId) + 1); 626 if (!pvIdCopy) 627 { 577 void *pvIdCopy = RTMemDup(pszId, strlen(pszId) + 1); 578 if (pvIdCopy) 579 { 580 if (RT_SUCCESS(rc)) 581 { 582 EmulatedUSB *pThis = (EmulatedUSB *)pv; 583 Console::SafeVMPtr ptrVM(pThis->m.pConsole); 584 if (ptrVM.isOk()) 585 { 586 /* No wait. */ 587 rc = ptrVM.vtable()->pfnVMR3ReqCallNoWaitU(ptrVM.rawUVM(), 0 /* idDstCpu */, 588 (PFNRT)EmulatedUSB::eusbCallbackEMT, 5, 589 pThis, pvIdCopy, iEvent, pvDataCopy, cbData); 590 if (RT_SUCCESS(rc)) 591 return rc; 592 } 593 else 594 rc = VERR_INVALID_STATE; 595 } 596 RTMemFree(pvIdCopy); 597 } 598 else 628 599 rc = VERR_NO_MEMORY; 629 }630 }631 632 if (RT_SUCCESS(rc))633 {634 EmulatedUSB *pThis = (EmulatedUSB *)pv;635 Console::SafeVMPtr ptrVM(pThis->m.pConsole);636 if (ptrVM.isOk())637 {638 /* No wait. */639 rc = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), 0 /* idDstCpu */,640 (PFNRT)EmulatedUSB::eusbCallbackEMT, 5,641 pThis, pvIdCopy, iEvent, pvDataCopy, cbData);642 }643 else644 {645 rc = VERR_INVALID_STATE;646 }647 }648 649 if (RT_FAILURE(rc))650 {651 RTMemFree(pvIdCopy);652 600 RTMemFree(pvDataCopy); 653 601 } 654 655 602 return rc; 656 603 } -
trunk/src/VBox/Main/src-client/GuestImpl.cpp
r93115 r93444 41 41 #include <iprt/timer.h> 42 42 #include <VBox/vmm/pgm.h> 43 #include <VBox/vmm/vmmr3vtable.h> 43 44 #include <VBox/version.h> 44 45 … … 311 312 /* Query the missing per-VM memory statistics. */ 312 313 uint64_t cbTotalMemIgn, cbPrivateMemIgn, cbZeroMemIgn; 313 rc = PGMR3QueryMemoryStats(ptrVM.rawUVM(), &cbTotalMemIgn, &cbPrivateMemIgn, &cbSharedMem, &cbZeroMemIgn); 314 rc = ptrVM.vtable()->pfnPGMR3QueryMemoryStats(ptrVM.rawUVM(), &cbTotalMemIgn, &cbPrivateMemIgn, 315 &cbSharedMem, &cbZeroMemIgn); 314 316 if (rc == VINF_SUCCESS) 315 317 validStats |= pm::VMSTATMASK_GUEST_MEMSHARED; … … 318 320 if (mCollectVMMStats) 319 321 { 320 rc = PGMR3QueryGlobalMemoryStats(ptrVM.rawUVM(), &cbAllocTotal, &cbFreeTotal, &cbBalloonedTotal, &cbSharedTotal); 322 rc = ptrVM.vtable()->pfnPGMR3QueryGlobalMemoryStats(ptrVM.rawUVM(), &cbAllocTotal, &cbFreeTotal, 323 &cbBalloonedTotal, &cbSharedTotal); 321 324 AssertRC(rc); 322 325 if (rc == VINF_SUCCESS) … … 328 331 uint64_t uTxPrev = mNetStatTx; 329 332 mNetStatRx = mNetStatTx = 0; 330 rc = STAMR3Enum(ptrVM.rawUVM(), "/Public/Net/*/Bytes*", i_staticEnumStatsCallback, this);333 rc = ptrVM.vtable()->pfnSTAMR3Enum(ptrVM.rawUVM(), "/Public/Net/*/Bytes*", i_staticEnumStatsCallback, this); 331 334 AssertRC(rc); 332 335 … … 706 709 707 710 uint64_t cbFreeTotal, cbAllocTotal, cbBalloonedTotal, cbSharedTotal; 708 int rc = PGMR3QueryGlobalMemoryStats(ptrVM.rawUVM(), &cbAllocTotal, &cbFreeTotal, &cbBalloonedTotal, &cbSharedTotal); 711 int rc = ptrVM.vtable()->pfnPGMR3QueryGlobalMemoryStats(ptrVM.rawUVM(), &cbAllocTotal, &cbFreeTotal, 712 &cbBalloonedTotal, &cbSharedTotal); 709 713 AssertRCReturn(rc, E_FAIL); 710 714 … … 716 720 /* Query the missing per-VM memory statistics. */ 717 721 uint64_t cbTotalMemIgn, cbPrivateMemIgn, cbSharedMem, cbZeroMemIgn; 718 rc = PGMR3QueryMemoryStats(ptrVM.rawUVM(), &cbTotalMemIgn, &cbPrivateMemIgn, &cbSharedMem, &cbZeroMemIgn);722 rc = ptrVM.vtable()->pfnPGMR3QueryMemoryStats(ptrVM.rawUVM(), &cbTotalMemIgn, &cbPrivateMemIgn, &cbSharedMem, &cbZeroMemIgn); 719 723 AssertRCReturn(rc, E_FAIL); 720 724 *aMemShared = (ULONG)(cbSharedMem / _1K); -
trunk/src/VBox/Main/src-client/HGCM.cpp
r93115 r93444 26 26 #include <VBox/vmm/ssm.h> 27 27 #include <VBox/vmm/stam.h> 28 #include <VBox/vmm/vmmr3vtable.h> 28 29 #include <VBox/sup.h> 29 30 #include <VBox/AssertGuest.h> … … 124 125 125 126 PUVM m_pUVM; 127 PCVMMR3VTABLE m_pVMM; 126 128 PPDMIHGCMPORT m_pHgcmPort; 127 129 … … 139 141 * Main HGCM thread methods. 140 142 */ 141 int instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM, PPDMIHGCMPORT pHgcmPort); 143 int instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, 144 PUVM pUVM, PCVMMR3VTABLE pVMM, PPDMIHGCMPORT pHgcmPort); 145 void registerStatistics(const char *pszServiceName, PUVM pUVM, PCVMMR3VTABLE pVMM); 142 146 void instanceDestroy(void); 143 147 144 int saveClientState(uint32_t u32ClientId, PSSMHANDLE pSSM );145 int loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM, uint32_t uVersion);148 int saveClientState(uint32_t u32ClientId, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM); 149 int loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion); 146 150 147 151 HGCMService(); … … 167 171 * Main HGCM thread methods. 168 172 */ 169 static int LoadService(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM, PPDMIHGCMPORT pHgcmPort); 173 static int LoadService(const char *pszServiceLibrary, const char *pszServiceName, 174 PUVM pUVM, PCVMMR3VTABLE pVMM, PPDMIHGCMPORT pHgcmPort); 170 175 void UnloadService(bool fUvmIsInvalid); 171 176 … … 178 183 static void Reset(void); 179 184 180 static int SaveState(PSSMHANDLE pSSM );181 static int LoadState(PSSMHANDLE pSSM, uint32_t uVersion);185 static int SaveState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM); 186 static int LoadState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion); 182 187 183 188 int CreateAndConnectClient(uint32_t *pu32ClientIdOut, uint32_t u32ClientIdIn, uint32_t fRequestor, bool fRestoring); … … 324 329 m_hExtension (NULL), 325 330 m_pUVM (NULL), 331 m_pVMM (NULL), 326 332 m_pHgcmPort (NULL) 327 333 { … … 587 593 { 588 594 public: 589 PSSMHANDLE pSSM; 590 uint32_t uVersion; 591 uint32_t u32ClientId; 595 PSSMHANDLE pSSM; 596 PCVMMR3VTABLE pVMM; 597 uint32_t uVersion; 598 uint32_t u32ClientId; 592 599 }; 593 600 … … 808 815 bool fHaveClientState = pSvc->m_fntable.pfnLoadState != NULL; 809 816 if (pMsg->uVersion > HGCM_SAVED_STATE_VERSION_V2) 810 rc = SSMR3GetBool(pMsg->pSSM, &fHaveClientState);817 rc = pMsg->pVMM->pfnSSMR3GetBool(pMsg->pSSM, &fHaveClientState); 811 818 else 812 819 rc = VINF_SUCCESS; … … 815 822 if (pSvc->m_fntable.pfnLoadState) 816 823 rc = pSvc->m_fntable.pfnLoadState(pSvc->m_fntable.pvService, pMsg->u32ClientId, 817 HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM, 824 HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM, pMsg->pVMM, 818 825 fHaveClientState ? pMsg->uVersion : 0); 819 826 else … … 840 847 if (pClient) 841 848 { 842 SSMR3PutU32(pMsg->pSSM, pClient->fRequestor); /* Quicker to save this here than in the message sender. */843 rc = SSMR3PutBool(pMsg->pSSM, pSvc->m_fntable.pfnSaveState != NULL);849 pMsg->pVMM->pfnSSMR3PutU32(pMsg->pSSM, pClient->fRequestor); /* Quicker to save this here than in the message sender. */ 850 rc = pMsg->pVMM->pfnSSMR3PutBool(pMsg->pSSM, pSvc->m_fntable.pfnSaveState != NULL); 844 851 if (RT_SUCCESS(rc) && pSvc->m_fntable.pfnSaveState) 845 852 { 846 853 g_fSaveState = true; 847 854 rc = pSvc->m_fntable.pfnSaveState(pSvc->m_fntable.pvService, pMsg->u32ClientId, 848 HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM );855 HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM, pMsg->pVMM); 849 856 g_fSaveState = false; 850 857 } … … 1024 1031 AssertPtrReturn(pService, VERR_INVALID_PARAMETER); 1025 1032 1026 return STAMR3RegisterVU(pService->m_pUVM, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va); 1033 if (pService->m_pUVM) 1034 return pService->m_pVMM->pfnSTAMR3RegisterVU(pService->m_pUVM, pvSample, enmType, enmVisibility, 1035 enmUnit, pszDesc, pszName, va); 1036 return VINF_SUCCESS; 1027 1037 } 1028 1038 … … 1036 1046 1037 1047 if (pService->m_pUVM) 1038 return STAMR3DeregisterV(pService->m_pUVM, pszPatFmt, va);1048 return pService->m_pVMM->pfnSTAMR3DeregisterV(pService->m_pUVM, pszPatFmt, va); 1039 1049 return VINF_SUCCESS; 1040 1050 } … … 1049 1059 AssertPtrReturn(pService, VERR_INVALID_PARAMETER); 1050 1060 1051 return DBGFR3InfoRegisterExternal(pService->m_pUVM, pszName, pszDesc, pfnHandler, pvUser); 1061 if (pService->m_pUVM) 1062 return pService->m_pVMM->pfnDBGFR3InfoRegisterExternal(pService->m_pUVM, pszName, pszDesc, pfnHandler, pvUser); 1063 return VINF_SUCCESS; 1052 1064 } 1053 1065 … … 1060 1072 AssertPtrReturn(pService, VERR_INVALID_PARAMETER); 1061 1073 if (pService->m_pUVM) 1062 return DBGFR3InfoDeregisterExternal(pService->m_pUVM, pszName);1074 return pService->m_pVMM->pfnDBGFR3InfoDeregisterExternal(pService->m_pUVM, pszName); 1063 1075 return VINF_SUCCESS; 1064 1076 } … … 1117 1129 */ 1118 1130 1119 int HGCMService::instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM, PPDMIHGCMPORT pHgcmPort) 1131 int HGCMService::instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, 1132 PUVM pUVM, PCVMMR3VTABLE pVMM, PPDMIHGCMPORT pHgcmPort) 1120 1133 { 1121 1134 LogFlowFunc(("name %s, lib %s\n", pszServiceName, pszServiceLibrary)); 1135 1122 1136 /* The maximum length of the thread name, allowed by the RT is 15. */ 1123 1137 char szThreadName[16]; … … 1129 1143 RTStrCopy(szThreadName, sizeof(szThreadName), pszServiceName); 1130 1144 1131 int rc = hgcmThreadCreate(&m_pThread, szThreadName, hgcmServiceThread, this, pszServiceName, pUVM); 1132 1145 int rc = hgcmThreadCreate(&m_pThread, szThreadName, hgcmServiceThread, this, pszServiceName, pUVM, pVMM); 1133 1146 if (RT_SUCCESS(rc)) 1134 1147 { … … 1149 1162 { 1150 1163 m_pUVM = pUVM; 1164 m_pVMM = pVMM; 1151 1165 m_pHgcmPort = pHgcmPort; 1152 1166 1153 /* Register statistics: */ 1154 STAMR3RegisterFU(pUVM, &m_StatHandleMsg, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, 1155 "Message handling", "/HGCM/%s/Msg", pszServiceName); 1156 STAMR3RegisterFU(pUVM, &m_StatTooManyCalls, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1157 "Too many calls (per client)", "/HGCM/%s/TooManyCalls", pszServiceName); 1158 STAMR3RegisterFU(pUVM, &m_StatTooManyClients, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1159 "Too many clients", "/HGCM/%s/TooManyClients", pszServiceName); 1160 STAMR3RegisterFU(pUVM, &m_cClients, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1161 "Number of clients", "/HGCM/%s/Clients", pszServiceName); 1162 STAMR3RegisterFU(pUVM, &m_acClients[HGCM_CLIENT_CATEGORY_KERNEL], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1163 STAMUNIT_OCCURENCES, "Number of kernel clients", "/HGCM/%s/Clients/Kernel", pszServiceName); 1164 STAMR3RegisterFU(pUVM, &m_acClients[HGCM_CLIENT_CATEGORY_ROOT], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1165 STAMUNIT_OCCURENCES, "Number of root/admin clients", "/HGCM/%s/Clients/Root", pszServiceName); 1166 STAMR3RegisterFU(pUVM, &m_acClients[HGCM_CLIENT_CATEGORY_USER], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1167 STAMUNIT_OCCURENCES, "Number of regular user clients", "/HGCM/%s/Clients/User", pszServiceName); 1168 STAMR3RegisterFU(pUVM, &m_fntable.acMaxClients[HGCM_CLIENT_CATEGORY_KERNEL], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1169 STAMUNIT_OCCURENCES, "Max number of kernel clients", "/HGCM/%s/Clients/KernelMax", pszServiceName); 1170 STAMR3RegisterFU(pUVM, &m_fntable.acMaxClients[HGCM_CLIENT_CATEGORY_ROOT], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1171 STAMUNIT_OCCURENCES, "Max number of root clients", "/HGCM/%s/Clients/RootMax", pszServiceName); 1172 STAMR3RegisterFU(pUVM, &m_fntable.acMaxClients[HGCM_CLIENT_CATEGORY_USER], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1173 STAMUNIT_OCCURENCES, "Max number of user clients", "/HGCM/%s/Clients/UserMax", pszServiceName); 1174 STAMR3RegisterFU(pUVM, &m_fntable.idxLegacyClientCategory, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1175 STAMUNIT_OCCURENCES, "Legacy client mapping", "/HGCM/%s/Clients/LegacyClientMapping", pszServiceName); 1176 STAMR3RegisterFU(pUVM, &m_fntable.acMaxCallsPerClient[HGCM_CLIENT_CATEGORY_KERNEL], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1177 STAMUNIT_OCCURENCES, "Max number of call per kernel client", "/HGCM/%s/MaxCallsKernelClient", pszServiceName); 1178 STAMR3RegisterFU(pUVM, &m_fntable.acMaxCallsPerClient[HGCM_CLIENT_CATEGORY_ROOT], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1179 STAMUNIT_OCCURENCES, "Max number of call per root client", "/HGCM/%s/MaxCallsRootClient", pszServiceName); 1180 STAMR3RegisterFU(pUVM, &m_fntable.acMaxCallsPerClient[HGCM_CLIENT_CATEGORY_USER], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1181 STAMUNIT_OCCURENCES, "Max number of call per user client", "/HGCM/%s/MaxCallsUserClient", pszServiceName); 1167 registerStatistics(pszServiceName, pUVM, pVMM); 1182 1168 1183 1169 /* Initialize service helpers table. */ … … 1218 1204 } 1219 1205 1206 /** Called by HGCMService::instanceCreate to register statistics. */ 1207 void HGCMService::registerStatistics(const char *pszServiceName, PUVM pUVM, PCVMMR3VTABLE pVMM) 1208 { 1209 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_StatHandleMsg, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, 1210 "Message handling", "/HGCM/%s/Msg", pszServiceName); 1211 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_StatTooManyCalls, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1212 "Too many calls (per client)", "/HGCM/%s/TooManyCalls", pszServiceName); 1213 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_StatTooManyClients, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1214 "Too many clients", "/HGCM/%s/TooManyClients", pszServiceName); 1215 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_cClients, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1216 "Number of clients", "/HGCM/%s/Clients", pszServiceName); 1217 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_acClients[HGCM_CLIENT_CATEGORY_KERNEL], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1218 STAMUNIT_OCCURENCES, "Number of kernel clients", "/HGCM/%s/Clients/Kernel", pszServiceName); 1219 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_acClients[HGCM_CLIENT_CATEGORY_ROOT], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1220 STAMUNIT_OCCURENCES, "Number of root/admin clients", "/HGCM/%s/Clients/Root", pszServiceName); 1221 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_acClients[HGCM_CLIENT_CATEGORY_USER], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1222 STAMUNIT_OCCURENCES, "Number of regular user clients", "/HGCM/%s/Clients/User", pszServiceName); 1223 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_fntable.acMaxClients[HGCM_CLIENT_CATEGORY_KERNEL], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1224 STAMUNIT_OCCURENCES, "Max number of kernel clients", "/HGCM/%s/Clients/KernelMax", pszServiceName); 1225 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_fntable.acMaxClients[HGCM_CLIENT_CATEGORY_ROOT], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1226 STAMUNIT_OCCURENCES, "Max number of root clients", "/HGCM/%s/Clients/RootMax", pszServiceName); 1227 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_fntable.acMaxClients[HGCM_CLIENT_CATEGORY_USER], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1228 STAMUNIT_OCCURENCES, "Max number of user clients", "/HGCM/%s/Clients/UserMax", pszServiceName); 1229 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_fntable.idxLegacyClientCategory, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1230 STAMUNIT_OCCURENCES, "Legacy client mapping", "/HGCM/%s/Clients/LegacyClientMapping", pszServiceName); 1231 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_fntable.acMaxCallsPerClient[HGCM_CLIENT_CATEGORY_KERNEL], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1232 STAMUNIT_OCCURENCES, "Max number of call per kernel client", "/HGCM/%s/MaxCallsKernelClient", pszServiceName); 1233 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_fntable.acMaxCallsPerClient[HGCM_CLIENT_CATEGORY_ROOT], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1234 STAMUNIT_OCCURENCES, "Max number of call per root client", "/HGCM/%s/MaxCallsRootClient", pszServiceName); 1235 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_fntable.acMaxCallsPerClient[HGCM_CLIENT_CATEGORY_USER], STAMTYPE_U32, STAMVISIBILITY_ALWAYS, 1236 STAMUNIT_OCCURENCES, "Max number of call per user client", "/HGCM/%s/MaxCallsUserClient", pszServiceName); 1237 } 1238 1220 1239 void HGCMService::instanceDestroy(void) 1221 1240 { … … 1234 1253 1235 1254 if (m_pszSvcName && m_pUVM) 1236 STAMR3DeregisterF(m_pUVM, "/HGCM/%s/*", m_pszSvcName);1255 m_pVMM->pfnSTAMR3DeregisterF(m_pUVM, "/HGCM/%s/*", m_pszSvcName); 1237 1256 m_pUVM = NULL; 1238 1257 m_pHgcmPort = NULL; … … 1251 1270 } 1252 1271 1253 int HGCMService::saveClientState(uint32_t u32ClientId, PSSMHANDLE pSSM )1272 int HGCMService::saveClientState(uint32_t u32ClientId, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM) 1254 1273 { 1255 1274 LogFlowFunc(("%s\n", m_pszSvcName)); … … 1264 1283 pMsg->u32ClientId = u32ClientId; 1265 1284 pMsg->pSSM = pSSM; 1285 pMsg->pVMM = pVMM; 1266 1286 1267 1287 rc = hgcmMsgSend(pMsg); … … 1272 1292 } 1273 1293 1274 int HGCMService::loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM, uint32_t uVersion)1294 int HGCMService::loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion) 1275 1295 { 1276 1296 LogFlowFunc(("%s\n", m_pszSvcName)); … … 1284 1304 1285 1305 pMsg->pSSM = pSSM; 1306 pMsg->pVMM = pVMM; 1286 1307 pMsg->uVersion = uVersion; 1287 1308 pMsg->u32ClientId = u32ClientId; … … 1300 1321 * @param pszServiceName The name of the service. 1301 1322 * @param pUVM The user mode VM handle (for statistics and such). 1323 * @param pVMM The VMM vtable (for statistics and such). 1302 1324 * @param pHgcmPort The VMMDev HGCM port interface. 1303 1325 * … … 1306 1328 */ 1307 1329 /* static */ int HGCMService::LoadService(const char *pszServiceLibrary, const char *pszServiceName, 1308 PUVM pUVM, P PDMIHGCMPORT pHgcmPort)1330 PUVM pUVM, PCVMMR3VTABLE pVMM, PPDMIHGCMPORT pHgcmPort) 1309 1331 { 1310 1332 LogFlowFunc(("lib %s, name = %s, pUVM = %p\n", pszServiceLibrary, pszServiceName, pUVM)); … … 1333 1355 { 1334 1356 /* Load the library and call the initialization entry point. */ 1335 rc = pSvc->instanceCreate(pszServiceLibrary, pszServiceName, pUVM, pHgcmPort); 1336 1357 rc = pSvc->instanceCreate(pszServiceLibrary, pszServiceName, pUVM, pVMM, pHgcmPort); 1337 1358 if (RT_SUCCESS(rc)) 1338 1359 { … … 1342 1363 1343 1364 if (sm_pSvcListHead) 1344 {1345 1365 sm_pSvcListHead->m_pSvcPrev = pSvc; 1346 }1347 1366 else 1348 {1349 1367 sm_pSvcListTail = pSvc; 1350 }1351 1368 1352 1369 sm_pSvcListHead = pSvc; … … 1531 1548 * 1532 1549 * @param pSSM The saved state context. 1533 * @return VBox rc. 1550 * @param pVMM The VMM vtable. 1551 * @return VBox status code. 1534 1552 * @thread main HGCM 1535 1553 */ 1536 /* static */ int HGCMService::SaveState(PSSMHANDLE pSSM )1554 /* static */ int HGCMService::SaveState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM) 1537 1555 { 1538 1556 /* Save the current handle count and restore afterwards to avoid client id conflicts. */ 1539 int rc = SSMR3PutU32(pSSM, hgcmObjQueryHandleCount());1557 int rc = pVMM->pfnSSMR3PutU32(pSSM, hgcmObjQueryHandleCount()); 1540 1558 AssertRCReturn(rc, rc); 1541 1559 … … 1543 1561 1544 1562 /* Save number of services. */ 1545 rc = SSMR3PutU32(pSSM, sm_cServices);1563 rc = pVMM->pfnSSMR3PutU32(pSSM, sm_cServices); 1546 1564 AssertRCReturn(rc, rc); 1547 1565 … … 1554 1572 1555 1573 /* Save the length of the service name. */ 1556 rc = SSMR3PutU32(pSSM, (uint32_t) strlen(pSvc->m_pszSvcName) + 1);1574 rc = pVMM->pfnSSMR3PutU32(pSSM, (uint32_t) strlen(pSvc->m_pszSvcName) + 1); 1557 1575 AssertRCReturn(rc, rc); 1558 1576 1559 1577 /* Save the name of the service. */ 1560 rc = SSMR3PutStrZ(pSSM, pSvc->m_pszSvcName);1578 rc = pVMM->pfnSSMR3PutStrZ(pSSM, pSvc->m_pszSvcName); 1561 1579 AssertRCReturn(rc, rc); 1562 1580 1563 1581 /* Save the number of clients. */ 1564 rc = SSMR3PutU32(pSSM, pSvc->m_cClients);1582 rc = pVMM->pfnSSMR3PutU32(pSSM, pSvc->m_cClients); 1565 1583 AssertRCReturn(rc, rc); 1566 1584 … … 1578 1596 1579 1597 /* Save the client id. (fRequestor is saved via SVC_MSG_SAVESTATE for convenience.) */ 1580 rc = SSMR3PutU32(pSSM, u32ClientId);1598 rc = pVMM->pfnSSMR3PutU32(pSSM, u32ClientId); 1581 1599 AssertRCReturn(rc, rc); 1582 1600 1583 1601 /* Call the service, so the operation is executed by the service thread. */ 1584 rc = pSvc->saveClientState(u32ClientId, pSSM );1602 rc = pSvc->saveClientState(u32ClientId, pSSM, pVMM); 1585 1603 AssertRCReturn(rc, rc); 1586 1604 } … … 1595 1613 * 1596 1614 * @param pSSM The saved state handle. 1615 * @param pVMM The VMM vtable. 1597 1616 * @param uVersion The state version being loaded. 1598 * @return VBox rc.1617 * @return VBox status code. 1599 1618 * @thread main HGCM 1600 1619 */ 1601 /* static */ int HGCMService::LoadState(PSSMHANDLE pSSM, uint32_t uVersion)1620 /* static */ int HGCMService::LoadState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion) 1602 1621 { 1603 1622 /* Restore handle count to avoid client id conflicts. */ 1604 1623 uint32_t u32; 1605 1624 1606 int rc = SSMR3GetU32(pSSM, &u32);1625 int rc = pVMM->pfnSSMR3GetU32(pSSM, &u32); 1607 1626 AssertRCReturn(rc, rc); 1608 1627 … … 1612 1631 uint32_t cServices; 1613 1632 1614 rc = SSMR3GetU32(pSSM, &cServices);1633 rc = pVMM->pfnSSMR3GetU32(pSSM, &cServices); 1615 1634 AssertRCReturn(rc, rc); 1616 1635 … … 1620 1639 { 1621 1640 /* Get the length of the service name. */ 1622 rc = SSMR3GetU32(pSSM, &u32);1641 rc = pVMM->pfnSSMR3GetU32(pSSM, &u32); 1623 1642 AssertRCReturn(rc, rc); 1624 1643 AssertReturn(u32 <= VBOX_HGCM_SVC_NAME_MAX_BYTES, VERR_SSM_UNEXPECTED_DATA); … … 1626 1645 /* Get the service name. */ 1627 1646 char szServiceName[VBOX_HGCM_SVC_NAME_MAX_BYTES]; 1628 rc = SSMR3GetStrZ(pSSM, szServiceName, u32);1647 rc = pVMM->pfnSSMR3GetStrZ(pSSM, szServiceName, u32); 1629 1648 AssertRCReturn(rc, rc); 1630 1649 … … 1638 1657 /* Get the number of clients. */ 1639 1658 uint32_t cClients; 1640 rc = SSMR3GetU32(pSSM, &cClients);1659 rc = pVMM->pfnSSMR3GetU32(pSSM, &cClients); 1641 1660 if (RT_FAILURE(rc)) 1642 1661 { … … 1651 1670 but restored here in time for calling CreateAndConnectClient). */ 1652 1671 uint32_t u32ClientId; 1653 rc = SSMR3GetU32(pSSM, &u32ClientId);1672 rc = pVMM->pfnSSMR3GetU32(pSSM, &u32ClientId); 1654 1673 uint32_t fRequestor = VMMDEV_REQUESTOR_LEGACY; 1655 1674 if (RT_SUCCESS(rc) && uVersion > HGCM_SAVED_STATE_VERSION_V2) 1656 rc = SSMR3GetU32(pSSM, &fRequestor);1675 rc = pVMM->pfnSSMR3GetU32(pSSM, &fRequestor); 1657 1676 AssertLogRelMsgRCReturnStmt(rc, ("rc=%Rrc, %s\n", rc, szServiceName), pSvc->ReleaseService(), rc); 1658 1677 … … 1662 1681 1663 1682 /* Call the service, so the operation is executed by the service thread. */ 1664 rc = pSvc->loadClientState(u32ClientId, pSSM, uVersion);1683 rc = pSvc->loadClientState(u32ClientId, pSSM, pVMM, uVersion); 1665 1684 AssertLogRelMsgRCReturnStmt(rc, ("rc=%Rrc, %s\n", rc, szServiceName), pSvc->ReleaseService(), rc); 1666 1685 } … … 2200 2219 /** The user mode VM handle (for statistics and such). */ 2201 2220 PUVM pUVM; 2221 /** The VMM vtable (for statistics and such). */ 2222 PCVMMR3VTABLE pVMM; 2202 2223 /** The HGCM port on the VMMDev device (for session ID and such). */ 2203 2224 PPDMIHGCMPORT pHgcmPort; … … 2222 2243 /** Saved state handle. */ 2223 2244 PSSMHANDLE pSSM; 2245 /** The VMM vtable. */ 2246 PCVMMR3VTABLE pVMM; 2224 2247 /** The HGCM saved state version being loaded (ignore for save). */ 2225 2248 uint32_t uVersion; … … 2373 2396 pMsg->pszServiceName, pMsg->pszServiceLibrary, pMsg->pUVM)); 2374 2397 2375 rc = HGCMService::LoadService(pMsg->pszServiceLibrary, pMsg->pszServiceName, pMsg->pUVM, pMsg->pHgcmPort); 2398 rc = HGCMService::LoadService(pMsg->pszServiceLibrary, pMsg->pszServiceName, 2399 pMsg->pUVM, pMsg->pVMM, pMsg->pHgcmPort); 2376 2400 } break; 2377 2401 … … 2421 2445 LogFlowFunc(("HGCM_MSG_LOADSTATE\n")); 2422 2446 2423 rc = HGCMService::LoadState(pMsg->pSSM, pMsg-> uVersion);2447 rc = HGCMService::LoadState(pMsg->pSSM, pMsg->pVMM, pMsg->uVersion); 2424 2448 } break; 2425 2449 … … 2430 2454 LogFlowFunc(("HGCM_MSG_SAVESTATE\n")); 2431 2455 2432 rc = HGCMService::SaveState(pMsg->pSSM );2456 rc = HGCMService::SaveState(pMsg->pSSM, pMsg->pVMM); 2433 2457 } break; 2434 2458 … … 2538 2562 * @param pszServiceName The name to be assigned to the service. 2539 2563 * @param pUVM The user mode VM handle (for statistics and such). 2564 * @param pVMM The VMM vtable (for statistics and such). 2540 2565 * @param pHgcmPort The HGCM port on the VMMDev device (for session ID and such). 2541 2566 * @return VBox rc. … … 2544 2569 const char *pszServiceName, 2545 2570 PUVM pUVM, 2571 PCVMMR3VTABLE pVMM, 2546 2572 PPDMIHGCMPORT pHgcmPort) 2547 2573 { … … 2549 2575 2550 2576 if (!pszServiceLibrary || !pszServiceName) 2551 {2552 2577 return VERR_INVALID_PARAMETER; 2553 }2554 2578 2555 2579 /* Forward the request to the main hgcm thread. */ 2556 2580 HGCMMsgCore *pCoreMsg; 2557 2581 int rc = hgcmMsgAlloc(g_pHgcmThread, &pCoreMsg, HGCM_MSG_LOAD, hgcmMainMessageAlloc); 2558 2559 2582 if (RT_SUCCESS(rc)) 2560 2583 { … … 2565 2588 pMsg->pszServiceName = pszServiceName; 2566 2589 pMsg->pUVM = pUVM; 2590 pMsg->pVMM = pVMM; 2567 2591 pMsg->pHgcmPort = pHgcmPort; 2568 2592 … … 2724 2748 * 2725 2749 * @param pSSM The SSM handle. 2750 * @param pVMM The VMM vtable. 2726 2751 * @param idMsg The message to be sent: HGCM_MSG_SAVESTATE or HGCM_MSG_LOADSTATE. 2727 2752 * @param uVersion The state version being loaded. 2728 2753 * @return VBox rc. 2729 2754 */ 2730 static int hgcmHostLoadSaveState(PSSMHANDLE pSSM, uint32_t idMsg, uint32_t uVersion)2731 { 2732 LogFlowFunc(("pSSM = %p, idMsg = %d, uVersion = uVersion\n", pSSM, idMsg));2755 static int hgcmHostLoadSaveState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t idMsg, uint32_t uVersion) 2756 { 2757 LogFlowFunc(("pSSM = %p, pVMM = %p, idMsg = %d, uVersion = %#x\n", pSSM, pVMM, idMsg, uVersion)); 2733 2758 2734 2759 HGCMMsgCore *pCoreMsg; 2735 2760 int rc = hgcmMsgAlloc(g_pHgcmThread, &pCoreMsg, idMsg, hgcmMainMessageAlloc); 2736 2737 2761 if (RT_SUCCESS(rc)) 2738 2762 { … … 2741 2765 2742 2766 pMsg->pSSM = pSSM; 2767 pMsg->pVMM = pVMM; 2743 2768 pMsg->uVersion = uVersion; 2744 2769 … … 2752 2777 /** Save the state of services. 2753 2778 * 2754 * @param pSSM The SSM handle. 2755 * @return VBox rc. 2756 */ 2757 int HGCMHostSaveState(PSSMHANDLE pSSM) 2758 { 2759 return hgcmHostLoadSaveState(pSSM, HGCM_MSG_SAVESTATE, HGCM_SAVED_STATE_VERSION); 2779 * @param pSSM The SSM handle. 2780 * @param pVMM The VMM vtable. 2781 * @return VBox status code. 2782 */ 2783 int HGCMHostSaveState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM) 2784 { 2785 return hgcmHostLoadSaveState(pSSM, pVMM, HGCM_MSG_SAVESTATE, HGCM_SAVED_STATE_VERSION); 2760 2786 } 2761 2787 2762 2788 /** Load the state of services. 2763 2789 * 2764 * @param pSSM The SSM handle. 2765 * @param uVersion The state version being loaded. 2766 * @return VBox rc. 2767 */ 2768 int HGCMHostLoadState(PSSMHANDLE pSSM, uint32_t uVersion) 2769 { 2770 return hgcmHostLoadSaveState(pSSM, HGCM_MSG_LOADSTATE, uVersion); 2790 * @param pSSM The SSM handle. 2791 * @param pVMM The VMM vtable. 2792 * @param uVersion The state version being loaded. 2793 * @return VBox status code. 2794 */ 2795 int HGCMHostLoadState(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion) 2796 { 2797 return hgcmHostLoadSaveState(pSSM, pVMM, HGCM_MSG_LOADSTATE, uVersion); 2771 2798 } 2772 2799 … … 2953 2980 */ 2954 2981 2955 rc = hgcmThreadCreate(&g_pHgcmThread, "MainHGCMthread", hgcmThread, NULL /*pvUser*/, NULL /*pszStatsSubDir*/, NULL /*pUVM*/); 2982 rc = hgcmThreadCreate(&g_pHgcmThread, "MainHGCMthread", hgcmThread, NULL /*pvUser*/, 2983 NULL /*pszStatsSubDir*/, NULL /*pUVM*/, NULL /*pVMM*/); 2956 2984 2957 2985 if (RT_FAILURE(rc)) -
trunk/src/VBox/Main/src-client/HGCMThread.cpp
r93115 r93444 23 23 #include <VBox/err.h> 24 24 #include <VBox/vmm/stam.h> 25 #include <VBox/vmm/vmmr3vtable.h> 25 26 #include <iprt/semaphore.h> 26 27 #include <iprt/thread.h> … … 142 143 int WaitForTermination (void); 143 144 144 int Initialize(const char *pszThreadName, PFNHGCMTHREAD pfnThread, void *pvUser, const char *pszStatsSubDir, PUVM pUVM); 145 int Initialize(const char *pszThreadName, PFNHGCMTHREAD pfnThread, void *pvUser, 146 const char *pszStatsSubDir, PUVM pUVM, PCVMMR3VTABLE pVMM); 145 147 146 148 int MsgAlloc(HGCMMsgCore **pMsg, uint32_t u32MsgId, PFNHGCMNEWMSGALLOC pfnNewMessage); … … 266 268 } 267 269 268 int HGCMThread::Initialize(const char *pszThreadName, PFNHGCMTHREAD pfnThread, void *pvUser, const char *pszStatsSubDir, PUVM pUVM) 270 int HGCMThread::Initialize(const char *pszThreadName, PFNHGCMTHREAD pfnThread, void *pvUser, 271 const char *pszStatsSubDir, PUVM pUVM, PCVMMR3VTABLE pVMM) 269 272 { 270 273 int rc = RTSemEventCreate(&m_eventThread); … … 296 299 if (pUVM) 297 300 { 298 STAMR3RegisterFU(pUVM, &m_StatPostMsgNoPending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, 299 "Times a message was appended to an empty input queue.", 300 "/HGCM/%s/PostMsg0Pending", pszStatsSubDir); 301 STAMR3RegisterFU(pUVM, &m_StatPostMsgOnePending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, 302 "Times a message was appended to input queue with only one pending message.", 303 "/HGCM/%s/PostMsg1Pending", pszStatsSubDir); 304 STAMR3RegisterFU(pUVM, &m_StatPostMsgTwoPending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, 305 "Times a message was appended to input queue with only one pending message.", 306 "/HGCM/%s/PostMsg2Pending", pszStatsSubDir); 307 STAMR3RegisterFU(pUVM, &m_StatPostMsgThreePending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, 308 "Times a message was appended to input queue with only one pending message.", 309 "/HGCM/%s/PostMsg3Pending", pszStatsSubDir); 310 STAMR3RegisterFU(pUVM, &m_StatPostMsgManyPending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, 311 "Times a message was appended to input queue with only one pending message.", 312 "/HGCM/%s/PostMsgManyPending", pszStatsSubDir); 301 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_StatPostMsgNoPending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, 302 STAMUNIT_COUNT, "Times a message was appended to an empty input queue.", 303 "/HGCM/%s/PostMsg0Pending", pszStatsSubDir); 304 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_StatPostMsgOnePending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, 305 STAMUNIT_COUNT, 306 "Times a message was appended to input queue with only one pending message.", 307 "/HGCM/%s/PostMsg1Pending", pszStatsSubDir); 308 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_StatPostMsgTwoPending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, 309 STAMUNIT_COUNT, 310 "Times a message was appended to input queue with only one pending message.", 311 "/HGCM/%s/PostMsg2Pending", pszStatsSubDir); 312 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_StatPostMsgThreePending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, 313 STAMUNIT_COUNT, 314 "Times a message was appended to input queue with only one pending message.", 315 "/HGCM/%s/PostMsg3Pending", pszStatsSubDir); 316 pVMM->pfnSTAMR3RegisterFU(pUVM, &m_StatPostMsgManyPending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, 317 STAMUNIT_COUNT, 318 "Times a message was appended to input queue with only one pending message.", 319 "/HGCM/%s/PostMsgManyPending", pszStatsSubDir); 313 320 } 314 321 … … 627 634 628 635 int hgcmThreadCreate(HGCMThread **ppThread, const char *pszThreadName, PFNHGCMTHREAD pfnThread, void *pvUser, 629 const char *pszStatsSubDir, PUVM pUVM )636 const char *pszStatsSubDir, PUVM pUVM, PCVMMR3VTABLE pVMM) 630 637 { 631 638 LogFlow(("MAIN::hgcmThreadCreate\n")); … … 640 647 641 648 /* Initialize the object. */ 642 rc = pThread->Initialize(pszThreadName, pfnThread, pvUser, pszStatsSubDir, pUVM );649 rc = pThread->Initialize(pszThreadName, pfnThread, pvUser, pszStatsSubDir, pUVM, pVMM); 643 650 if (RT_SUCCESS(rc)) 644 651 { -
trunk/src/VBox/Main/src-client/KeyboardImpl.cpp
r93115 r93444 429 429 DECLCALLBACK(int) Keyboard::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 430 430 { 431 RT_NOREF(fFlags);432 431 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 432 RT_NOREF(fFlags, pCfg); 433 433 PDRVMAINKEYBOARD pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD); 434 434 LogFlow(("Keyboard::drvConstruct: iInstance=%d\n", pDrvIns->iInstance)); … … 437 437 * Validate configuration. 438 438 */ 439 if (!CFGMR3AreValuesValid(pCfg, "")) 440 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 439 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "", ""); 441 440 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 442 441 ("Configuration error: Not possible to attach anything to this driver!\n"), -
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r93115 r93444 31 31 #include "AutoCaller.h" 32 32 33 #include <VBox/vmm/vmmr3vtable.h> 33 34 #include <VBox/vmm/em.h> 34 35 #include <VBox/vmm/uvm.h> … … 131 132 && uPercentage == 100) 132 133 { 133 vrc = DBGFR3SampleReportDumpToFile(pThis->m_hSampleReport, pThis->m_strFilename.c_str()); 134 DBGFR3SampleReportRelease(pThis->m_hSampleReport); 134 PCVMMR3VTABLE const pVMM = pThis->mParent->i_getVMMVTable(); 135 AssertPtrReturn(pVMM, VERR_INTERNAL_ERROR_3); 136 137 vrc = pVMM->pfnDBGFR3SampleReportDumpToFile(pThis->m_hSampleReport, pThis->m_strFilename.c_str()); 138 pVMM->pfnDBGFR3SampleReportRelease(pThis->m_hSampleReport); 135 139 pThis->m_hSampleReport = NULL; 136 140 if (RT_SUCCESS(vrc)) … … 216 220 hrc = ptrVM.rc(); 217 221 if (SUCCEEDED(hrc)) 218 EMR3QueryExecutionPolicy(ptrVM.rawUVM(), enmPolicy, &fEnforced);222 ptrVM.vtable()->pfnEMR3QueryExecutionPolicy(ptrVM.rawUVM(), enmPolicy, &fEnforced); 219 223 *pfEnforced = fEnforced; 220 224 } … … 245 249 if (SUCCEEDED(hrc)) 246 250 { 247 int vrc = EMR3SetExecutionPolicy(ptrVM.rawUVM(), enmPolicy, fEnforce != FALSE);251 int vrc = ptrVM.vtable()->pfnEMR3SetExecutionPolicy(ptrVM.rawUVM(), enmPolicy, fEnforce != FALSE); 248 252 if (RT_FAILURE(vrc)) 249 253 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("EMR3SetExecutionPolicy failed with %Rrc"), vrc); … … 420 424 421 425 #ifdef LOG_ENABLED 422 int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), aLogEnabled ? "enabled" : "disabled");426 int vrc = ptrVM.vtable()->pfnDBGFR3LogModifyFlags(ptrVM.rawUVM(), aLogEnabled ? "enabled" : "disabled"); 423 427 if (RT_FAILURE(vrc)) 424 428 { … … 520 524 { 521 525 uint8_t bEngine = UINT8_MAX; 522 int rc = EMR3QueryMainExecutionEngine(ptrVM.rawUVM(), &bEngine);526 int rc = ptrVM.vtable()->pfnEMR3QueryMainExecutionEngine(ptrVM.rawUVM(), &bEngine); 523 527 if (RT_SUCCESS(rc)) 524 528 switch (bEngine) … … 550 554 { 551 555 uint8_t bEngine = UINT8_MAX; 552 int rc = EMR3QueryMainExecutionEngine(ptrVM.rawUVM(), &bEngine);556 int rc = ptrVM.vtable()->pfnEMR3QueryMainExecutionEngine(ptrVM.rawUVM(), &bEngine); 553 557 *aHWVirtExEnabled = RT_SUCCESS(rc) && bEngine == VM_EXEC_ENGINE_HW_VIRT; 554 558 } … … 568 572 569 573 Console::SafeVMPtrQuiet ptrVM(mParent); 570 571 574 if (ptrVM.isOk()) 572 *aHWVirtExNestedPagingEnabled = HMR3IsNestedPagingActive(ptrVM.rawUVM());575 *aHWVirtExNestedPagingEnabled = ptrVM.vtable()->pfnHMR3IsNestedPagingActive(ptrVM.rawUVM()); 573 576 else 574 577 *aHWVirtExNestedPagingEnabled = false; … … 588 591 589 592 Console::SafeVMPtrQuiet ptrVM(mParent); 590 591 593 if (ptrVM.isOk()) 592 *aHWVirtExVPIDEnabled = HMR3IsVpidActive(ptrVM.rawUVM());594 *aHWVirtExVPIDEnabled = ptrVM.vtable()->pfnHMR3IsVpidActive(ptrVM.rawUVM()); 593 595 else 594 596 *aHWVirtExVPIDEnabled = false; … … 608 610 609 611 Console::SafeVMPtrQuiet ptrVM(mParent); 610 611 612 if (ptrVM.isOk()) 612 *aHWVirtExUXEnabled = HMR3IsUXActive(ptrVM.rawUVM());613 *aHWVirtExUXEnabled = ptrVM.vtable()->pfnHMR3IsUXActive(ptrVM.rawUVM()); 613 614 else 614 615 *aHWVirtExUXEnabled = false; … … 621 622 LogFlowThisFunc(("\n")); 622 623 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 624 623 625 Console::SafeVMPtr ptrVM(mParent); 624 626 HRESULT hrc = ptrVM.rc(); … … 629 631 */ 630 632 char szName[64]; 631 int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), szName, sizeof(szName), NULL, 0);633 int vrc = ptrVM.vtable()->pfnDBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), szName, sizeof(szName), NULL, 0); 632 634 if (RT_SUCCESS(vrc)) 633 { 634 try 635 { 636 Bstr bstrName(szName); 637 aOSName = Utf8Str(bstrName); 638 } 639 catch (std::bad_alloc &) 640 { 641 hrc = E_OUTOFMEMORY; 642 } 643 } 635 hrc = aOSName.assignEx(szName); 644 636 else 645 637 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc); … … 652 644 LogFlowThisFunc(("\n")); 653 645 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 646 654 647 Console::SafeVMPtr ptrVM(mParent); 655 648 HRESULT hrc = ptrVM.rc(); … … 660 653 */ 661 654 char szVersion[256]; 662 int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), NULL, 0, szVersion, sizeof(szVersion));655 int vrc = ptrVM.vtable()->pfnDBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), NULL, 0, szVersion, sizeof(szVersion)); 663 656 if (RT_SUCCESS(vrc)) 664 { 665 try 666 { 667 Bstr bstrVersion(szVersion); 668 aOSVersion = Utf8Str(bstrVersion); 669 } 670 catch (std::bad_alloc &) 671 { 672 hrc = E_OUTOFMEMORY; 673 } 674 } 657 hrc = aOSVersion.assignEx(szVersion); 675 658 else 676 659 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc); … … 690 673 691 674 Console::SafeVMPtrQuiet ptrVM(mParent); 692 693 675 if (ptrVM.isOk()) 694 676 { 695 677 uint32_t cr4; 696 int rc = DBGFR3RegCpuQueryU32(ptrVM.rawUVM(), 0 /*idCpu*/, DBGFREG_CR4, &cr4); AssertRC(rc);678 int rc = ptrVM.vtable()->pfnDBGFR3RegCpuQueryU32(ptrVM.rawUVM(), 0 /*idCpu*/, DBGFREG_CR4, &cr4); AssertRC(rc); 697 679 *aPAEEnabled = RT_BOOL(cr4 & X86_CR4_PAE); 698 680 } … … 716 698 HRESULT hrc = ptrVM.rc(); 717 699 if (SUCCEEDED(hrc)) 718 *aVirtualTimeRate = TMR3GetWarpDrive(ptrVM.rawUVM());700 *aVirtualTimeRate = ptrVM.vtable()->pfnTMR3GetWarpDrive(ptrVM.rawUVM()); 719 701 720 702 return hrc; … … 743 725 if (SUCCEEDED(hrc)) 744 726 { 745 int vrc = TMR3SetWarpDrive(ptrVM.rawUVM(), aVirtualTimeRate);727 int vrc = ptrVM.vtable()->pfnTMR3SetWarpDrive(ptrVM.rawUVM(), aVirtualTimeRate); 746 728 if (RT_FAILURE(vrc)) 747 729 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("TMR3SetWarpDrive(, %u) failed with rc=%Rrc"), aVirtualTimeRate, vrc); … … 772 754 if (SUCCEEDED(hrc)) 773 755 { 774 VMR3RetainUVM(ptrVM.rawUVM());756 ptrVM.vtable()->pfnVMR3RetainUVM(ptrVM.rawUVM()); 775 757 *aVM = (intptr_t)ptrVM.rawUVM(); 776 758 } … … 796 778 HRESULT hrc = ptrVM.rc(); 797 779 if (SUCCEEDED(hrc)) 798 *aUptime = (int64_t) TMR3TimeVirtGetMilli(ptrVM.rawUVM());780 *aUptime = (int64_t)ptrVM.vtable()->pfnTMR3TimeVirtGetMilli(ptrVM.rawUVM()); 799 781 800 782 return hrc; … … 814 796 if (SUCCEEDED(hrc)) 815 797 { 816 int vrc = DBGFR3CoreWrite(ptrVM.rawUVM(), aFilename.c_str(), false /*fReplaceFile*/);798 int vrc = ptrVM.vtable()->pfnDBGFR3CoreWrite(ptrVM.rawUVM(), aFilename.c_str(), false /*fReplaceFile*/); 817 799 if (RT_SUCCESS(vrc)) 818 800 hrc = S_OK; … … 921 903 * @param pHlp The help structure to init. 922 904 */ 923 static void MachineDebuggerInfoInit(PMACHINEDEBUGGERINOFHLP pHlp )905 static void MachineDebuggerInfoInit(PMACHINEDEBUGGERINOFHLP pHlp, PCVMMR3VTABLE pVMM) 924 906 { 925 907 pHlp->Core.pfnPrintf = MachineDebuggerInfoPrintf; 926 908 pHlp->Core.pfnPrintfV = MachineDebuggerInfoPrintfV; 927 pHlp->Core.pfnGetOptError = DBGFR3InfoGenericGetOptError;909 pHlp->Core.pfnGetOptError = pVMM->pfnDBGFR3InfoGenericGetOptError; 928 910 pHlp->pszBuf = NULL; 929 911 pHlp->cbBuf = 0; … … 962 944 */ 963 945 MACHINEDEBUGGERINOFHLP Hlp; 964 MachineDebuggerInfoInit(&Hlp );965 int vrc = DBGFR3Info(ptrVM.rawUVM(), aName.c_str(), aArgs.c_str(), &Hlp.Core);946 MachineDebuggerInfoInit(&Hlp, ptrVM.vtable()); 947 int vrc = ptrVM.vtable()->pfnDBGFR3Info(ptrVM.rawUVM(), aName.c_str(), aArgs.c_str(), &Hlp.Core); 966 948 if (RT_SUCCESS(vrc)) 967 949 { 968 950 if (!Hlp.fOutOfMemory) 969 { 970 /* 971 * Convert the info string, watching out for allocation errors. 972 */ 973 try 974 { 975 Bstr bstrInfo(Hlp.pszBuf); 976 aInfo = bstrInfo; 977 } 978 catch (std::bad_alloc &) 979 { 980 hrc = E_OUTOFMEMORY; 981 } 982 } 951 hrc = aInfo.assignEx(Hlp.pszBuf); 983 952 else 984 953 hrc = E_OUTOFMEMORY; … … 1001 970 if (SUCCEEDED(hrc)) 1002 971 { 1003 int vrc = DBGFR3InjectNMI(ptrVM.rawUVM(), 0);972 int vrc = ptrVM.vtable()->pfnDBGFR3InjectNMI(ptrVM.rawUVM(), 0); 1004 973 if (RT_SUCCESS(vrc)) 1005 974 hrc = S_OK; … … 1018 987 if (SUCCEEDED(hrc)) 1019 988 { 1020 int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), aSettings.c_str());989 int vrc = ptrVM.vtable()->pfnDBGFR3LogModifyFlags(ptrVM.rawUVM(), aSettings.c_str()); 1021 990 if (RT_SUCCESS(vrc)) 1022 991 hrc = S_OK; … … 1035 1004 if (SUCCEEDED(hrc)) 1036 1005 { 1037 int vrc = DBGFR3LogModifyGroups(ptrVM.rawUVM(), aSettings.c_str());1006 int vrc = ptrVM.vtable()->pfnDBGFR3LogModifyGroups(ptrVM.rawUVM(), aSettings.c_str()); 1038 1007 if (RT_SUCCESS(vrc)) 1039 1008 hrc = S_OK; … … 1052 1021 if (SUCCEEDED(hrc)) 1053 1022 { 1054 int vrc = DBGFR3LogModifyDestinations(ptrVM.rawUVM(), aSettings.c_str());1023 int vrc = ptrVM.vtable()->pfnDBGFR3LogModifyDestinations(ptrVM.rawUVM(), aSettings.c_str()); 1055 1024 if (RT_SUCCESS(vrc)) 1056 1025 hrc = S_OK; … … 1100 1069 if (aName.equals("all")) 1101 1070 { 1102 DBGFR3PlugInLoadAll(ptrVM.rawUVM()); 1103 try 1104 { 1105 aPlugInName = "all"; 1106 hrc = S_OK; 1107 } 1108 catch (std::bad_alloc &) 1109 { 1110 hrc = E_OUTOFMEMORY; 1111 } 1071 ptrVM.vtable()->pfnDBGFR3PlugInLoadAll(ptrVM.rawUVM()); 1072 hrc = aPlugInName.assignEx("all"); 1112 1073 } 1113 1074 else … … 1115 1076 RTERRINFOSTATIC ErrInfo; 1116 1077 char szName[80]; 1117 int vrc = DBGFR3PlugInLoad(ptrVM.rawUVM(), aName.c_str(), szName, sizeof(szName), RTErrInfoInitStatic(&ErrInfo));1078 int vrc = ptrVM.vtable()->pfnDBGFR3PlugInLoad(ptrVM.rawUVM(), aName.c_str(), szName, sizeof(szName), RTErrInfoInitStatic(&ErrInfo)); 1118 1079 if (RT_SUCCESS(vrc)) 1119 { 1120 try 1121 { 1122 aPlugInName = szName; 1123 hrc = S_OK; 1124 } 1125 catch (std::bad_alloc &) 1126 { 1127 hrc = E_OUTOFMEMORY; 1128 } 1129 } 1080 hrc = aPlugInName.assignEx(szName); 1130 1081 else 1131 1082 hrc = setErrorVrc(vrc, "%s", ErrInfo.szMsg); … … 1151 1102 if (aName.equals("all")) 1152 1103 { 1153 DBGFR3PlugInUnloadAll(ptrVM.rawUVM());1104 ptrVM.vtable()->pfnDBGFR3PlugInUnloadAll(ptrVM.rawUVM()); 1154 1105 hrc = S_OK; 1155 1106 } 1156 1107 else 1157 1108 { 1158 int vrc = DBGFR3PlugInUnload(ptrVM.rawUVM(), aName.c_str());1109 int vrc = ptrVM.vtable()->pfnDBGFR3PlugInUnload(ptrVM.rawUVM(), aName.c_str()); 1159 1110 if (RT_SUCCESS(vrc)) 1160 1111 hrc = S_OK; … … 1185 1136 */ 1186 1137 char szName[64]; 1187 int vrc = DBGFR3OSDetect(ptrVM.rawUVM(), szName, sizeof(szName));1138 int vrc = ptrVM.vtable()->pfnDBGFR3OSDetect(ptrVM.rawUVM(), szName, sizeof(szName)); 1188 1139 if (RT_SUCCESS(vrc) && vrc != VINF_DBGF_OS_NOT_DETCTED) 1189 { 1190 try 1191 { 1192 aOs = szName; 1193 } 1194 catch (std::bad_alloc &) 1195 { 1196 hrc = E_OUTOFMEMORY; 1197 } 1198 } 1140 hrc = aOs.assignEx(szName); 1199 1141 else 1200 1142 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("DBGFR3OSDetect failed with %Rrc"), vrc); … … 1213 1155 if (SUCCEEDED(hrc)) 1214 1156 { 1215 PDBGFOSIDMESG pDmesg = (PDBGFOSIDMESG) DBGFR3OSQueryInterface(ptrVM.rawUVM(), DBGFOSINTERFACE_DMESG);1157 PDBGFOSIDMESG pDmesg = (PDBGFOSIDMESG)ptrVM.vtable()->pfnDBGFR3OSQueryInterface(ptrVM.rawUVM(), DBGFOSINTERFACE_DMESG); 1216 1158 if (pDmesg) 1217 1159 { … … 1250 1192 } 1251 1193 1252 /**1253 * Formats a register value.1254 *1255 * This is used by both register getter methods.1256 *1257 * @returns1258 * @param a_pbstr The output Bstr variable.1259 * @param a_pValue The value to format.1260 * @param a_enmType The type of the value.1261 */1262 DECLINLINE(HRESULT) formatRegisterValue(Bstr *a_pbstr, PCDBGFREGVAL a_pValue, DBGFREGVALTYPE a_enmType)1263 {1264 char szHex[160];1265 ssize_t cch = DBGFR3RegFormatValue(szHex, sizeof(szHex), a_pValue, a_enmType, true /*fSpecial*/);1266 if (RT_UNLIKELY(cch <= 0))1267 return E_UNEXPECTED;1268 *a_pbstr = szHex;1269 return S_OK;1270 }1271 1272 1194 HRESULT MachineDebugger::getRegister(ULONG aCpuId, const com::Utf8Str &aName, com::Utf8Str &aValue) 1273 1195 { … … 1286 1208 DBGFREGVAL Value; 1287 1209 DBGFREGVALTYPE enmType; 1288 int vrc = DBGFR3RegNmQuery(ptrVM.rawUVM(), aCpuId, aName.c_str(), &Value, &enmType);1210 int vrc = ptrVM.vtable()->pfnDBGFR3RegNmQuery(ptrVM.rawUVM(), aCpuId, aName.c_str(), &Value, &enmType); 1289 1211 if (RT_SUCCESS(vrc)) 1290 1212 { 1291 try 1292 { 1293 Bstr bstrValue; 1294 hrc = formatRegisterValue(&bstrValue, &Value, enmType); 1295 if (SUCCEEDED(hrc)) 1296 aValue = Utf8Str(bstrValue); 1297 } 1298 catch (std::bad_alloc &) 1299 { 1300 hrc = E_OUTOFMEMORY; 1301 } 1213 char szHex[160]; 1214 ssize_t cch = ptrVM.vtable()->pfnDBGFR3RegFormatValue(szHex, sizeof(szHex), &Value, enmType, true /*fSpecial*/); 1215 if (cch > 0) 1216 hrc = aValue.assignEx(szHex); 1217 else 1218 hrc = E_UNEXPECTED; 1302 1219 } 1303 1220 else if (vrc == VERR_DBGF_REGISTER_NOT_FOUND) … … 1331 1248 */ 1332 1249 size_t cRegs; 1333 int vrc = DBGFR3RegNmQueryAllCount(ptrVM.rawUVM(), &cRegs);1250 int vrc = ptrVM.vtable()->pfnDBGFR3RegNmQueryAllCount(ptrVM.rawUVM(), &cRegs); 1334 1251 if (RT_SUCCESS(vrc)) 1335 1252 { … … 1337 1254 if (paRegs) 1338 1255 { 1339 vrc = DBGFR3RegNmQueryAll(ptrVM.rawUVM(), paRegs, cRegs);1256 vrc = ptrVM.vtable()->pfnDBGFR3RegNmQueryAll(ptrVM.rawUVM(), paRegs, cRegs); 1340 1257 if (RT_SUCCESS(vrc)) 1341 1258 { … … 1348 1265 char szHex[160]; 1349 1266 szHex[159] = szHex[0] = '\0'; 1350 ssize_t cch = DBGFR3RegFormatValue(szHex, sizeof(szHex), &paRegs[iReg].Val,1351 paRegs[iReg].enmType, true /*fSpecial*/);1267 ssize_t cch = ptrVM.vtable()->pfnDBGFR3RegFormatValue(szHex, sizeof(szHex), &paRegs[iReg].Val, 1268 paRegs[iReg].enmType, true /*fSpecial*/); 1352 1269 Assert(cch > 0); NOREF(cch); 1353 aNames[iReg] = Utf8Str(paRegs[iReg].pszName);1354 aValues[iReg] = Utf8Str(szHex);1270 aNames[iReg] = paRegs[iReg].pszName; 1271 aValues[iReg] = szHex; 1355 1272 } 1356 1273 } … … 1411 1328 if (aCpuId != 0) 1412 1329 { 1413 VMSTATE enmVmState = VMR3GetStateU(ptrVM.rawUVM());1330 VMSTATE enmVmState = ptrVM.vtable()->pfnVMR3GetStateU(ptrVM.rawUVM()); 1414 1331 if ( enmVmState == VMSTATE_RUNNING 1415 1332 || enmVmState == VMSTATE_RUNNING_LS) 1416 1333 { 1417 1334 alock.release(); 1418 vrc = VMR3Suspend(ptrVM.rawUVM(), VMSUSPENDREASON_USER);1335 vrc = ptrVM.vtable()->pfnVMR3Suspend(ptrVM.rawUVM(), VMSUSPENDREASON_USER); 1419 1336 alock.acquire(); 1420 1337 fPaused = RT_SUCCESS(vrc); … … 1424 1341 { 1425 1342 PCDBGFSTACKFRAME pFirstFrame; 1426 vrc = DBGFR3StackWalkBegin(ptrVM.rawUVM(), aCpuId, DBGFCODETYPE_GUEST, &pFirstFrame);1343 vrc = ptrVM.vtable()->pfnDBGFR3StackWalkBegin(ptrVM.rawUVM(), aCpuId, DBGFCODETYPE_GUEST, &pFirstFrame); 1427 1344 if (RT_SUCCESS(vrc)) 1428 1345 { … … 1435 1352 for (PCDBGFSTACKFRAME pFrame = pFirstFrame; 1436 1353 pFrame; 1437 pFrame = DBGFR3StackWalkNext(pFrame))1354 pFrame = ptrVM.vtable()->pfnDBGFR3StackWalkNext(pFrame)) 1438 1355 { 1439 1356 uint32_t const fCurBitFlags = pFrame->fFlags & (DBGFSTACKFRAME_FLAGS_16BIT | DBGFSTACKFRAME_FLAGS_32BIT | DBGFSTACKFRAME_FLAGS_64BIT); … … 1442 1359 if (fCurBitFlags != fBitFlags) 1443 1360 aStack.append("SS:BP Ret SS:BP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP / Symbol [line]\n"); 1444 aStack.append (Utf8StrFmt("%04RX16:%04RX16 %04RX16:%04RX16 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32",1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 pFrame->Args.au32[3]));1361 aStack.appendPrintf("%04RX16:%04RX16 %04RX16:%04RX16 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32", 1362 pFrame->AddrFrame.Sel, 1363 (uint16_t)pFrame->AddrFrame.off, 1364 pFrame->AddrReturnFrame.Sel, 1365 (uint16_t)pFrame->AddrReturnFrame.off, 1366 (uint32_t)pFrame->AddrReturnPC.Sel, 1367 (uint32_t)pFrame->AddrReturnPC.off, 1368 pFrame->Args.au32[0], 1369 pFrame->Args.au32[1], 1370 pFrame->Args.au32[2], 1371 pFrame->Args.au32[3]); 1455 1372 } 1456 1373 else if (fCurBitFlags & DBGFSTACKFRAME_FLAGS_32BIT) … … 1458 1375 if (fCurBitFlags != fBitFlags) 1459 1376 aStack.append("EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP / Symbol [line]\n"); 1460 aStack.append (Utf8StrFmt("%08RX32 %08RX32 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32",1461 1462 1463 1464 1465 1466 1467 1468 pFrame->Args.au32[3]));1377 aStack.appendPrintf("%08RX32 %08RX32 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32", 1378 (uint32_t)pFrame->AddrFrame.off, 1379 (uint32_t)pFrame->AddrReturnFrame.off, 1380 (uint32_t)pFrame->AddrReturnPC.Sel, 1381 (uint32_t)pFrame->AddrReturnPC.off, 1382 pFrame->Args.au32[0], 1383 pFrame->Args.au32[1], 1384 pFrame->Args.au32[2], 1385 pFrame->Args.au32[3]); 1469 1386 } 1470 1387 else if (fCurBitFlags & DBGFSTACKFRAME_FLAGS_64BIT) … … 1472 1389 if (fCurBitFlags != fBitFlags) 1473 1390 aStack.append("RBP Ret SS:RBP Ret RIP CS:RIP / Symbol [line]\n"); 1474 aStack.append (Utf8StrFmt("%016RX64 %04RX16:%016RX64 %016RX64",1475 1476 1477 1478 (uint64_t)pFrame->AddrReturnPC.off));1391 aStack.appendPrintf("%016RX64 %04RX16:%016RX64 %016RX64", 1392 (uint64_t)pFrame->AddrFrame.off, 1393 pFrame->AddrReturnFrame.Sel, 1394 (uint64_t)pFrame->AddrReturnFrame.off, 1395 (uint64_t)pFrame->AddrReturnPC.off); 1479 1396 } 1480 1397 1481 1398 if (!pFrame->pSymPC) 1482 aStack.append (Utf8StrFmt(fCurBitFlags & DBGFSTACKFRAME_FLAGS_64BIT1483 1484 1485 1486 1487 , pFrame->AddrPC.Sel, pFrame->AddrPC.off));1399 aStack.appendPrintf(fCurBitFlags & DBGFSTACKFRAME_FLAGS_64BIT 1400 ? " %RTsel:%016RGv" 1401 : fCurBitFlags & DBGFSTACKFRAME_FLAGS_32BIT 1402 ? " %RTsel:%08RGv" 1403 : " %RTsel:%04RGv" 1404 , pFrame->AddrPC.Sel, pFrame->AddrPC.off); 1488 1405 else 1489 1406 { 1490 1407 RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value; /** @todo this isn't 100% correct for segmented stuff. */ 1491 1408 if (offDisp > 0) 1492 aStack.append (Utf8StrFmt(" %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp));1409 aStack.appendPrintf(" %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp); 1493 1410 else if (offDisp < 0) 1494 aStack.append (Utf8StrFmt(" %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp));1411 aStack.appendPrintf(" %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp); 1495 1412 else 1496 aStack.append (Utf8StrFmt(" %s", pFrame->pSymPC->szName));1413 aStack.appendPrintf(" %s", pFrame->pSymPC->szName); 1497 1414 } 1498 1415 if (pFrame->pLinePC) 1499 aStack.append (Utf8StrFmt(" [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo));1500 aStack.append( Utf8StrFmt("\n"));1416 aStack.appendPrintf(" [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo); 1417 aStack.append("\n"); 1501 1418 1502 1419 fBitFlags = fCurBitFlags; … … 1508 1425 } 1509 1426 1510 DBGFR3StackWalkEnd(pFirstFrame);1427 ptrVM.vtable()->pfnDBGFR3StackWalkEnd(pFirstFrame); 1511 1428 } 1512 1429 else … … 1519 1436 { 1520 1437 alock.release(); 1521 VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_USER);1438 ptrVM.vtable()->pfnVMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_USER); 1522 1439 } 1523 1440 } … … 1538 1455 { 1539 1456 Console::SafeVMPtrQuiet ptrVM(mParent); 1540 1541 1457 if (!ptrVM.isOk()) 1542 1458 return setError(VBOX_E_INVALID_VM_STATE, tr("Machine is not running")); 1543 1459 1544 STAMR3Reset(ptrVM.rawUVM(), aPattern.c_str());1460 ptrVM.vtable()->pfnSTAMR3Reset(ptrVM.rawUVM(), aPattern.c_str()); 1545 1461 1546 1462 return S_OK; … … 1556 1472 { 1557 1473 Console::SafeVMPtrQuiet ptrVM(mParent); 1558 1559 1474 if (!ptrVM.isOk()) 1560 1475 return setError(VBOX_E_INVALID_VM_STATE, tr("Machine is not running")); 1561 1476 1562 STAMR3Dump(ptrVM.rawUVM(), aPattern.c_str());1477 ptrVM.vtable()->pfnSTAMR3Dump(ptrVM.rawUVM(), aPattern.c_str()); 1563 1478 1564 1479 return S_OK; … … 1580 1495 1581 1496 char *pszSnapshot; 1582 int vrc = STAMR3Snapshot(ptrVM.rawUVM(), aPattern.c_str(), &pszSnapshot, NULL, 1583 !!aWithDescriptions); 1497 int vrc = ptrVM.vtable()->pfnSTAMR3Snapshot(ptrVM.rawUVM(), aPattern.c_str(), &pszSnapshot, NULL, !!aWithDescriptions); 1584 1498 if (RT_FAILURE(vrc)) 1585 1499 return vrc == VERR_NO_MEMORY ? E_OUTOFMEMORY : E_FAIL; … … 1589 1503 * Until that's done, this method is kind of useless for debugger statistics GUI because 1590 1504 * of the amount statistics in a debug build. */ 1591 aStats = Utf8Str(pszSnapshot);1592 STAMR3SnapshotFree(ptrVM.rawUVM(), pszSnapshot);1593 1594 return S_OK;1505 HRESULT hrc = aStats.assignEx(pszSnapshot); 1506 ptrVM.vtable()->pfnSTAMR3SnapshotFree(ptrVM.rawUVM(), pszSnapshot); 1507 1508 return hrc; 1595 1509 } 1596 1510 … … 1607 1521 uint8_t uPctOther = 0; 1608 1522 uint64_t msInterval = 0; 1609 int vrc = TMR3GetCpuLoadPercents(ptrVM.rawUVM(), aCpuId >= UINT32_MAX / 2 ? VMCPUID_ALL : aCpuId,1610 &msInterval, &uPctExecuting, &uPctHalted, &uPctOther);1523 int vrc = ptrVM.vtable()->pfnTMR3GetCpuLoadPercents(ptrVM.rawUVM(), aCpuId >= UINT32_MAX / 2 ? VMCPUID_ALL : aCpuId, 1524 &msInterval, &uPctExecuting, &uPctHalted, &uPctOther); 1611 1525 if (RT_SUCCESS(vrc)) 1612 1526 { … … 1641 1555 m_strFilename = aFilename; 1642 1556 1643 int vrc = DBGFR3SampleReportCreate(ptrVM.rawUVM(), aUsInterval, DBGF_SAMPLE_REPORT_F_STACK_REVERSE, &m_hSampleReport); 1557 int vrc = ptrVM.vtable()->pfnDBGFR3SampleReportCreate(ptrVM.rawUVM(), aUsInterval, 1558 DBGF_SAMPLE_REPORT_F_STACK_REVERSE, &m_hSampleReport); 1644 1559 if (RT_SUCCESS(vrc)) 1645 1560 { … … 1652 1567 if (SUCCEEDED(hrc)) 1653 1568 { 1654 vrc = DBGFR3SampleReportStart(m_hSampleReport, aUsSampleTime, i_dbgfProgressCallback, static_cast<MachineDebugger*>(this)); 1569 vrc = ptrVM.vtable()->pfnDBGFR3SampleReportStart(m_hSampleReport, aUsSampleTime, i_dbgfProgressCallback, 1570 static_cast<MachineDebugger*>(this)); 1655 1571 if (RT_SUCCESS(vrc)) 1656 1572 hrc = m_Progress.queryInterfaceTo(pProgress.asOutParam()); … … 1662 1578 if (FAILED(hrc)) 1663 1579 { 1664 DBGFR3SampleReportRelease(m_hSampleReport);1580 ptrVM.vtable()->pfnDBGFR3SampleReportRelease(m_hSampleReport); 1665 1581 m_hSampleReport = NULL; 1666 1582 } -
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r93115 r93444 1234 1234 DECLCALLBACK(int) Mouse::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 1235 1235 { 1236 RT_NOREF(fFlags);1237 1236 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 1237 RT_NOREF(fFlags, pCfg); 1238 1238 PDRVMAINMOUSE pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE); 1239 1239 LogFlow(("drvMainMouse_Construct: iInstance=%d\n", pDrvIns->iInstance)); … … 1242 1242 * Validate configuration. 1243 1243 */ 1244 if (!CFGMR3AreValuesValid(pCfg, "")) 1245 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 1244 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "", ""); 1246 1245 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 1247 1246 ("Configuration error: Not possible to attach anything to this driver!\n"), -
trunk/src/VBox/Main/src-client/SessionImpl.cpp
r93410 r93444 345 345 AssertComRCReturn(rc, rc); 346 346 347 rc = mConsole->init (aMachine, mControl, aLockType);347 rc = mConsole->initWithMachine(aMachine, mControl, aLockType); 348 348 AssertComRCReturn(rc, rc); 349 349 } -
trunk/src/VBox/Main/src-client/UsbCardReader.cpp
r93115 r93444 1877 1877 pThis->hReqQCardReaderCmd = NIL_RTREQQUEUE; 1878 1878 1879 if (!CFGMR3AreValuesValid(pCfg, "Object\0")) 1880 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 1879 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "Object", ""); 1881 1880 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 1882 1881 ("Configuration error: Not possible to attach anything to this driver!\n"), … … 1884 1883 1885 1884 void *pv; 1886 int rc = CFGMR3QueryPtr(pCfg, "Object", &pv);1885 int rc = pDrvIns->pHlpR3->pfnCFGMQueryPtr(pCfg, "Object", &pv); 1887 1886 AssertMsgRCReturn(rc, ("Configuration error: No/bad \"Object\" value! rc=%Rrc\n", rc), rc); 1888 1887 -
trunk/src/VBox/Main/src-client/UsbWebcamInterface.cpp
r93115 r93444 405 405 406 406 void *pv = NULL; 407 int rc = CFGMR3QueryPtr(pCfg, "Object", &pv);407 int rc = pDrvIns->pHlpR3->pfnCFGMQueryPtr(pCfg, "Object", &pv); 408 408 if (!RT_VALID_PTR(pv)) 409 409 rc = VERR_INVALID_PARAMETER; 410 AssertMsgReturn(RT_SUCCESS(rc), 411 ("Configuration error: No/bad \"Object\" %p value! rc=%Rrc\n", pv, rc), rc); 410 AssertMsgRCReturn(rc, ("Configuration error: No/bad \"Object\" %p value! rc=%Rrc\n", pv, rc), rc); 412 411 413 412 /* Everything ok. Initialize. */ -
trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
r93115 r93444 684 684 * @param pSSM SSM operation handle. 685 685 */ 686 static DECLCALLBACK(int) iface_hgcmSave(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM)687 { 688 RT_NOREF(pDrvIns);686 /*static*/ DECLCALLBACK(int) VMMDev::hgcmSave(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM) 687 { 688 PDRVMAINVMMDEV pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV); 689 689 Log9(("Enter\n")); 690 return HGCMHostSaveState(pSSM); 690 691 AssertReturn(pThis->pVMMDev, VERR_INTERNAL_ERROR_2); 692 Console::SafeVMPtrQuiet ptrVM(pThis->pVMMDev->mParent); 693 AssertReturn(ptrVM.isOk(), VERR_INTERNAL_ERROR_3); 694 return HGCMHostSaveState(pSSM, ptrVM.vtable()); 691 695 } 692 696 … … 701 705 * @param uPass The data pass. 702 706 */ 703 static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)704 { 705 RT_NOREF(pDrvIns);707 /*static*/ DECLCALLBACK(int) VMMDev::hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 708 { 709 PDRVMAINVMMDEV pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV); 706 710 LogFlowFunc(("Enter\n")); 707 711 … … 711 715 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 712 716 713 return HGCMHostLoadState(pSSM, uVersion); 717 AssertReturn(pThis->pVMMDev, VERR_INTERNAL_ERROR_2); 718 Console::SafeVMPtrQuiet ptrVM(pThis->pVMMDev->mParent); 719 AssertReturn(ptrVM.isOk(), VERR_INTERNAL_ERROR_3); 720 return HGCMHostLoadState(pSSM, ptrVM.vtable(), uVersion); 714 721 } 715 722 … … 728 735 ); 729 736 Console::SafeVMPtrQuiet ptrVM(mParent); 730 return HGCMHostLoad(pszServiceLibrary, pszServiceName, ptrVM.rawUVM(), mpDrv ? mpDrv->pHGCMPort : NULL);737 return HGCMHostLoad(pszServiceLibrary, pszServiceName, ptrVM.rawUVM(), ptrVM.vtable(), mpDrv ? mpDrv->pHGCMPort : NULL); 731 738 } 732 739 … … 1048 1055 * @interface_method_impl{PDMDRVREG,pfnConstruct} 1049 1056 */ 1050 DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags) 1051 { 1052 RT_NOREF(fFlags); 1057 DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 1058 { 1053 1059 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 1060 RT_NOREF(fFlags, pCfg); 1054 1061 PDRVMAINVMMDEV pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV); 1055 1062 LogFlow(("Keyboard::drvConstruct: iInstance=%d\n", pDrvIns->iInstance)); … … 1058 1065 * Validate configuration. 1059 1066 */ 1060 if (!CFGMR3AreValuesValid(pCfgHandle, "")) 1061 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 1067 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "", ""); 1062 1068 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 1063 1069 ("Configuration error: Not possible to attach anything to this driver!\n"), … … 1111 1117 */ 1112 1118 com::Guid uuid(VMMDEV_OID); 1113 pThis->pVMMDev = (VMMDev *)PDMDrvHlpQueryGenericUserObject(pDrvIns, uuid.raw());1119 pThis->pVMMDev = (VMMDev *)PDMDrvHlpQueryGenericUserObject(pDrvIns, uuid.raw()); 1114 1120 if (!pThis->pVMMDev) 1115 1121 { … … 1186 1192 rc = PDMDrvHlpSSMRegisterEx(pDrvIns, HGCM_SAVED_STATE_VERSION, 4096 /* bad guess */, 1187 1193 NULL, NULL, NULL, 1188 NULL, iface_hgcmSave, NULL,1189 NULL, iface_hgcmLoad, NULL);1194 NULL, VMMDev::hgcmSave, NULL, 1195 NULL, VMMDev::hgcmLoad, NULL); 1190 1196 if (RT_FAILURE(rc)) 1191 1197 return rc; -
trunk/src/VBox/VMM/Makefile.kmk
r93419 r93444 89 89 VBoxVMM_SOURCES = \ 90 90 VBoxVMM.d \ 91 VMMR3/VMMR3VTable.cpp \ 91 92 VMMR3/APIC.cpp \ 92 93 VMMR3/CFGM.cpp \ -
trunk/src/VBox/VMM/VMMR3/CFGM.cpp
r93393 r93444 63 63 #include <VBox/vmm/vm.h> 64 64 #include <VBox/vmm/uvm.h> 65 #include <VBox/vmm/vmmr3vtable.h> 65 66 #include <VBox/err.h> 66 67 … … 225 226 */ 226 227 if (pfnCFGMConstructor) 227 rc = pfnCFGMConstructor(pVM->pUVM, pVM, pvUser);228 rc = pfnCFGMConstructor(pVM->pUVM, pVM, VMMR3GetVTable(), pvUser); 228 229 else 229 230 rc = CFGMR3ConstructDefaultTree(pVM); -
trunk/src/VBox/VMM/VMMR3/PGM.cpp
r93115 r93444 1939 1939 * a snapshot has been created. 1940 1940 */ 1941 static DECLCALLBACK(void) pgmR3ResetNoMorePhysWritesFlag(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser) 1941 static DECLCALLBACK(void) pgmR3ResetNoMorePhysWritesFlag(PUVM pUVM, PCVMMR3VTABLE pVMM, VMSTATE enmState, 1942 VMSTATE enmOldState, void *pvUser) 1942 1943 { 1943 1944 if ( enmState == VMSTATE_RUNNING 1944 1945 || enmState == VMSTATE_RESUMING) 1945 1946 pUVM->pVM->pgm.s.fNoMorePhysWrites = false; 1946 NOREF(enmOldState); NOREF(pvUser);1947 RT_NOREF(pVMM, enmOldState, pvUser); 1947 1948 } 1948 1949 #endif -
trunk/src/VBox/VMM/VMMR3/SSM.cpp
r93115 r93444 153 153 #include <VBox/vmm/vm.h> 154 154 #include <VBox/vmm/uvm.h> 155 #include <VBox/vmm/vmmr3vtable.h> 155 156 #include <VBox/err.h> 156 157 #include <VBox/log.h> … … 4549 4550 break; 4550 4551 case SSMUNITTYPE_EXTERNAL: 4551 rc = pUnit->u.External.pfnSaveDone(pSSM, pUnit->u.External.pvUser);4552 rc = pUnit->u.External.pfnSaveDone(pSSM, VMMR3GetVTable(), pUnit->u.External.pvUser); 4552 4553 break; 4553 4554 default: … … 4901 4902 break; 4902 4903 case SSMUNITTYPE_EXTERNAL: 4903 pUnit->u.External.pfnSaveExec(pSSM, pUnit->u.External.pvUser); 4904 rc = pSSM->rc; 4904 rc = pUnit->u.External.pfnSaveExec(pSSM, VMMR3GetVTable(), pUnit->u.External.pvUser); 4905 4905 break; 4906 4906 default: … … 4994 4994 break; 4995 4995 case SSMUNITTYPE_EXTERNAL: 4996 rc = pUnit->u.External.pfnSavePrep(pSSM, pUnit->u.External.pvUser);4996 rc = pUnit->u.External.pfnSavePrep(pSSM, VMMR3GetVTable(), pUnit->u.External.pvUser); 4997 4997 break; 4998 4998 default: … … 5340 5340 break; 5341 5341 case SSMUNITTYPE_EXTERNAL: 5342 rc = pUnit->u.External.pfnLiveVote(pSSM, pUnit->u.External.pvUser, uPass);5342 rc = pUnit->u.External.pfnLiveVote(pSSM, VMMR3GetVTable(), pUnit->u.External.pvUser, uPass); 5343 5343 break; 5344 5344 default: … … 5483 5483 break; 5484 5484 case SSMUNITTYPE_EXTERNAL: 5485 rc = pUnit->u.External.pfnLiveExec(pSSM, pUnit->u.External.pvUser, uPass);5485 rc = pUnit->u.External.pfnLiveExec(pSSM, VMMR3GetVTable(), pUnit->u.External.pvUser, uPass); 5486 5486 break; 5487 5487 default: … … 5645 5645 break; 5646 5646 case SSMUNITTYPE_EXTERNAL: 5647 rc = pUnit->u.External.pfnLivePrep(pSSM, pUnit->u.External.pvUser);5647 rc = pUnit->u.External.pfnLivePrep(pSSM, VMMR3GetVTable(), pUnit->u.External.pvUser); 5648 5648 break; 5649 5649 default: … … 8625 8625 break; 8626 8626 case SSMUNITTYPE_EXTERNAL: 8627 rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version, SSM_PASS_FINAL); 8627 rc = pUnit->u.External.pfnLoadExec(pSSM, VMMR3GetVTable(), pUnit->u.External.pvUser, 8628 UnitHdr.u32Version, SSM_PASS_FINAL); 8628 8629 break; 8629 8630 default: … … 8893 8894 break; 8894 8895 case SSMUNITTYPE_EXTERNAL: 8895 rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version, UnitHdr.u32Pass); 8896 rc = pUnit->u.External.pfnLoadExec(pSSM, VMMR3GetVTable(), pUnit->u.External.pvUser, 8897 UnitHdr.u32Version, UnitHdr.u32Pass); 8896 8898 break; 8897 8899 default: … … 9077 9079 break; 9078 9080 case SSMUNITTYPE_EXTERNAL: 9079 rc = pUnit->u.External.pfnLoadPrep(&Handle, pUnit->u.External.pvUser);9081 rc = pUnit->u.External.pfnLoadPrep(&Handle, VMMR3GetVTable(), pUnit->u.External.pvUser); 9080 9082 break; 9081 9083 default: … … 9153 9155 break; 9154 9156 case SSMUNITTYPE_EXTERNAL: 9155 rc = pUnit->u.External.pfnLoadDone(&Handle, pUnit->u.External.pvUser);9157 rc = pUnit->u.External.pfnLoadDone(&Handle, VMMR3GetVTable(), pUnit->u.External.pvUser); 9156 9158 break; 9157 9159 default: -
trunk/src/VBox/VMM/VMMR3/VM.cpp
r93115 r93444 68 68 #include "VMInternal.h" 69 69 #include <VBox/vmm/vmcc.h> 70 #include <VBox/vmm/vmmr3vtable.h> 70 71 71 72 #include <VBox/sup.h> … … 3167 3168 for (PVMATSTATE pCur = pUVM->vm.s.pAtState; pCur; pCur = pCur->pNext) 3168 3169 { 3169 pCur->pfnAtState(pUVM, enmStateNew, enmStateOld, pCur->pvUser);3170 pCur->pfnAtState(pUVM, VMMR3GetVTable(), enmStateNew, enmStateOld, pCur->pvUser); 3170 3171 if ( enmStateNew != VMSTATE_DESTROYING 3171 3172 && pVM->enmVMState == VMSTATE_DESTROYING) -
trunk/src/VBox/VMM/testcase/tstAnimate.cpp
r93115 r93444 319 319 320 320 /** 321 * Creates the default configuration. 321 * @callback_method_impl{FNCFGMCONSTRUCTOR, Creates the default configuration.} 322 * 322 323 * This assumes an empty tree. 323 *324 * @returns VBox status code.325 * @param pVM Pointer to the VM.326 324 */ 327 static DECLCALLBACK(int) cfgmR3CreateDefault(PUVM pUVM, PVM pVM, void *pvUser)328 { 329 RT_NOREF 1(pUVM);325 static DECLCALLBACK(int) cfgmR3CreateDefault(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, void *pvUser) 326 { 327 RT_NOREF(pUVM, pVMM); 330 328 uint64_t cbMem = *(uint64_t *)pvUser; 331 329 int rc; -
trunk/src/VBox/VMM/testcase/tstVMREQ.cpp
r93115 r93444 210 210 211 211 static DECLCALLBACK(int) 212 tstVMREQConfigConstructor(PUVM pUVM, PVM pVM, void *pvUser)213 { 214 RT_NOREF 2(pUVM, pvUser);212 tstVMREQConfigConstructor(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, void *pvUser) 213 { 214 RT_NOREF(pUVM, pVMM, pvUser); 215 215 return CFGMR3ConstructDefaultTree(pVM); 216 216 }
Note:
See TracChangeset
for help on using the changeset viewer.