Changeset 75495 in vbox
- Timestamp:
- Nov 15, 2018 8:53:00 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
include/VBox/HostServices/GuestPropertySvc.h (modified) (1 diff)
-
include/VBox/hgcmsvc.h (modified) (2 diffs)
-
src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp (modified) (2 diffs)
-
src/VBox/Main/include/ConsoleImpl.h (modified) (1 diff)
-
src/VBox/Main/include/HGCM.h (modified) (1 diff)
-
src/VBox/Main/src-client/ConsoleImpl.cpp (modified) (1 diff)
-
src/VBox/Main/src-client/ConsoleImpl2.cpp (modified) (4 diffs)
-
src/VBox/Main/src-client/HGCM.cpp (modified) (22 diffs)
-
src/VBox/Main/src-client/VMMDevInterface.cpp (modified) (2 diffs)
-
src/VBox/VMM/VMMR3/VMMR3.def (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/GuestPropertySvc.h
r71010 r75495 243 243 * parameter for the flags. */ 244 244 #define GUEST_PROP_FN_HOST_SET_GLOBAL_FLAGS 7 245 /** Return the pointer to a debug info function enumerating all guest246 * properties. */247 #define GUEST_PROP_FN_HOST_GET_DBGF_INFO 8248 245 /** @} */ 249 246 -
trunk/include/VBox/hgcmsvc.h
r75406 r75495 28 28 29 29 #include <iprt/assert.h> 30 #include <iprt/stdarg.h> 30 31 #include <iprt/string.h> 31 32 #include <VBox/cdefs.h> 32 33 #include <VBox/types.h> 33 34 #include <VBox/err.h> 35 #include <VBox/vmm/stam.h> 36 #include <VBox/vmm/dbgf.h> 34 37 #ifdef VBOX_TEST_HGCM_PARMS 35 38 # include <iprt/test.h> … … 91 94 DECLR3CALLBACKMEMBER(bool, pfnIsCallRestored, (VBOXHGCMCALLHANDLE callHandle)); 92 95 96 /** Access to STAMR3RegisterV. */ 97 DECLR3CALLBACKMEMBER(int, pfnStamRegisterV,(void *pvInstance, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, 98 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list va) 99 RT_IPRT_FORMAT_ATTR(7, 0)); 100 /** Access to STAMR3DeregisterV. */ 101 DECLR3CALLBACKMEMBER(int, pfnStamDeregisterV,(void *pvInstance, const char *pszPatFmt, va_list va) RT_IPRT_FORMAT_ATTR(2, 0)); 102 103 /** Access to DBGFR3InfoRegisterExternal. */ 104 DECLR3CALLBACKMEMBER(int, pfnInfoRegister,(void *pvInstance, const char *pszName, const char *pszDesc, 105 PFNDBGFHANDLEREXT pfnHandler, void *pvUser)); 106 /** Access to DBGFR3InfoDeregisterExternal. */ 107 DECLR3CALLBACKMEMBER(int, pfnInfoDeregister,(void *pvInstance, const char *pszName)); 108 93 109 } VBOXHGCMSVCHELPERS; 94 110 95 111 typedef VBOXHGCMSVCHELPERS *PVBOXHGCMSVCHELPERS; 112 113 #if defined(IN_RING3) || defined(IN_SLICKEDIT) 114 115 /** Wrapper around STAMR3RegisterF. */ 116 DECLINLINE(int) RT_IPRT_FORMAT_ATTR(7, 8) 117 HGCMSvcHlpStamRegister(PVBOXHGCMSVCHELPERS pHlp, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, 118 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...) 119 { 120 int rc; 121 va_list va; 122 va_start(va, pszName); 123 rc = pHlp->pfnStamRegisterV(pHlp->pvInstance, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va); 124 va_end(va); 125 return rc; 126 } 127 128 /** Wrapper around STAMR3RegisterV. */ 129 DECLINLINE(int) RT_IPRT_FORMAT_ATTR(7, 0) 130 HGCMSvcHlpStamRegisterV(PVBOXHGCMSVCHELPERS pHlp, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, 131 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list va) 132 { 133 return pHlp->pfnStamRegisterV(pHlp->pvInstance, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va); 134 } 135 136 /** Wrapper around STAMR3DeregisterF. */ 137 DECLINLINE(int) RT_IPRT_FORMAT_ATTR(2, 3) HGCMSvcHlpStamDeregister(PVBOXHGCMSVCHELPERS pHlp, const char *pszPatFmt, ...) 138 { 139 int rc; 140 va_list va; 141 va_start(va, pszPatFmt); 142 rc = pHlp->pfnStamDeregisterV(pHlp->pvInstance, pszPatFmt, va); 143 va_end(va); 144 return rc; 145 } 146 147 /** Wrapper around STAMR3DeregisterV. */ 148 DECLINLINE(int) RT_IPRT_FORMAT_ATTR(2, 0) HGCMSvcHlpStamDeregisterV(PVBOXHGCMSVCHELPERS pHlp, const char *pszPatFmt, va_list va) 149 { 150 return pHlp->pfnStamDeregisterV(pHlp->pvInstance, pszPatFmt, va); 151 } 152 153 /** Wrapper around DBGFR3InfoRegisterExternal. */ 154 DECLINLINE(int) HGCMSvcHlpInfoRegister(PVBOXHGCMSVCHELPERS pHlp, const char *pszName, const char *pszDesc, 155 PFNDBGFHANDLEREXT pfnHandler, void *pvUser) 156 { 157 return pHlp->pfnInfoRegister(pHlp->pvInstance, pszName, pszDesc, pfnHandler, pvUser); 158 } 159 160 /** Wrapper around DBGFR3InfoDeregisterExternal. */ 161 DECLINLINE(int) HGCMSvcHlpInfoDeregister(PVBOXHGCMSVCHELPERS pHlp, const char *pszName) 162 { 163 return pHlp->pfnInfoDeregister(pHlp->pvInstance, pszName); 164 } 165 166 #endif /* IN_RING3 */ 96 167 97 168 -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r69500 r75495 20 20 * Header Files * 21 21 *********************************************************************************************************************************/ 22 # define LOG_GROUP LOG_GROUP_SHARED_CLIPBOARD 22 23 #include "VBoxTray.h" 23 24 #include "VBoxHelpers.h" … … 29 30 #include <strsafe.h> 30 31 31 #ifdef DEBUG /** @todo r=bird: these are all default values. sigh. */32 # define LOG_ENABLED33 # define LOG_GROUP LOG_GROUP_SHARED_CLIPBOARD34 #endif35 32 #include <VBox/log.h> 36 33 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r75488 r75495 735 735 bool fAttachDetach, bool fIgnoreConnectFailure); 736 736 int i_configSerialPort(PCFGMNODE pInst, PortMode_T ePortMode, const char *pszPath, bool fServer); 737 static DECLCALLBACK(int) i_configGuestProperties(void *pvConsole , PUVM pUVM);737 static DECLCALLBACK(int) i_configGuestProperties(void *pvConsole); 738 738 static DECLCALLBACK(int) i_configGuestControl(void *pvConsole); 739 739 static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser); -
trunk/src/VBox/Main/include/HGCM.h
r75167 r75495 39 39 int HGCMHostReset (void); 40 40 41 int HGCMHostLoad (const char *pszServiceLibrary, const char *pszServiceName );41 int HGCMHostLoad (const char *pszServiceLibrary, const char *pszServiceName, PUVM pUVM); 42 42 43 43 int HGCMHostRegisterServiceExtension (HGCMSVCEXTHANDLE *pHandle, const char *pszServiceName, PFNHGCMSVCEXT pfnExtension, void *pvExtension); -
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 -
trunk/src/VBox/VMM/VMMR3/VMMR3.def
r75167 r75495 361 361 STAMR3SnapshotFree 362 362 STAMR3GetUnit 363 STAMR3RegisterFU 364 STAMR3RegisterVU 365 STAMR3DeregisterF 366 STAMR3DeregisterV 363 367 364 368 TMR3TimerSetCritSect
Note:
See TracChangeset
for help on using the changeset viewer.

