Changeset 50537 in vbox for trunk/src/VBox/Additions/common/VBoxGuest
- Timestamp:
- Feb 21, 2014 12:11:24 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r50523 r50537 927 927 pDevExt->MouseNotifyCallback.pfnNotify = NULL; 928 928 pDevExt->MouseNotifyCallback.pvUser = NULL; 929 pDevExt->cISR = 0;930 929 931 930 /* … … 1463 1462 * @param pDevExt The device extension. 1464 1463 * @param pNotify The new callback information. 1465 * @note This function takes the session spinlock to update the callback1466 * information, but the interrupt handler will not do this. To make1467 * sure that the interrupt handler sees a consistent structure, we1468 * set the function pointer to NULL before updating the data and only1469 * set it to the correct value once the data is updated. Since the1470 * interrupt handler executes atomically this ensures that the data is1471 * valid if the function pointer is non-NULL.1472 1464 */ 1473 1465 int VBoxGuestCommonIOCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify) … … 1478 1470 pDevExt->MouseNotifyCallback = *pNotify; 1479 1471 RTSpinlockReleaseNoInts(pDevExt->EventSpinlock); 1480 1481 /* Make sure no active ISR is referencing the old data - hacky but should be1482 * effective. */1483 while (pDevExt->cISR > 0)1484 ASMNopPause();1485 1486 1472 return VINF_SUCCESS; 1487 1473 } … … 2969 2955 bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt) 2970 2956 { 2971 #ifndef RT_OS_WINDOWS2972 VBoxGuestMouseSetNotifyCallback MouseNotifyCallback = { NULL, NULL };2973 #endif2974 2957 bool fMousePositionChanged = false; 2975 2958 VMMDevEvents volatile *pReq = pDevExt->pIrqAckEvents; … … 2984 2967 2985 2968 /* 2986 * Enter the spinlock, increase the ISR count and check if it's our IRQ or 2987 * not. 2969 * Enter the spinlock and check if it's our IRQ or not. 2988 2970 */ 2989 2971 RTSpinlockAcquire(pDevExt->EventSpinlock); 2990 ASMAtomicIncU32(&pDevExt->cISR);2991 2972 fOurIrq = pDevExt->pVMMDevMemory->V.V1_04.fHaveEvents; 2992 2973 if (fOurIrq) … … 3014 2995 if (fEvents & VMMDEV_EVENT_MOUSE_POSITION_CHANGED) 3015 2996 { 3016 #ifndef RT_OS_WINDOWS3017 MouseNotifyCallback = pDevExt->MouseNotifyCallback;3018 #endif3019 2997 fMousePositionChanged = true; 3020 2998 fEvents &= ~VMMDEV_EVENT_MOUSE_POSITION_CHANGED; 2999 #ifndef RT_OS_WINDOWS 3000 if (pDevExt->MouseNotifyCallback.pfnNotify) 3001 pDevExt->MouseNotifyCallback.pfnNotify 3002 (pDevExt->MouseNotifyCallback.pvUser); 3003 #endif 3021 3004 } 3022 3005 … … 3096 3079 ASMAtomicIncU32(&pDevExt->u32MousePosChangedSeq); 3097 3080 VBoxGuestNativeISRMousePollEvent(pDevExt); 3098 #ifndef RT_OS_WINDOWS 3099 if (MouseNotifyCallback.pfnNotify) 3100 MouseNotifyCallback.pfnNotify(MouseNotifyCallback.pvUser); 3101 #endif 3102 } 3103 3104 ASMAtomicDecU32(&pDevExt->cISR); 3081 } 3082 3105 3083 Assert(rc == 0); 3106 3084 NOREF(rc); -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
r50523 r50537 170 170 /** Memory balloon information for RTR0MemObjAllocPhysNC(). */ 171 171 VBOXGUESTMEMBALLOON MemBalloon; 172 /** Counter of number of active ISRs. Currently used for safely removing173 * the mouse handler callback. */174 uint32_t volatile cISR;175 172 /** Callback and user data for a kernel mouse handler. */ 176 173 VBoxGuestMouseSetNotifyCallback MouseNotifyCallback;
Note:
See TracChangeset
for help on using the changeset viewer.