Changeset 3379 in vbox for trunk/src/VBox/Devices/VMMDev
- Timestamp:
- Jul 3, 2007 9:25:38 AM (18 years ago)
- Location:
- trunk/src/VBox/Devices/VMMDev
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VMMDev/VBoxDev.cpp
r3345 r3379 32 32 #include <VBox/pgm.h> 33 33 #include <VBox/err.h> 34 #include <VBox/vm.h> /* for VM_IS_EMT */ 34 35 35 36 #define LOG_GROUP LOG_GROUP_DEV_VMM … … 209 210 } 210 211 211 void vmmdevCtlGuestFilterMask_EMT (VMMDevState *pVMMDevState,212 uint32_t u32OrMask,213 uint32_t u32NotMask)212 static void vmmdevCtlGuestFilterMask_EMT (VMMDevState *pVMMDevState, 213 uint32_t u32OrMask, 214 uint32_t u32NotMask) 214 215 { 215 216 const bool fHadEvents = … … 230 231 pVMMDevState->u32GuestFilterMask &= ~u32NotMask; 231 232 vmmdevMaybeSetIRQ_EMT (pVMMDevState); 233 } 234 } 235 236 void VMMDevCtlSetGuestFilterMask (VMMDevState *pVMMDevState, 237 uint32_t u32OrMask, 238 uint32_t u32NotMask) 239 { 240 PPDMDEVINS pDevIns = VMMDEVSTATE_2_DEVINS(pVMMDevState); 241 PVM pVM = PDMDevHlpGetVM(pDevIns); 242 243 #ifdef DEBUG_sunlover 244 Log(("VMMDevCtlSetGuestFilterMask: u32OrMask = 0x%08X, u32NotMask = 0x%08X.\n", u32OrMask, u32NotMask)); 245 #endif /* DEBUG_sunlover */ 246 247 if (VM_IS_EMT(pVM)) 248 { 249 vmmdevCtlGuestFilterMask_EMT (pVMMDevState, u32OrMask, u32NotMask); 250 } 251 else 252 { 253 int rc; 254 PVMREQ pReq; 255 256 rc = VMR3ReqCallVoid (pVM, &pReq, RT_INDEFINITE_WAIT, 257 (PFNRT) vmmdevCtlGuestFilterMask_EMT, 258 3, pVMMDevState, u32OrMask, u32NotMask); 259 AssertReleaseRC (rc); 260 VMR3ReqFree (pReq); 232 261 } 233 262 } … … 898 927 899 928 pCtlMaskRequest = (VMMDevCtlGuestFilterMask *) requestHeader; 929 /* The HGCM events are enabled by the VMMDev device automatically when any 930 * HGCM command is issued. The guest then can not disable these events. 931 */ 900 932 vmmdevCtlGuestFilterMask_EMT (pData, 901 933 pCtlMaskRequest->u32OrMask, 902 pCtlMaskRequest->u32NotMask );934 pCtlMaskRequest->u32NotMask & ~VMMDEV_EVENT_HGCM); 903 935 requestHeader->rc = VINF_SUCCESS; 904 936 … … 1777 1809 rc = RTCritSectInit(&pData->critsectHGCMCmdList); 1778 1810 AssertRCReturn(rc, rc); 1779 pData->u32HGCM Refs= 0;1811 pData->u32HGCMEnabled = 0; 1780 1812 #endif /* VBOX_HGCM */ 1781 1813 -
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
r3345 r3379 132 132 || enmCmdType == VBOXHGCMCMDTYPE_CALL) 133 133 { 134 uint32_t u32 = ASMAtomicIncU32 (&pVMMDevState->u32HGCMRefs); 135 Assert(u32 != 0); 136 vmmdevCtlGuestFilterMask_EMT (pVMMDevState, VMMDEV_EVENT_HGCM, 0); 134 if (ASMAtomicCmpXchgU32(&pVMMDevState->u32HGCMEnabled, 1, 0)) 135 { 136 VMMDevCtlSetGuestFilterMask (pVMMDevState, VMMDEV_EVENT_HGCM, 0); 137 } 137 138 } 138 139 … … 169 170 { 170 171 pVMMDevState->pHGCMCmdList = pCmd->pNext; 171 }172 173 /* Automatically disable HGCM events, if there are no more HGCM commands. */174 if ( pCmd->enmCmdType == VBOXHGCMCMDTYPE_CONNECT175 || pCmd->enmCmdType == VBOXHGCMCMDTYPE_DISCONNECT176 || pCmd->enmCmdType == VBOXHGCMCMDTYPE_CALL)177 {178 uint32_t u32 = ASMAtomicDecU32 (&pVMMDevState->u32HGCMRefs);179 Assert(u32 != 0xFFFFFFFF);180 if (u32 == 0)181 {182 vmmdevCtlGuestFilterMask_EMT (pVMMDevState, 0, VMMDEV_EVENT_HGCM);183 }184 172 } 185 173 -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r3345 r3379 148 148 /** Critical section to protect the list. */ 149 149 RTCRITSECT critsectHGCMCmdList; 150 /** How many HGCM commands are pending. */151 volatile uint32_t u32HGCMRefs;150 /** Whether the HGCM events are already automatically enabled. */ 151 uint32_t u32HGCMEnabled; 152 152 #endif /* VBOX_HGCM */ 153 153 … … 155 155 156 156 void VMMDevNotifyGuest (VMMDevState *pVMMDevState, uint32_t u32EventMask); 157 void vmmdevCtlGuestFilterMask_EMT(VMMDevState *pVMMDevState,158 159 157 void VMMDevCtlSetGuestFilterMask (VMMDevState *pVMMDevState, 158 uint32_t u32OrMask, 159 uint32_t u32NotMask); 160 160 161 161 #endif /* __VMMDevState_h__ */
Note:
See TracChangeset
for help on using the changeset viewer.