VirtualBox

Changeset 87766 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Feb 16, 2021 2:27:43 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142820
Message:

VMM/TM,VMM/*: Refactored the TM timer APIs to use 'handles' and take a pVM parameter. Only internal callbacks have been updated with a hTimer parameter, so far. bugref:9943

Location:
trunk/src/VBox/VMM/include
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/CPUMInternal.h

    r87361 r87766  
    417417    CPUMCTXMSRS             GuestMsrs;
    418418
    419     /** Nested VMX: VMX-preemption timer - R0 ptr. */
    420     PTMTIMERR0              pNestedVmxPreemptTimerR0;
    421     /** Nested VMX: VMX-preemption timer - R3 ptr. */
    422     PTMTIMERR3              pNestedVmxPreemptTimerR3;
     419    /** Nested VMX: VMX-preemption timer. */
     420    TMTIMERHANDLE           hNestedVmxPreemptTimer;
    423421
    424422    /** Use flags.
     
    459457
    460458    /** Align the next member on a 64-byte boundary. */
    461     uint8_t                 abPadding2[64 - (16 + 12 + 4 + 8 + 1 + 1)];
     459    uint8_t                 abPadding2[64 - (8 + 12 + 4 + 8 + 1 + 1)];
    462460
    463461    /** Saved host context.  Only valid while inside RC or HM contexts.
  • trunk/src/VBox/VMM/include/CPUMInternal.mac

    r87522 r87766  
    259259    ; Other stuff.
    260260    ;
    261     .pNestedVmxPreemptTimerR0   RTR0PTR_RES    1
    262     .pNestedVmxPreemptTimerR3   RTR3PTR_RES    1
     261    .hNestedVmxPreemptTimer   resq    1
    263262
    264263    .fUseFlags            resd    1
     
    275274
    276275    .fCpuIdApicFeatureVisible   resb    1
    277 
    278     .abPadding2           resb    (64 - (RTR0PTR_CB + RTR3PTR_CB + 12 + 4 + RTR0PTR_CB + 1 + 1))
    279276
    280277    ;
  • trunk/src/VBox/VMM/include/GIMHvInternal.h

    r82968 r87766  
    12631263typedef struct GIMHVSTIMER
    12641264{
    1265     /** Synthetic timer object - R0 ptr. */
    1266     PTMTIMERR0                  pTimerR0;
    1267     /** Synthetic timer object - R3 ptr. */
    1268     PTMTIMERR3                  pTimerR3;
     1265    /** Synthetic timer handle. */
     1266    TMTIMERHANDLE               hTimer;
    12691267    /** Virtual CPU ID this timer belongs to (for reverse mapping). */
    12701268    VMCPUID                     idCpu;
  • trunk/src/VBox/VMM/include/PDMAsyncCompletionFileInternal.h

    r85121 r87766  
    277277#ifdef PDM_ASYNC_COMPLETION_FILE_WITH_DELAY
    278278    /** Timer for delayed request completion. */
    279     PTMTIMERR3                          pTimer;
     279    TMTIMERHANDLE                       hTimer;
    280280    /** Milliseconds until the next delay expires. */
    281281    volatile uint64_t                   cMilliesNext;
  • trunk/src/VBox/VMM/include/PDMBlkCacheInternal.h

    r82968 r87766  
    134134    volatile bool       fCommitInProgress;
    135135    /** Commit interval timer */
    136     PTMTIMERR3          pTimerCommit;
     136    TMTIMERHANDLE       hTimerCommit;
    137137    /** Number of endpoints using the cache. */
    138138    uint32_t            cRefs;
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r87494 r87766  
    10441044    uint32_t                        cMilliesInterval;
    10451045    /** Interval timer. Only used if cMilliesInterval is non-zero. */
    1046     PTMTIMERR3                      pTimer;
     1046    TMTIMERHANDLE                   hTimer;
    10471047    /** Pointer to the VM - R3. */
    10481048    PVMR3                           pVMR3;
  • trunk/src/VBox/VMM/include/TMInline.h

    r82968 r87766  
    5656}
    5757
     58
     59/** @def TMTIMER_HANDLE_TO_PTR_RETURN_EX
     60 * Converts a timer handle to a timer pointer, returning @a a_rcRet if the
     61 * handle is invalid.
     62 *
     63 * @param   a_pVM       The cross context VM structure.
     64 * @param   a_hTimer    The timer handle to translate.
     65 * @param   a_rcRet     What to return on failure.
     66 * @param   a_pTimerVar The timer variable to assign the resulting pointer to.
     67 */
     68#ifdef IN_RING3
     69# define TMTIMER_HANDLE_TO_PTR_RETURN_EX(a_pVM, a_hTimer, a_rcRet, a_pTimerVar) do { \
     70        RT_NOREF(a_pVM); \
     71        (a_pTimerVar) = (PTMTIMER)hTimer; \
     72        AssertPtrReturn((a_pTimerVar), a_rcRet); \
     73        AssertReturn((a_pTimerVar)->hSelf == a_hTimer, a_rcRet); \
     74    } while (0)
     75#else
     76# define TMTIMER_HANDLE_TO_PTR_RETURN_EX(a_pVM, a_hTimer, a_rcRet, a_pTimerVar) do { \
     77        (a_pTimerVar) = (PTMTIMER)MMHyperR3ToCC(pVM, (RTR3PTR)hTimer); \
     78        AssertPtrReturn((a_pTimerVar), a_rcRet); \
     79        AssertReturn((a_pTimerVar)->hSelf == a_hTimer, a_rcRet); \
     80        Assert((a_pTimerVar)->fFlags & TMTIMER_FLAGS_RING0); \
     81    } while (0)
     82#endif
     83
     84/** @def TMTIMER_HANDLE_TO_PTR_RETURN
     85 * Converts a timer handle to a timer pointer, returning VERR_INVALID_HANDLE if
     86 * invalid.
     87 *
     88 * @param   a_pVM       The cross context VM structure.
     89 * @param   a_hTimer    The timer handle to translate.
     90 * @param   a_pTimerVar The timer variable to assign the resulting pointer to.
     91 */
     92#define TMTIMER_HANDLE_TO_PTR_RETURN(a_pVM, a_hTimer, a_pTimerVar) \
     93        TMTIMER_HANDLE_TO_PTR_RETURN_EX(a_pVM, a_hTimer, VERR_INVALID_HANDLE, a_pTimerVar)
     94
     95/** @def TMTIMER_HANDLE_TO_PTR_RETURN_VOID
     96 * Converts a timer handle to a timer pointer, returning VERR_INVALID_HANDLE if
     97 * invalid.
     98 *
     99 * @param   a_pVM       The cross context VM structure.
     100 * @param   a_hTimer    The timer handle to translate.
     101 * @param   a_pTimerVar The timer variable to assign the resulting pointer to.
     102 */
     103#ifdef IN_RING3
     104# define TMTIMER_HANDLE_TO_PTR_RETURN_VOID(a_pVM, a_hTimer, a_pTimerVar) do { \
     105        RT_NOREF(a_pVM); \
     106        (a_pTimerVar) = (PTMTIMER)hTimer; \
     107        AssertPtrReturnVoid((a_pTimerVar)); \
     108        AssertReturnVoid((a_pTimerVar)->hSelf == a_hTimer); \
     109    } while (0)
     110#else
     111# define TMTIMER_HANDLE_TO_PTR_RETURN_VOID(a_pVM, a_hTimer, a_pTimerVar) do { \
     112        (a_pTimerVar) = (PTMTIMER)MMHyperR3ToCC(pVM, (RTR3PTR)hTimer); \
     113        AssertPtrReturnVoid((a_pTimerVar)); \
     114        AssertReturnVoid((a_pTimerVar)->hSelf == a_hTimer); \
     115        Assert((a_pTimerVar)->fFlags & TMTIMER_FLAGS_RING0); \
     116    } while (0)
     117#endif
     118
     119
    58120#endif /* !VMM_INCLUDED_SRC_include_TMInline_h */
    59121
  • trunk/src/VBox/VMM/include/TMInternal.h

    r87763 r87766  
    174174    int32_t                 offPrev;
    175175
     176    /** It's own handle value. */
     177    TMTIMERHANDLE           hSelf;
    176178    /** Pointer to the VM the timer belongs to - R3 Ptr. */
    177179    PVMR3                   pVMR3;
     
    200202    /** TMTIMER_FLAGS_XXX.   */
    201203    uint32_t                fFlags;
    202     uint32_t                u32Pading;
     204    uint32_t                u32Padding;
    203205
    204206#ifdef VBOX_WITH_STATISTICS
  • trunk/src/VBox/VMM/include/VMMInternal.h

    r85121 r87766  
    193193
    194194    /** The EMT yield timer. */
    195     PTMTIMERR3                  pYieldTimer;
     195    TMTIMERHANDLE               hYieldTimer;
    196196    /** The period to the next timeout when suspended or stopped.
    197197     * This is 0 when running. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette