Changeset 75990 in vbox
- Timestamp:
- Dec 5, 2018 7:51:01 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
include/VBox/hgcmsvc.h (modified) (3 diffs)
-
include/VBox/vmm/pdmifs.h (modified) (3 diffs)
-
src/VBox/Devices/VMMDev/VMMDev.cpp (modified) (1 diff)
-
src/VBox/Devices/VMMDev/VMMDevHGCM.cpp (modified) (3 diffs)
-
src/VBox/Devices/VMMDev/VMMDevHGCM.h (modified) (1 diff)
-
src/VBox/Devices/VMMDev/VMMDevState.h (modified) (1 diff)
-
src/VBox/Main/include/HGCM.h (modified) (1 diff)
-
src/VBox/Main/src-client/HGCM.cpp (modified) (15 diffs)
-
src/VBox/Main/src-client/HGCMThread.cpp (modified) (1 diff)
-
src/VBox/Main/src-client/VMMDevInterface.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/hgcmsvc.h
r75969 r75990 73 73 * 6.4->6.5 Bacause pfnGetVMMDevSessionId was added pfnLoadState got the version 74 74 * parameter (VBox 6.0). 75 * 6.5->7.1 Because pfnNotify was added. 75 * 6.5->7.1 Because pfnNotify was added (VBox 6.0). 76 * 7.1->8.1 Because pfnCancelled & pfnIsCallCancelled were added (VBox 6.0). 76 77 */ 77 #define VBOX_HGCM_SVC_VERSION_MAJOR (0x000 7)78 #define VBOX_HGCM_SVC_VERSION_MAJOR (0x0008) 78 79 #define VBOX_HGCM_SVC_VERSION_MINOR (0x0001) 79 80 #define VBOX_HGCM_SVC_VERSION ((VBOX_HGCM_SVC_VERSION_MAJOR << 16) + VBOX_HGCM_SVC_VERSION_MINOR) … … 102 103 */ 103 104 DECLR3CALLBACKMEMBER(bool, pfnIsCallRestored, (VBOXHGCMCALLHANDLE callHandle)); 105 106 /** 107 * Check if the @a callHandle is for a cancelled call. 108 * 109 * @returns true if cancelled, false if not. 110 * @param callHandle The call we're checking up on. 111 */ 112 DECLR3CALLBACKMEMBER(bool, pfnIsCallCancelled, (VBOXHGCMCALLHANDLE callHandle)); 104 113 105 114 /** Access to STAMR3RegisterV. */ … … 512 521 DECLR3CALLBACKMEMBER(void, pfnCall, (void *pvService, VBOXHGCMCALLHANDLE callHandle, uint32_t u32ClientID, void *pvClient, 513 522 uint32_t function, uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival)); 523 /** Informs the service that a call was cancelled by the guest (optional). 524 * 525 * This is called for guest calls, connect requests and disconnect requests. 526 * There is unfortunately no way of obtaining the call handle for a guest call 527 * or otherwise identify the request, so that's left to the service to figure 528 * out using VBOXHGCMSVCHELPERS::pfnIsCallCancelled. Because this is an 529 * asynchronous call, the service may have completed the request already. 530 */ 531 DECLR3CALLBACKMEMBER(void, pfnCancelled, (void *pvService, uint32_t idClient, void *pvClient)); 514 532 515 533 /** Host Service entry point meant for privileged features invisible to the guest. -
trunk/include/VBox/vmm/pdmifs.h
r75853 r75990 2085 2085 2086 2086 /** 2087 * Checks if @a pCmd was cancelled. 2088 * 2089 * @returns true if cancelled, false if not. 2090 * @param pInterface Pointer to this interface. 2091 * @param pCmd The command we're checking on. 2092 */ 2093 DECLR3CALLBACKMEMBER(bool, pfnIsCmdCancelled,(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd)); 2094 2095 /** 2087 2096 * Gets the VMMDevRequestHeader::fRequestor value for @a pCmd. 2088 2097 * … … 2104 2113 } PDMIHGCMPORT; 2105 2114 /** PDMIHGCMPORT interface ID. */ 2106 # define PDMIHGCMPORT_IID " c9180235-8102-4642-0aa7-f0422124d9b5"2115 # define PDMIHGCMPORT_IID "28c0a201-68cd-4752-9404-bb42a0c09eb7" 2107 2116 2108 2117 … … 2158 2167 uint32_t cParms, PVBOXHGCMSVCPARM paParms, uint64_t tsArrival)); 2159 2168 2169 /** 2170 * Notification about the guest cancelling a pending request. 2171 * @param pInterface Pointer to this interface. 2172 * @param pCmd A pointer that identifies the command. 2173 * @param idclient The client id returned by the pfnConnect call. 2174 */ 2175 DECLR3CALLBACKMEMBER(void, pfnCancelled,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t idClient)); 2176 2160 2177 } PDMIHGCMCONNECTOR; 2161 2178 /** PDMIHGCMCONNECTOR interface ID. */ 2162 # define PDMIHGCMCONNECTOR_IID " a1104758-c888-4437-8f2a-7bac17865b5c"2179 # define PDMIHGCMCONNECTOR_IID "33cb5c91-6a4a-4ad9-3fec-d1f7d413c4a5" 2163 2180 2164 2181 #endif /* VBOX_WITH_HGCM */ -
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r75875 r75990 4427 4427 pThis->IHGCMPort.pfnCompleted = hgcmCompleted; 4428 4428 pThis->IHGCMPort.pfnIsCmdRestored = hgcmIsCmdRestored; 4429 pThis->IHGCMPort.pfnIsCmdCancelled = hgcmIsCmdCancelled; 4429 4430 pThis->IHGCMPort.pfnGetRequestor = hgcmGetRequestor; 4430 4431 pThis->IHGCMPort.pfnGetVMMDevSessionId = hgcmGetVMMDevSessionId; -
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
r75979 r75990 1169 1169 { 1170 1170 pCmd->fCancelled = true; 1171 1171 1172 Log(("vmmdevHGCMCancel2: Cancelled pCmd=%p / GCPhys=%#x\n", pCmd, GCPhys)); 1173 if (pThis->pHGCMDrv) 1174 pThis->pHGCMDrv->pfnCancelled(pThis->pHGCMDrv, pCmd, 1175 pCmd->enmCmdType == VBOXHGCMCMDTYPE_CALL ? pCmd->u.call.u32ClientID 1176 : pCmd->enmCmdType == VBOXHGCMCMDTYPE_CONNECT ? pCmd->u.connect.u32ClientID 1177 : pCmd->enmCmdType == VBOXHGCMCMDTYPE_DISCONNECT ? pCmd->u.disconnect.u32ClientID 1178 : 0); 1172 1179 } 1173 1180 else … … 1537 1544 1538 1545 /** 1546 * @interface_method_impl{PDMIHGCMPORT,pfnIsCmdCancelled} 1547 */ 1548 DECLCALLBACK(bool) hgcmIsCmdCancelled(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd) 1549 { 1550 RT_NOREF(pInterface); 1551 return pCmd && pCmd->fCancelled; 1552 } 1553 1554 /** 1539 1555 * @interface_method_impl{PDMIHGCMPORT,pfnGetRequestor} 1540 1556 */ … … 1589 1605 LogFlowFunc(("Saving %RGp, size %d\n", pCmd->GCPhys, pCmd->cbRequest)); 1590 1606 1607 /** @todo Don't save cancelled requests! It serves no purpose. See restore and 1608 * @bugref{4032#c4} for details. */ 1591 1609 SSMR3PutU32 (pSSM, (uint32_t)pCmd->enmCmdType); 1592 1610 SSMR3PutBool (pSSM, pCmd->fCancelled); -
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.h
r75853 r75990 31 31 DECLCALLBACK(int) hgcmCompleted(PPDMIHGCMPORT pInterface, int32_t result, PVBOXHGCMCMD pCmdPtr); 32 32 DECLCALLBACK(bool) hgcmIsCmdRestored(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd); 33 DECLCALLBACK(bool) hgcmIsCmdCancelled(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd); 33 34 DECLCALLBACK(uint32_t) hgcmGetRequestor(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd); 34 35 DECLCALLBACK(uint64_t) hgcmGetVMMDevSessionId(PPDMIHGCMPORT pInterface); -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r75855 r75990 156 156 /** LUN\#0: HGCM port interface. */ 157 157 PDMIHGCMPORT IHGCMPort; 158 # if HC_ARCH_BITS == 32159 RTR3PTR R3PtrAlignment1;160 # endif158 //# if HC_ARCH_BITS == 32 159 // RTR3PTR R3PtrAlignment1; 160 //# endif 161 161 #endif 162 162 /** Pointer to base interface of the driver. */ -
trunk/src/VBox/Main/include/HGCM.h
r75969 r75990 45 45 int HGCMGuestCall(PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmdPtr, uint32_t clientID, uint32_t function, uint32_t cParms, 46 46 VBOXHGCMSVCPARM *paParms, uint64_t tsArrival); 47 void HGCMGuestCancelled(PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmdPtr, uint32_t idClient); 47 48 48 49 int HGCMHostCall(const char *pszServiceName, uint32_t function, uint32_t cParms, VBOXHGCMSVCPARM aParms[]); -
trunk/src/VBox/Main/src-client/HGCM.cpp
r75978 r75990 143 143 static DECLCALLBACK(void) svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId); 144 144 static DECLCALLBACK(bool) svcHlpIsCallRestored(VBOXHGCMCALLHANDLE callHandle); 145 static DECLCALLBACK(bool) svcHlpIsCallCancelled(VBOXHGCMCALLHANDLE callHandle); 145 146 static DECLCALLBACK(int) svcHlpStamRegisterV(void *pvInstance, void *pvSample, STAMTYPE enmType, 146 147 STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc, … … 197 198 int GuestCall(PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t u32ClientId, 198 199 uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM aParms[], uint64_t tsArrival); 200 void GuestCancelled(PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t idClient); 199 201 }; 200 202 … … 403 405 */ 404 406 405 #define SVC_MSG_LOAD (0) /**< Load the service library and call VBOX_HGCM_SVCLOAD_NAME entry point. */ 406 #define SVC_MSG_UNLOAD (1) /**< call pfnUnload and unload the service library. */ 407 #define SVC_MSG_CONNECT (2) /**< pfnConnect */ 408 #define SVC_MSG_DISCONNECT (3) /**< pfnDisconnect */ 409 #define SVC_MSG_GUESTCALL (4) /**< pfnGuestCall */ 410 #define SVC_MSG_HOSTCALL (5) /**< pfnHostCall */ 411 #define SVC_MSG_LOADSTATE (6) /**< pfnLoadState. */ 412 #define SVC_MSG_SAVESTATE (7) /**< pfnSaveState. */ 413 #define SVC_MSG_QUIT (8) /**< Terminate the thread. */ 414 #define SVC_MSG_REGEXT (9) /**< pfnRegisterExtension */ 415 #define SVC_MSG_UNREGEXT (10) /**< pfnRegisterExtension */ 416 #define SVC_MSG_NOTIFY (11) /**< pfnNotify */ 407 #define SVC_MSG_LOAD (0) /**< Load the service library and call VBOX_HGCM_SVCLOAD_NAME entry point. */ 408 #define SVC_MSG_UNLOAD (1) /**< call pfnUnload and unload the service library. */ 409 #define SVC_MSG_CONNECT (2) /**< pfnConnect */ 410 #define SVC_MSG_DISCONNECT (3) /**< pfnDisconnect */ 411 #define SVC_MSG_GUESTCALL (4) /**< pfnGuestCall */ 412 #define SVC_MSG_HOSTCALL (5) /**< pfnHostCall */ 413 #define SVC_MSG_LOADSTATE (6) /**< pfnLoadState. */ 414 #define SVC_MSG_SAVESTATE (7) /**< pfnSaveState. */ 415 #define SVC_MSG_QUIT (8) /**< Terminate the thread. */ 416 #define SVC_MSG_REGEXT (9) /**< pfnRegisterExtension */ 417 #define SVC_MSG_UNREGEXT (10) /**< pfnRegisterExtension */ 418 #define SVC_MSG_NOTIFY (11) /**< pfnNotify */ 419 #define SVC_MSG_GUESTCANCELLED (12) /**< pfnCancelled */ 417 420 #ifdef VBOX_WITH_CRHGSMI 418 421 # define SVC_MSG_HOSTFASTCALLASYNC (21) /* pfnHostCall */ … … 487 490 /** The STAM_GET_TS() value when the request arrived. */ 488 491 uint64_t tsArrival; 492 }; 493 494 class HGCMMsgCancelled: public HGCMMsgHeader 495 { 496 public: 497 HGCMMsgCancelled() {} 498 499 HGCMMsgCancelled(HGCMThread *pThread) 500 { 501 InitializeCore(SVC_MSG_GUESTCANCELLED, pThread); 502 Initialize(); 503 } 504 ~HGCMMsgCancelled() { Log(("~HGCMMsgCancelled %p\n", this)); } 505 506 /** The client identifier. */ 507 uint32_t idClient; 489 508 }; 490 509 … … 566 585 case SVC_MSG_UNREGEXT: return new HGCMMsgSvcUnregisterExtension(); 567 586 case SVC_MSG_NOTIFY: return new HGCMMsgNotify(); 587 case SVC_MSG_GUESTCANCELLED: return new HGCMMsgCancelled(); 568 588 default: 569 589 AssertReleaseMsgFailed(("Msg id = %08X\n", u32MsgId)); … … 687 707 HGCM_CLIENT_DATA(pSvc, pClient), pMsg->u32Function, 688 708 pMsg->cParms, pMsg->paParms, pMsg->tsArrival); 709 710 hgcmObjDereference(pClient); 711 } 712 else 713 { 714 rc = VERR_HGCM_INVALID_CLIENT_ID; 715 } 716 } break; 717 718 case SVC_MSG_GUESTCANCELLED: 719 { 720 HGCMMsgCancelled *pMsg = (HGCMMsgCancelled *)pMsgCore; 721 722 LogFlowFunc(("SVC_MSG_GUESTCANCELLED idClient = %d\n", pMsg->idClient)); 723 724 HGCMClient *pClient = (HGCMClient *)hgcmObjReference(pMsg->idClient, HGCMOBJ_CLIENT); 725 726 if (pClient) 727 { 728 pSvc->m_fntable.pfnCancelled(pSvc->m_fntable.pvService, pMsg->idClient, HGCM_CLIENT_DATA(pSvc, pClient)); 689 729 690 730 hgcmObjDereference(pClient); … … 883 923 /* static */ DECLCALLBACK(bool) HGCMService::svcHlpIsCallRestored(VBOXHGCMCALLHANDLE callHandle) 884 924 { 885 HGCMMsgHeader *pMsgHdr = (HGCMMsgHeader *) (callHandle);925 HGCMMsgHeader *pMsgHdr = (HGCMMsgHeader *)callHandle; 886 926 AssertPtrReturn(pMsgHdr, false); 887 927 … … 893 933 894 934 return pHgcmPort->pfnIsCmdRestored(pHgcmPort, pCmd); 935 } 936 937 /** 938 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnIsCallCancelled} 939 */ 940 /* static */ DECLCALLBACK(bool) HGCMService::svcHlpIsCallCancelled(VBOXHGCMCALLHANDLE callHandle) 941 { 942 HGCMMsgHeader *pMsgHdr = (HGCMMsgHeader *)callHandle; 943 AssertPtrReturn(pMsgHdr, false); 944 945 PVBOXHGCMCMD pCmd = pMsgHdr->pCmd; 946 AssertPtrReturn(pCmd, false); 947 948 PPDMIHGCMPORT pHgcmPort = pMsgHdr->pHGCMPort; 949 AssertPtrReturn(pHgcmPort, false); 950 951 return pHgcmPort->pfnIsCmdCancelled(pHgcmPort, pCmd); 895 952 } 896 953 … … 1041 1098 m_svcHelpers.pfnDisconnectClient = svcHlpDisconnectClient; 1042 1099 m_svcHelpers.pfnIsCallRestored = svcHlpIsCallRestored; 1100 m_svcHelpers.pfnIsCallCancelled = svcHlpIsCallCancelled; 1043 1101 m_svcHelpers.pfnStamRegisterV = svcHlpStamRegisterV; 1044 1102 m_svcHelpers.pfnStamDeregisterV = svcHlpStamDeregisterV; … … 1756 1814 uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival) 1757 1815 { 1758 LogFlow(("MAIN::HGCMService:: Call\n"));1816 LogFlow(("MAIN::HGCMService::GuestCall\n")); 1759 1817 1760 1818 int rc; … … 1762 1820 if (pMsg) 1763 1821 { 1764 pMsg->Reference(); 1822 pMsg->Reference(); /** @todo starts out with zero references. */ 1765 1823 1766 1824 pMsg->pCmd = pCmd; … … 1776 1834 else 1777 1835 { 1778 Log(("MAIN::HGCMService:: Call: Message allocation failed\n"));1836 Log(("MAIN::HGCMService::GuestCall: Message allocation failed\n")); 1779 1837 rc = VERR_NO_MEMORY; 1780 1838 } … … 1782 1840 LogFlowFunc(("rc = %Rrc\n", rc)); 1783 1841 return rc; 1842 } 1843 1844 /** Guest cancelled a request (call, connection attempt, disconnect attempt). 1845 * 1846 * @param pHGCMPort The port to be used for completion confirmation. 1847 * @param pCmd The VBox HGCM context. 1848 * @param u32ClientId The client handle to be disconnected and deleted. 1849 * @return VBox rc. 1850 */ 1851 void HGCMService::GuestCancelled(PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t idClient) 1852 { 1853 LogFlow(("MAIN::HGCMService::GuestCancelled\n")); 1854 1855 if (m_fntable.pfnCancelled) 1856 { 1857 HGCMMsgCancelled *pMsg = new (std::nothrow) HGCMMsgCancelled(m_pThread); 1858 if (pMsg) 1859 { 1860 pMsg->Reference(); /** @todo starts out with zero references. */ 1861 1862 pMsg->pCmd = pCmd; 1863 pMsg->pHGCMPort = pHGCMPort; 1864 pMsg->idClient = idClient; 1865 1866 hgcmMsgPost(pMsg, NULL); 1867 } 1868 else 1869 Log(("MAIN::HGCMService::GuestCancelled: Message allocation failed\n")); 1870 } 1784 1871 } 1785 1872 … … 2579 2666 } 2580 2667 2581 /* The guest calls the service.2668 /** The guest calls the service. 2582 2669 * 2583 2670 * @param pHGCMPort The port to be used for completion confirmation. 2584 2671 * @param pCmd The VBox HGCM context. 2585 * @param u32ClientId The client handle to be disconnected and deleted.2672 * @param u32ClientId The client handle. 2586 2673 * @param u32Function The function number. 2587 2674 * @param cParms Number of parameters. … … 2623 2710 LogFlowFunc(("rc = %Rrc\n", rc)); 2624 2711 return rc; 2712 } 2713 2714 /** The guest cancelled a request (call, connect, disconnect) 2715 * 2716 * @param pHGCMPort The port to be used for completion confirmation. 2717 * @param pCmd The VBox HGCM context. 2718 * @param idClient The client handle. 2719 */ 2720 void HGCMGuestCancelled(PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t idClient) 2721 { 2722 LogFlowFunc(("pHGCMPort = %p, pCmd = %p, idClient = %d\n", pHGCMPort, pCmd, idClient)); 2723 AssertReturnVoid(pHGCMPort); 2724 AssertReturnVoid(pCmd); 2725 AssertReturnVoid(idClient != 0); 2726 2727 /* Resolve the client handle to the client instance pointer. */ 2728 HGCMClient *pClient = (HGCMClient *)hgcmObjReference(idClient, HGCMOBJ_CLIENT); 2729 2730 if (pClient) 2731 { 2732 AssertRelease(pClient->pService); 2733 2734 /* Forward the message to the service thread. */ 2735 pClient->pService->GuestCancelled(pHGCMPort, pCmd, idClient); 2736 2737 hgcmObjDereference(pClient); 2738 } 2739 2740 LogFlowFunc(("returns\n")); 2625 2741 } 2626 2742 -
trunk/src/VBox/Main/src-client/HGCMThread.cpp
r75798 r75990 704 704 pMsg->Dereference(); 705 705 706 LogFlow(("MAIN::hgcmMsgPostInternal: pMsg %p, rc = %Rrc\n", pMsg, rc));706 LogFlow(("MAIN::hgcmMsgPostInternal: pMsg = %p, rc = %Rrc\n", pMsg, rc)); 707 707 return rc; 708 708 } -
trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
r75969 r75990 649 649 650 650 return HGCMGuestCall(pDrv->pHGCMPort, pCmd, u32ClientID, u32Function, cParms, paParms, tsArrival); 651 } 652 653 static DECLCALLBACK(void) iface_hgcmCancelled(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t idClient) 654 { 655 Log9(("Enter\n")); 656 657 PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, HGCMConnector); 658 if ( pDrv->pVMMDev 659 && pDrv->pVMMDev->hgcmIsActive()) 660 return HGCMGuestCancelled(pDrv->pHGCMPort, pCmd, idClient); 651 661 } 652 662 … … 1059 1069 pThis->HGCMConnector.pfnDisconnect = iface_hgcmDisconnect; 1060 1070 pThis->HGCMConnector.pfnCall = iface_hgcmCall; 1071 pThis->HGCMConnector.pfnCancelled = iface_hgcmCancelled; 1061 1072 #endif 1062 1073
Note:
See TracChangeset
for help on using the changeset viewer.

