- Timestamp:
- May 7, 2009 6:10:25 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/TMInternal.h
r19486 r19499 27 27 #include <iprt/time.h> 28 28 #include <iprt/timer.h> 29 #include <iprt/assert.h> 29 30 #include <VBox/stam.h> 30 31 #include <VBox/pdmcritsect.h> … … 166 167 volatile TMTIMERSTATE enmState; 167 168 /** Timer relative offset to the next timer in the schedule list. */ 168 int32_t 169 int32_t volatile offScheduleNext; 169 170 170 171 /** Timer relative offset to the next timer in the chain. */ … … 189 190 #endif 190 191 } TMTIMER; 192 AssertCompileMemberSize(TMTIMER, enmState, sizeof(uint32_t)); 191 193 192 194 … … 196 198 #if 1 197 199 # define TM_SET_STATE(pTimer, state) \ 198 ASMAtomic XchgSize(&(pTimer)->enmState, state)200 ASMAtomicWriteU32((uint32_t volatile *)&(pTimer)->enmState, state) 199 201 #else 200 202 # define TM_SET_STATE(pTimer, state) \ 201 do { Log(("%s: %p: %d -> %d\n", __FUNCTION__, (pTimer), (pTimer)->enmState, state)); \ 202 ASMAtomicXchgSize(&(pTimer)->enmState, state);\ 203 do { \ 204 uint32_t uOld1 = (pTimer)->enmState; \ 205 Log(("%s: %p: %d -> %d\n", __FUNCTION__, (pTimer), (pTimer)->enmState, state)); \ 206 uint32_t uOld2 = ASMAtomicXchgU32((uint32_t volatile *)&(pTimer)->enmState, state); \ 207 Assert(uOld1 == uOld2); \ 203 208 } while (0) 204 209 #endif … … 209 214 #if 1 210 215 # define TM_TRY_SET_STATE(pTimer, StateNew, StateOld, fRc) \ 211 ASMAtomicCmpXchgSize(&(pTimer)->enmState, StateNew, StateOld, fRc)216 (fRc) = ASMAtomicCmpXchgU32((uint32_t volatile *)&(pTimer)->enmState, StateNew, StateOld) 212 217 #else 213 218 # define TM_TRY_SET_STATE(pTimer, StateNew, StateOld, fRc) \ 214 do { ASMAtomicCmpXchgSize(&(pTimer)->enmState, StateNew, StateOld, fRc); \219 do { (fRc) = ASMAtomicCmpXchgU32((uint32_t volatile *)&(pTimer)->enmState, StateNew, StateOld); \ 215 220 Log(("%s: %p: %d -> %d %RTbool\n", __FUNCTION__, (pTimer), StateOld, StateNew, fRc)); \ 216 221 } while (0)
Note:
See TracChangeset
for help on using the changeset viewer.