Changeset 75495 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Nov 15, 2018 8:53:00 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 126652
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r75488 r75495 8218 8218 alock.release(); 8219 8219 8220 DBGFR3InfoDeregisterExternal(pUVM, "guestprops"); /* will crash in unloaded code if we guru later */8221 8220 m_pVMMDev->hgcmShutdown(); 8222 8221 -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r75352 r75495 3192 3192 * Guest property service. 3193 3193 */ 3194 rc = i_configGuestProperties(this , pUVM);3195 #endif /* VBOX_WITH_GUEST_PROPS defined */3194 rc = i_configGuestProperties(this); 3195 #endif 3196 3196 3197 3197 #ifdef VBOX_WITH_GUEST_CONTROL … … 3200 3200 */ 3201 3201 rc = i_configGuestControl(this); 3202 #endif /* VBOX_WITH_GUEST_CONTROL defined */3202 #endif 3203 3203 3204 3204 /* … … 6091 6091 * the machine XML and set a couple of initial properties. 6092 6092 */ 6093 /* static */ int Console::i_configGuestProperties(void *pvConsole , PUVM pUVM)6093 /* static */ int Console::i_configGuestProperties(void *pvConsole) 6094 6094 { 6095 6095 #ifdef VBOX_WITH_GUEST_PROPS … … 6115 6115 * change. 6116 6116 */ 6117 6118 {6119 VBOXHGCMSVCPARM Params[2];6120 int rc2 = pConsole->m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", GUEST_PROP_FN_HOST_GET_DBGF_INFO, 2, &Params[0]);6121 if (RT_SUCCESS(rc2))6122 {6123 PFNDBGFHANDLEREXT pfnHandler = (PFNDBGFHANDLEREXT)(uintptr_t)Params[0].u.pointer.addr;6124 void *pvService = Params[1].u.pointer.addr;6125 DBGFR3InfoRegisterExternal(pUVM, "guestprops", "Display the guest properties", pfnHandler, pvService);6126 }6127 }6128 6117 6129 6118 /* Sysprep execution by VBoxService. */ -
trunk/src/VBox/Main/src-client/HGCM.cpp
r75406 r75495 25 25 #include <VBox/hgcmsvc.h> 26 26 #include <VBox/vmm/ssm.h> 27 #include <VBox/vmm/stam.h> 27 28 #include <VBox/sup.h> 28 29 … … 115 116 HGCMSVCEXTHANDLE m_hExtension; 116 117 118 PUVM m_pUVM; 119 120 /** @name Statistics 121 * @{ */ 122 STAMPROFILE m_StatHandleMsg; 123 /** @} */ 124 117 125 int loadServiceDLL(void); 118 126 void unloadServiceDLL(void); … … 121 129 * Main HGCM thread methods. 122 130 */ 123 int instanceCreate(const char *pszServiceLibrary, const char *pszServiceName );131 int instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM); 124 132 void instanceDestroy(void); 125 133 … … 133 141 static DECLCALLBACK(void) svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId); 134 142 static DECLCALLBACK(bool) svcHlpIsCallRestored(VBOXHGCMCALLHANDLE callHandle); 143 static DECLCALLBACK(int) svcHlpStamRegisterV(void *pvInstance, void *pvSample, STAMTYPE enmType, 144 STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc, 145 const char *pszName, va_list va); 146 static DECLCALLBACK(int) svcHlpStamDeregisterV(void *pvInstance, const char *pszPatFmt, va_list va); 147 static DECLCALLBACK(int) svcHlpInfoRegister(void *pvInstance, const char *pszName, const char *pszDesc, 148 PFNDBGFHANDLEREXT pfnHandler, void *pvUser); 149 static DECLCALLBACK(int) svcHlpInfoDeregister(void *pvInstance, const char *pszName); 135 150 136 151 public: … … 139 154 * Main HGCM thread methods. 140 155 */ 141 static int LoadService(const char *pszServiceLibrary, const char *pszServiceName );156 static int LoadService(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM); 142 157 void UnloadService(void); 143 158 … … 243 258 m_cHandleAcquires (0), 244 259 #endif 245 m_hExtension (NULL) 260 m_hExtension (NULL), 261 m_pUVM (NULL) 246 262 { 247 263 RT_ZERO(m_fntable); … … 380 396 class HGCMMsgSvcLoad: public HGCMMsgCore 381 397 { 398 public: 399 HGCMMsgSvcLoad() : HGCMMsgCore(), pUVM() {} 400 401 /** The user mode VM handle (for statistics and such). */ 402 PUVM pUVM; 382 403 }; 383 404 … … 525 546 } 526 547 548 STAM_REL_PROFILE_START(&pSvc->m_StatHandleMsg, a); 549 527 550 /* Cache required information to avoid unnecessary pMsgCore access. */ 528 551 uint32_t u32MsgId = pMsgCore->MsgId(); … … 753 776 hgcmMsgComplete (pMsgCore, rc); 754 777 } 778 STAM_REL_PROFILE_STOP(&pSvc->m_StatHandleMsg, a); 755 779 } 756 780 } … … 807 831 } 808 832 833 /** 834 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnStamRegisterV} 835 */ 836 /* static */ DECLCALLBACK(int) 837 HGCMService::svcHlpStamRegisterV(void *pvInstance, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, 838 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list va) 839 { 840 HGCMService *pService = static_cast <HGCMService *>(pvInstance); 841 AssertPtrReturn(pService, VERR_INVALID_PARAMETER); 842 843 return STAMR3RegisterVU(pService->m_pUVM, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va); 844 } 845 846 /** 847 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnStamDeregisterV} 848 */ 849 /* static */ DECLCALLBACK(int) HGCMService::svcHlpStamDeregisterV(void *pvInstance, const char *pszPatFmt, va_list va) 850 { 851 HGCMService *pService = static_cast <HGCMService *>(pvInstance); 852 AssertPtrReturn(pService, VERR_INVALID_PARAMETER); 853 854 return STAMR3DeregisterV(pService->m_pUVM, pszPatFmt, va); 855 } 856 857 /** 858 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnInfoRegister} 859 */ 860 /* static */ DECLCALLBACK(int) HGCMService::svcHlpInfoRegister(void *pvInstance, const char *pszName, const char *pszDesc, 861 PFNDBGFHANDLEREXT pfnHandler, void *pvUser) 862 { 863 HGCMService *pService = static_cast <HGCMService *>(pvInstance); 864 AssertPtrReturn(pService, VERR_INVALID_PARAMETER); 865 866 return DBGFR3InfoRegisterExternal(pService->m_pUVM, pszName, pszDesc, pfnHandler, pvUser); 867 } 868 869 /** 870 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnInfoDeregister} 871 */ 872 /* static */ DECLCALLBACK(int) HGCMService::svcHlpInfoDeregister(void *pvInstance, const char *pszName) 873 { 874 HGCMService *pService = static_cast <HGCMService *>(pvInstance); 875 AssertPtrReturn(pService, VERR_INVALID_PARAMETER); 876 877 return DBGFR3InfoDeregisterExternal(pService->m_pUVM, pszName); 878 } 879 880 809 881 static DECLCALLBACK(void) hgcmMsgCompletionCallback(int32_t result, HGCMMsgCore *pMsgCore) 810 882 { … … 824 896 */ 825 897 826 int HGCMService::instanceCreate(const char *pszServiceLibrary, const char *pszServiceName )898 int HGCMService::instanceCreate(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM) 827 899 { 828 900 LogFlowFunc(("name %s, lib %s\n", pszServiceName, pszServiceLibrary)); 829 830 901 /* The maximum length of the thread name, allowed by the RT is 15. */ 831 902 char szThreadName[16]; … … 856 927 else 857 928 { 929 /* Register statistics: */ 930 m_pUVM = pUVM; 931 STAMR3RegisterFU(pUVM, &m_StatHandleMsg, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 932 "Message handling", "/HGCM/%s/Msg", pszServiceName); 933 858 934 /* Initialize service helpers table. */ 859 935 m_svcHelpers.pfnCallComplete = svcHlpCallComplete; … … 861 937 m_svcHelpers.pfnDisconnectClient = svcHlpDisconnectClient; 862 938 m_svcHelpers.pfnIsCallRestored = svcHlpIsCallRestored; 939 m_svcHelpers.pfnStamRegisterV = svcHlpStamRegisterV; 940 m_svcHelpers.pfnStamDeregisterV = svcHlpStamDeregisterV; 941 m_svcHelpers.pfnInfoRegister = svcHlpInfoRegister; 942 m_svcHelpers.pfnInfoDeregister = svcHlpInfoDeregister; 863 943 864 944 /* Execute the load request on the service thread. */ … … 868 948 if (RT_SUCCESS(rc)) 869 949 { 950 HGCMMsgSvcLoad *pMsg = (HGCMMsgSvcLoad *)hgcmObjReference(hMsg, HGCMOBJ_MSG); 951 AssertRelease(pMsg); 952 pMsg->pUVM = pUVM; 953 hgcmObjDereference(pMsg); 954 870 955 rc = hgcmMsgSend(hMsg); 871 956 } … … 899 984 } 900 985 986 if (m_pszSvcName) 987 STAMR3DeregisterF(m_pUVM, "/HGCM/%s/*", m_pszSvcName); 988 m_pUVM = NULL; 989 901 990 RTStrFree(m_pszSvcLibrary); 902 991 m_pszSvcLibrary = NULL; … … 960 1049 * @param pszServiceLibrary The library to be loaded. 961 1050 * @param pszServiceName The name of the service. 1051 * @param pUVM The user mode VM handle (for statistics and such). 962 1052 * @return VBox rc. 963 1053 * @thread main HGCM 964 1054 */ 965 /* static */ int HGCMService::LoadService(const char *pszServiceLibrary, const char *pszServiceName )966 { 967 LogFlowFunc(("lib %s, name = %s \n", pszServiceLibrary, pszServiceName));1055 /* static */ int HGCMService::LoadService(const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM) 1056 { 1057 LogFlowFunc(("lib %s, name = %s, pUVM = %p\n", pszServiceLibrary, pszServiceName, pUVM)); 968 1058 969 1059 /* Look at already loaded services to avoid double loading. */ … … 981 1071 { 982 1072 /* Create the new service. */ 983 pSvc = new HGCMService();1073 pSvc = new (std::nothrow) HGCMService(); 984 1074 985 1075 if (!pSvc) … … 990 1080 { 991 1081 /* Load the library and call the initialization entry point. */ 992 rc = pSvc->instanceCreate(pszServiceLibrary, pszServiceName );1082 rc = pSvc->instanceCreate(pszServiceLibrary, pszServiceName, pUVM); 993 1083 994 1084 if (RT_SUCCESS(rc)) … … 1744 1834 /* Name to be assigned to the service. */ 1745 1835 const char *pszServiceName; 1836 /** The user mode VM handle (for statistics and such). */ 1837 PUVM pUVM; 1746 1838 }; 1747 1839 … … 1916 2008 HGCMMsgMainLoad *pMsg = (HGCMMsgMainLoad *)pMsgCore; 1917 2009 1918 LogFlowFunc(("HGCM_MSG_LOAD pszServiceName = %s, pMsg->pszServiceLibrary = %s \n",1919 pMsg->pszServiceName, pMsg->pszServiceLibrary ));1920 1921 rc = HGCMService::LoadService(pMsg->pszServiceLibrary, pMsg->pszServiceName );2010 LogFlowFunc(("HGCM_MSG_LOAD pszServiceName = %s, pMsg->pszServiceLibrary = %s, pMsg->pUVM = %p\n", 2011 pMsg->pszServiceName, pMsg->pszServiceLibrary, pMsg->pUVM)); 2012 2013 rc = HGCMService::LoadService(pMsg->pszServiceLibrary, pMsg->pszServiceName, pMsg->pUVM); 1922 2014 } break; 1923 2015 … … 2109 2201 * @param pszServiceLibrary The library to be loaded. 2110 2202 * @param pszServiceName The name to be assigned to the service. 2203 * @param pUVM The user mode VM handle (for statistics and such). 2111 2204 * @return VBox rc. 2112 2205 */ 2113 2206 int HGCMHostLoad(const char *pszServiceLibrary, 2114 const char *pszServiceName) 2207 const char *pszServiceName, 2208 PUVM pUVM) 2115 2209 { 2116 2210 LogFlowFunc(("lib = %s, name = %s\n", pszServiceLibrary, pszServiceName)); … … 2134 2228 pMsg->pszServiceLibrary = pszServiceLibrary; 2135 2229 pMsg->pszServiceName = pszServiceName; 2230 pMsg->pUVM = pUVM; 2136 2231 2137 2232 hgcmObjDereference(pMsg); -
trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
r75167 r75495 98 98 { 99 99 ASMAtomicWriteBool(&m_fHGCMActive, false); 100 if (mParent)101 {102 Console::SafeVMPtrQuiet ptrVM(mParent);103 if (ptrVM.rawUVM())104 DBGFR3InfoDeregisterExternal(ptrVM.rawUVM(), "guestprops"); /* will crash in unloaded code if we guru later */105 }106 100 HGCMHostShutdown(); 107 101 } … … 701 695 return VERR_INVALID_STATE; 702 696 703 return HGCMHostLoad(pszServiceLibrary, pszServiceName); 697 Console::SafeVMPtrQuiet ptrVM(mParent); 698 return HGCMHostLoad(pszServiceLibrary, pszServiceName, ptrVM.rawUVM()); 704 699 } 705 700
Note:
See TracChangeset
for help on using the changeset viewer.