- Timestamp:
- Mar 3, 2015 11:00:35 PM (10 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r54612 r54613 1006 1006 pDevExt->fMouseStatusHost = UINT32_MAX; /* forces a report */ 1007 1007 1008 pDevExt-> u32AcquireModeGuestCaps = 0;1009 pDevExt-> u32SetModeGuestCaps = 0;1010 pDevExt-> u32GuestCapsAcquired= 0;1008 pDevExt->fAcquireModeGuestCaps = 0; 1009 pDevExt->fSetModeGuestCaps = 0; 1010 pDevExt->fAcquiredGuestCaps = 0; 1011 1011 vbgdBitUsageTrackerClear(&pDevExt->SetGuestCapsTracker); 1012 1012 pDevExt->fGuestCapsHost = UINT32_MAX; /* forces a report */ … … 2532 2532 uint32_t cMax, const char *pszWhat) 2533 2533 { 2534 bool fGlobalChange = false; 2535 uint32_t iBit; 2534 bool fGlobalChange = false; 2536 2535 AssertCompile(sizeof(pTracker->acPerBitUsage) == 32 * sizeof(uint32_t)); 2537 2536 2538 for (iBit = ASMBitFirstSetU32(fChanged) - 1; iBit < 32; iBit++) 2539 { 2537 while (fChanged) 2538 { 2539 uint32_t const iBit = ASMBitFirstSetU32(fChanged) - 1; 2540 2540 uint32_t const fBitMask = RT_BIT_32(iBit); 2541 if (fBitMask & fChanged) 2542 { 2543 if (fChanged & fPrevious) 2541 Assert(iBit < 32); Assert(fBitMask & fChanged); 2542 2543 if (fBitMask & fPrevious) 2544 { 2545 pTracker->acPerBitUsage[iBit] -= 1; 2546 AssertMsg(pTracker->acPerBitUsage[iBit] <= cMax, 2547 ("%s: acPerBitUsage[%u]=%#x cMax=%#x\n", pszWhat, iBit, pTracker->acPerBitUsage[iBit], cMax)); 2548 if (pTracker->acPerBitUsage[iBit] == 0) 2544 2549 { 2545 pTracker->acPerBitUsage[iBit] -= 1; 2546 AssertMsg(pTracker->acPerBitUsage[iBit] <= cMax, 2547 ("%s: acPerBitUsage[%u]=%#x cMax=%#x\n", pszWhat, iBit, pTracker->acPerBitUsage[iBit], cMax)); 2548 if (pTracker->acPerBitUsage[iBit] == 0) 2549 { 2550 fGlobalChange = true; 2551 pTracker->fMask &= ~fBitMask; 2552 } 2550 fGlobalChange = true; 2551 pTracker->fMask &= ~fBitMask; 2553 2552 } 2554 else 2553 } 2554 else 2555 { 2556 pTracker->acPerBitUsage[iBit] += 1; 2557 AssertMsg(pTracker->acPerBitUsage[iBit] > 0 && pTracker->acPerBitUsage[iBit] <= cMax, 2558 ("pTracker->acPerBitUsage[%u]=%#x cMax=%#x\n", pszWhat, iBit, pTracker->acPerBitUsage[iBit], cMax)); 2559 if (pTracker->acPerBitUsage[iBit] == 1) 2555 2560 { 2556 pTracker->acPerBitUsage[iBit] += 1; 2557 AssertMsg(pTracker->acPerBitUsage[iBit] > 0 && pTracker->acPerBitUsage[iBit] <= cMax, 2558 ("pTracker->acPerBitUsage[%u]=%#x cMax=%#x\n", pszWhat, iBit, pTracker->acPerBitUsage[iBit], cMax)); 2559 if (pTracker->acPerBitUsage[iBit] == 1) 2560 { 2561 fGlobalChange = true; 2562 pTracker->fMask |= fBitMask; 2563 } 2561 fGlobalChange = true; 2562 pTracker->fMask |= fBitMask; 2564 2563 } 2565 fChanged &= ~fBitMask; 2566 if (!fChanged) 2567 break; 2568 } 2564 } 2565 2566 fChanged &= ~fBitMask; 2569 2567 } 2570 2568 … … 2899 2897 2900 2898 /* 2901 * Note! Reads pSession-> u32AquiredGuestCaps and pDevExt->u32AcquireModeGuestCaps2899 * Note! Reads pSession->fAcquiredGuestCaps and pDevExt->fAcquireModeGuestCaps 2902 2900 * WITHOUT holding VBOXGUESTDEVEXT::SessionSpinlock. 2903 2901 */ 2904 fAcquireModeGuestCaps = ASMAtomicUoReadU32(&pDevExt-> u32AcquireModeGuestCaps);2902 fAcquireModeGuestCaps = ASMAtomicUoReadU32(&pDevExt->fAcquireModeGuestCaps); 2905 2903 if (fAcquireModeGuestCaps == 0) 2906 2904 return VMMDEV_EVENT_VALID_EVENT_MASK; 2907 fAcquiredGuestCaps = ASMAtomicUoReadU32(&pSession-> u32AquiredGuestCaps);2905 fAcquiredGuestCaps = ASMAtomicUoReadU32(&pSession->fAcquiredGuestCaps); 2908 2906 2909 2907 /* … … 2962 2960 uint32_t iBit; 2963 2961 2964 pReq->u32OrMask = pDevExt-> u32GuestCapsAcquired| pDevExt->SetGuestCapsTracker.fMask;2962 pReq->u32OrMask = pDevExt->fAcquiredGuestCaps | pDevExt->SetGuestCapsTracker.fMask; 2965 2963 if (pReq->u32OrMask == pDevExt->fGuestCapsHost) 2966 2964 rc = VINF_SUCCESS; … … 3067 3065 RTSpinlockAcquire(pDevExt->EventSpinlock); 3068 3066 3069 if (!(pDevExt-> u32SetModeGuestCaps & fOrMask))3070 pDevExt-> u32AcquireModeGuestCaps |= fOrMask;3067 if (!(pDevExt->fSetModeGuestCaps & fOrMask)) 3068 pDevExt->fAcquireModeGuestCaps |= fOrMask; 3071 3069 else 3072 3070 { … … 3101 3099 * failure, this is intentional. 3102 3100 */ 3103 fCurrentOwnedCaps = pSession-> u32AquiredGuestCaps;3101 fCurrentOwnedCaps = pSession->fAcquiredGuestCaps; 3104 3102 fSessionRemovedCaps = fCurrentOwnedCaps & fNotMask; 3105 3103 fSessionAddedCaps = fOrMask & ~fCurrentOwnedCaps; 3106 fOtherConflictingCaps = pDevExt-> u32GuestCapsAcquired& ~fCurrentOwnedCaps;3104 fOtherConflictingCaps = pDevExt->fAcquiredGuestCaps & ~fCurrentOwnedCaps; 3107 3105 fOtherConflictingCaps &= fSessionAddedCaps; 3108 3106 … … 3111 3109 if (fSessionAddedCaps) 3112 3110 { 3113 pSession-> u32AquiredGuestCaps |= fSessionAddedCaps;3114 pDevExt-> u32GuestCapsAcquired|= fSessionAddedCaps;3111 pSession->fAcquiredGuestCaps |= fSessionAddedCaps; 3112 pDevExt->fAcquiredGuestCaps |= fSessionAddedCaps; 3115 3113 } 3116 3114 3117 3115 if (fSessionRemovedCaps) 3118 3116 { 3119 pSession-> u32AquiredGuestCaps &= ~fSessionRemovedCaps;3120 pDevExt-> u32GuestCapsAcquired&= ~fSessionRemovedCaps;3117 pSession->fAcquiredGuestCaps &= ~fSessionRemovedCaps; 3118 pDevExt->fAcquiredGuestCaps &= ~fSessionRemovedCaps; 3121 3119 } 3122 3120 … … 3135 3133 if (fSessionAddedCaps) 3136 3134 { 3137 pSession-> u32AquiredGuestCaps &= ~fSessionAddedCaps;3138 pDevExt-> u32GuestCapsAcquired&= ~fSessionAddedCaps;3135 pSession->fAcquiredGuestCaps &= ~fSessionAddedCaps; 3136 pDevExt->fAcquiredGuestCaps &= ~fSessionAddedCaps; 3139 3137 } 3140 3138 if (fSessionRemovedCaps) 3141 3139 { 3142 pSession-> u32AquiredGuestCaps |= fSessionRemovedCaps;3143 pDevExt-> u32GuestCapsAcquired|= fSessionRemovedCaps;3140 pSession->fAcquiredGuestCaps |= fSessionRemovedCaps; 3141 pDevExt->fAcquiredGuestCaps |= fSessionRemovedCaps; 3144 3142 } 3145 3143 … … 3260 3258 * (Acquire mode is only used on windows at the time of writing.) 3261 3259 */ 3262 if (!(fOrMask & pDevExt-> u32AcquireModeGuestCaps))3260 if (!(fOrMask & pDevExt->fAcquireModeGuestCaps)) 3263 3261 #endif 3264 3262 { -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
r54608 r54613 216 216 * Protected by VBOXGUESTDEVEXT::SessionSpinlock, but is unfortunately read 217 217 * without holding the lock in a couple of places. */ 218 uint32_t volatile u32AcquireModeGuestCaps;218 uint32_t volatile fAcquireModeGuestCaps; 219 219 /** Guest capabilities which have been set to "set" mode. This just means 220 220 * that they have been blocked from ever being set to "acquire" mode. */ 221 uint32_t u32SetModeGuestCaps;221 uint32_t fSetModeGuestCaps; 222 222 /** Mask of all capabilities which are currently acquired by some session 223 223 * and as such reported to the host. */ 224 uint32_t u32GuestCapsAcquired;224 uint32_t fAcquiredGuestCaps; 225 225 /** Usage counters for guest capabilities in "set" mode. Indexed by 226 226 * capability bit number, one count per session using a capability. */ … … 283 283 * Protected by VBOXGUESTDEVEXT::SessionSpinlock, but is unfortunately read 284 284 * without holding the lock in a couple of places. */ 285 uint32_t volatile u32AquiredGuestCaps;285 uint32_t volatile fAcquiredGuestCaps; 286 286 /** Guest capabilities in "set" mode for this session. 287 287 * These accumulated for sessions via VBOXGUESTDEVEXT::acGuestCapsSet and
Note:
See TracChangeset
for help on using the changeset viewer.