Changeset 87813 in vbox for trunk/src/VBox/VMM/include
- Timestamp:
- Feb 19, 2021 9:40:11 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142874
- Location:
- trunk/src/VBox/VMM/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/TMInline.h
r87812 r87813 211 211 #endif 212 212 213 214 213 /** @def TMTIMER_HANDLE_TO_VARS_RETURN_EX 215 214 * Converts a timer handle to a timer pointer, returning VERR_INVALID_HANDLE if … … 230 229 #define TMTIMER_HANDLE_TO_VARS_RETURN(a_pVM, a_hTimer) TMTIMER_HANDLE_TO_VARS_RETURN_EX(a_pVM, a_hTimer, VERR_INVALID_HANDLE) 231 230 232 233 /** @def TMTIMER_HANDLE_TO_PTR_RETURN_EX 234 * Converts a timer handle to a timer pointer, returning @a a_rcRet if the 231 /** @def TMTIMER_HANDLE_TO_VARS_RETURN_VOID 232 * Converts a timer handle to a timer pointer, returning void if the 235 233 * handle is invalid. 236 234 * 237 * @param a_pVM The cross context VM structure. 238 * @param a_hTimer The timer handle to translate. 239 * @param a_rcRet What to return on failure. 240 * @param a_pTimerVar The timer variable to assign the resulting pointer to. 235 * This defines the following variables: 236 * - idxQueue: The queue index. 237 * - pQueueCC: Pointer to the context specific queue data. 238 * - pTimer: The timer pointer. 239 * - idxTimer: The timer index. 240 * 241 * @param a_pVM The cross context VM structure. 242 * @param a_hTimer The timer handle to translate. 243 * 244 * @note This macro has no scoping, so careful when using it around 245 * conditional statements! 241 246 */ 242 247 #ifdef IN_RING3 243 # define TMTIMER_HANDLE_TO_PTR_RETURN_EX(a_pVM, a_hTimer, a_rcRet, a_pTimerVar) do { \ 244 uintptr_t const idxQueue = (uintptr_t)((a_hTimer) >> TMTIMERHANDLE_QUEUE_IDX_SHIFT) \ 245 & (uintptr_t)TMTIMERHANDLE_QUEUE_IDX_SMASK; \ 246 AssertReturn(idxQueue < RT_ELEMENTS((a_pVM)->tm.s.aTimerQueues), a_rcRet); \ 247 \ 248 uintptr_t const idxTimer = (uintptr_t)((a_hTimer) & TMTIMERHANDLE_TIMER_IDX_MASK); \ 249 AssertReturn(idxQueue < (a_pVM)->tm.s.aTimerQueues[idxQueue].cTimersAlloc, a_rcRet); \ 250 \ 251 (a_pTimerVar) = &(a_pVM)->tm.s.aTimerQueues[idxQueue].paTimers[idxTimer]; \ 252 AssertReturn((a_pTimerVar)->hSelf == a_hTimer, a_rcRet); \ 253 } while (0) 254 #else 255 # define TMTIMER_HANDLE_TO_PTR_RETURN_EX(a_pVM, a_hTimer, a_rcRet, a_pTimerVar) do { \ 256 uintptr_t const idxQueue = (uintptr_t)((a_hTimer) >> TMTIMERHANDLE_QUEUE_IDX_SHIFT) \ 257 & (uintptr_t)TMTIMERHANDLE_QUEUE_IDX_SMASK; \ 258 AssertReturn(idxQueue < RT_ELEMENTS((a_pVM)->tm.s.aTimerQueues), a_rcRet); \ 259 AssertCompile(RT_ELEMENTS((a_pVM)->tm.s.aTimerQueues) == RT_ELEMENTS((a_pVM)->tmr0.s.aTimerQueues)); \ 260 \ 261 uintptr_t const idxTimer = (uintptr_t)((a_hTimer) & TMTIMERHANDLE_TIMER_IDX_MASK); \ 262 AssertReturn(idxQueue < (a_pVM)->tmr0.s.aTimerQueues[idxQueue].cTimersAlloc, a_rcRet); \ 263 \ 264 (a_pTimerVar) = &(a_pVM)->tmr0.s.aTimerQueues[idxQueue].paTimers[idxTimer]; \ 265 AssertReturn((a_pTimerVar)->hSelf == a_hTimer, a_rcRet); \ 266 Assert((a_pTimerVar)->fFlags & TMTIMER_FLAGS_RING0); \ 267 Assert(VM_IS_EMT(pVM)); \ 268 } while (0) 269 #endif 270 271 /** @def TMTIMER_HANDLE_TO_PTR_RETURN 272 * Converts a timer handle to a timer pointer, returning VERR_INVALID_HANDLE if 273 * invalid. 274 * 275 * @param a_pVM The cross context VM structure. 276 * @param a_hTimer The timer handle to translate. 277 * @param a_pTimerVar The timer variable to assign the resulting pointer to. 278 */ 279 #define TMTIMER_HANDLE_TO_PTR_RETURN(a_pVM, a_hTimer, a_pTimerVar) \ 280 TMTIMER_HANDLE_TO_PTR_RETURN_EX(a_pVM, a_hTimer, VERR_INVALID_HANDLE, a_pTimerVar) 281 282 /** @def TMTIMER_HANDLE_TO_PTR_RETURN_VOID 283 * Converts a timer handle to a timer pointer, returning VERR_INVALID_HANDLE if 284 * invalid. 285 * 286 * @param a_pVM The cross context VM structure. 287 * @param a_hTimer The timer handle to translate. 288 * @param a_pTimerVar The timer variable to assign the resulting pointer to. 289 */ 290 #ifdef IN_RING3 291 # define TMTIMER_HANDLE_TO_PTR_RETURN_VOID(a_pVM, a_hTimer, a_pTimerVar) do { \ 248 # define TMTIMER_HANDLE_TO_VARS_RETURN_VOID(a_pVM, a_hTimer) \ 292 249 uintptr_t const idxQueue = (uintptr_t)((a_hTimer) >> TMTIMERHANDLE_QUEUE_IDX_SHIFT) \ 293 250 & (uintptr_t)TMTIMERHANDLE_QUEUE_IDX_SMASK; \ 294 251 AssertReturnVoid(idxQueue < RT_ELEMENTS((a_pVM)->tm.s.aTimerQueues)); \ 295 \ 296 uintptr_t const idxTimer = (uintptr_t)((a_hTimer) & TMTIMERHANDLE_TIMER_IDX_MASK); \ 297 AssertReturnVoid(idxQueue < (a_pVM)->tm.s.aTimerQueues[idxQueue].cTimersAlloc); \ 298 \ 299 (a_pTimerVar) = &(a_pVM)->tm.s.aTimerQueues[idxQueue].paTimers[idxTimer]; \ 300 AssertReturnVoid((a_pTimerVar)->hSelf == a_hTimer); \ 301 } while (0) 302 #else 303 # define TMTIMER_HANDLE_TO_PTR_RETURN_VOID(a_pVM, a_hTimer, a_pTimerVar) do { \ 252 PTMTIMERQUEUE const pQueue = &(a_pVM)->tm.s.aTimerQueues[idxQueue]; \ 253 PTMTIMERQUEUE const pQueueCC = pQueue; RT_NOREF(pQueueCC); \ 254 \ 255 uintptr_t const idxTimer = (uintptr_t)((a_hTimer) & TMTIMERHANDLE_TIMER_IDX_MASK); \ 256 AssertReturnVoid(idxQueue < pQueue->cTimersAlloc); \ 257 \ 258 PTMTIMER const pTimer = &pQueue->paTimers[idxTimer]; \ 259 AssertReturnVoid(pTimer->hSelf == a_hTimer) 260 #else 261 # define TMTIMER_HANDLE_TO_VARS_RETURN_VOID(a_pVM, a_hTimer) \ 304 262 uintptr_t const idxQueue = (uintptr_t)((a_hTimer) >> TMTIMERHANDLE_QUEUE_IDX_SHIFT) \ 305 263 & (uintptr_t)TMTIMERHANDLE_QUEUE_IDX_SMASK; \ 306 264 AssertReturnVoid(idxQueue < RT_ELEMENTS((a_pVM)->tm.s.aTimerQueues)); \ 307 265 AssertCompile(RT_ELEMENTS((a_pVM)->tm.s.aTimerQueues) == RT_ELEMENTS((a_pVM)->tmr0.s.aTimerQueues)); \ 308 \309 uintptr_t const idxTimer = (uintptr_t)((a_hTimer) & TMTIMERHANDLE_TIMER_IDX_MASK); \310 AssertReturnVoid(idxQueue < (a_pVM)->tmr0.s.aTimerQueues[idxQueue].cTimersAlloc);\311 \312 (a_pTimerVar) = &(a_pVM)->tmr0.s.aTimerQueues[idxQueue].paTimers[idxTimer]; \313 AssertReturnVoid((a_pTimerVar)->hSelf == a_hTimer);\314 Assert((a_pTimerVar)->fFlags & TMTIMER_FLAGS_RING0); \315 Assert (VM_IS_EMT(pVM)); \316 } while (0)317 #endif 318 266 PTMTIMERQUEUE const pQueue = &(a_pVM)->tm.s.aTimerQueues[idxQueue]; RT_NOREF(pQueue); \ 267 PTMTIMERQUEUER0 const pQueueCC = &(a_pVM)->tmr0.s.aTimerQueues[idxQueue]; \ 268 \ 269 uintptr_t const idxTimer = (uintptr_t)((a_hTimer) & TMTIMERHANDLE_TIMER_IDX_MASK); \ 270 AssertReturnVoid(idxQueue < pQueueCC->cTimersAlloc); \ 271 \ 272 PTMTIMER const pTimer = &pQueueCC->paTimers[idxTimer]; \ 273 AssertReturnVoid(pTimer->hSelf == a_hTimer); \ 274 Assert(pTimer->fFlags & TMTIMER_FLAGS_RING0); \ 275 Assert(VM_IS_EMT(pVM)) 276 #endif 319 277 320 278 #endif /* !VMM_INCLUDED_SRC_include_TMInline_h */ -
trunk/src/VBox/VMM/include/TMInternal.h
r87812 r87813 285 285 /** Align on 64-byte boundrary. */ 286 286 bool afAlignment1[7]; 287 287 288 /** Time spent doing scheduling and timer callbacks. */ 288 289 STAMPROFILE StatDo; … … 290 291 uint32_t volatile uMaxHzHint; 291 292 uint32_t u64Alignment2[7]; 293 292 294 /** Lock serializing the active timer list and associated work. */ 293 295 PDMCRITSECT TimerLock;
Note:
See TracChangeset
for help on using the changeset viewer.