VirtualBox

Changeset 19821 in vbox


Ignore:
Timestamp:
May 19, 2009 1:28:56 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
47475
Message:

TM: TMTimerPoll cleanup.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/tm.h

    r19747 r19821  
    198198VMMDECL(int)      TMTimerStop(PTMTIMER pTimer);
    199199VMMDECL(bool)     TMTimerIsActive(PTMTIMER pTimer);
    200 VMMDECL(uint64_t) TMTimerPoll(PVM pVM, PVMCPU pVCpu);
     200VMMDECL(bool)     TMTimerPollBool(PVM pVM, PVMCPU pVCpu);
     201VMMDECL(void)     TMTimerPollVoid(PVM pVM, PVMCPU pVCpu);
    201202VMMDECL(uint64_t) TMTimerPollGIP(PVM pVM, PVMCPU pVCpu, uint64_t *pu64Delta);
    202203
  • trunk/src/VBox/VMM/EM.cpp

    r19793 r19821  
    10221022         */
    10231023#ifdef VBOX_HIGH_RES_TIMERS_HACK
    1024         TMTimerPoll(pVM, pVCpu);
     1024        TMTimerPollVoid(pVM, pVCpu);
    10251025#endif
    10261026        AssertCompile((VMCPU_FF_ALL_BUT_RAW_MASK & ~(VMCPU_FF_CSAM_PENDING_ACTION | VMCPU_FF_CSAM_SCAN_PAGE)) & VMCPU_FF_TIMER);
     
    29482948         */
    29492949#ifdef VBOX_HIGH_RES_TIMERS_HACK
    2950         TMTimerPoll(pVM, pVCpu);
     2950        TMTimerPollVoid(pVM, pVCpu);
    29512951#endif
    29522952        STAM_PROFILE_ADV_STOP(&pVCpu->em.s.StatRAWTail, d);
     
    30893089         */
    30903090#ifdef VBOX_HIGH_RES_TIMERS_HACK
    3091         TMTimerPoll(pVM, pVCpu);
     3091        TMTimerPollVoid(pVM, pVCpu);
    30923092#endif
    30933093        if (    VM_FF_ISPENDING(pVM, VM_FF_ALL_MASK)
  • trunk/src/VBox/VMM/VMEmt.cpp

    r19797 r19821  
    302302            ||  VMCPU_FF_ISPENDING(pVCpu, fMask))
    303303            break;
    304         uint64_t u64NanoTS = TMVirtualToNano(pVM, TMTimerPoll(pVM, pVCpu));
     304        uint64_t u64NanoTS;
     305        TMTimerPollGIP(pVM, pVCpu, &u64NanoTS);
    305306        if (    VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK)
    306307            ||  VMCPU_FF_ISPENDING(pVCpu, fMask))
     
    504505         * Estimate time left to the next event.
    505506         */
    506         uint64_t u64NanoTS = TMVirtualToNano(pVM, TMTimerPoll(pVM, pVCpu));
     507        uint64_t u64NanoTS;
     508        TMTimerPollGIP(pVM, pVCpu, &u64NanoTS);
    507509        if (    VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK)
    508510            ||  VMCPU_FF_ISPENDING(pVCpu, fMask))
  • trunk/src/VBox/VMM/VMMAll/TMAll.cpp

    r19820 r19821  
    430430 * @remarks GIP uses ns ticks.
    431431 */
    432 DECLINLINE(uint64_t) tmTimerPollInternal(PVM pVM, PVMCPU pVCpu, uint64_t *pu64Delta)
     432DECL_FORCE_INLINE(uint64_t) tmTimerPollInternal(PVM pVM, PVMCPU pVCpu, uint64_t *pu64Delta)
    433433{
    434434    PVMCPU                  pVCpuDst      = &pVM->aCpus[pVM->tm.s.idTimerCpu];
     
    635635 * This function is called before FFs are checked in the inner execution EM loops.
    636636 *
    637  * @returns Virtual timer ticks to the next event. (I.e. 0 means that an timer
    638  *          has expired or some important rescheduling is pending.)
     637 * @returns true if timers are pending, false if not.
     638 *
    639639 * @param   pVM         Pointer to the shared VM structure.
    640640 * @param   pVCpu       Pointer to the shared VMCPU structure of the caller.
    641641 * @thread  The emulation thread.
    642642 */
    643 VMMDECL(uint64_t) TMTimerPoll(PVM pVM, PVMCPU pVCpu)
     643VMMDECL(bool) TMTimerPollBool(PVM pVM, PVMCPU pVCpu)
    644644{
    645645    AssertCompile(TMCLOCK_FREQ_VIRTUAL == 1000000000);
    646646    uint64_t off = 0;
    647647    tmTimerPollInternal(pVM, pVCpu, &off);
    648     return off;
     648    return off == 0;
     649}
     650
     651
     652/**
     653 * Set FF if we've passed the next virtual event.
     654 *
     655 * This function is called before FFs are checked in the inner execution EM loops.
     656 *
     657 * @param   pVM         Pointer to the shared VM structure.
     658 * @param   pVCpu       Pointer to the shared VMCPU structure of the caller.
     659 * @thread  The emulation thread.
     660 */
     661VMMDECL(void) TMTimerPollVoid(PVM pVM, PVMCPU pVCpu)
     662{
     663    uint64_t off;
     664    tmTimerPollInternal(pVM, pVCpu, &off);
    649665}
    650666
  • trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp

    r19660 r19821  
    157157        if (!(++s_iTimerPoll & 0xf))
    158158        {
    159             uint64_t cTicks = TMTimerPoll(pVM, pVCpu); NOREF(cTicks);
    160             Log2(("TMTimerPoll at %08RX32 returned %RX64 (VM_FF_TM_VIRTUAL_SYNC=%d VM_FF_TM_VIRTUAL_SYNC=%d)\n", pRegFrame->eip, cTicks,
     159            TMTimerPollVoid(pVM, pVCpu);
     160            Log2(("TMTimerPoll at %08RX32 - VM_FF_TM_VIRTUAL_SYNC=%d VM_FF_TM_VIRTUAL_SYNC=%d\n", pRegFrame->eip,
    161161                  VM_FF_ISPENDING(pVM, VM_FF_TM_VIRTUAL_SYNC), VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_TIMER)));
    162162        }
  • trunk/src/recompiler/VBoxREMWrapper.cpp

    r19747 r19821  
    11661166    { "TMNotifyEndOfExecution",                 (void *)(uintptr_t)&TMNotifyEndOfExecution,         &g_aArgsVMCPU[0],                           RT_ELEMENTS(g_aArgsVMCPU),                             REMFNDESC_FLAGS_RET_VOID,   0,                  NULL },
    11671167    { "TMNotifyStartOfExecution",               (void *)(uintptr_t)&TMNotifyStartOfExecution,       &g_aArgsVMCPU[0],                           RT_ELEMENTS(g_aArgsVMCPU),                             REMFNDESC_FLAGS_RET_VOID,   0,                  NULL },
    1168     { "TMTimerPoll",                            (void *)(uintptr_t)&TMTimerPoll,                    &g_aArgsVMandVMCPU[0],                      RT_ELEMENTS(g_aArgsVMandVMCPU),                        REMFNDESC_FLAGS_RET_INT,    sizeof(uint64_t),   NULL },
     1168    { "TMTimerPollBool",                        (void *)(uintptr_t)&TMTimerPollBool,                &g_aArgsVMandVMCPU[0],                      RT_ELEMENTS(g_aArgsVMandVMCPU),                        REMFNDESC_FLAGS_RET_VOID,   sizeof(void),       NULL },
    11691169    { "TMR3TimerQueuesDo",                      (void *)(uintptr_t)&TMR3TimerQueuesDo,              &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_VOID,   0,                  NULL },
    11701170    { "TRPMAssertTrap",                         (void *)(uintptr_t)&TRPMAssertTrap,                 &g_aArgsTRPMAssertTrap[0],                  RT_ELEMENTS(g_aArgsTRPMAssertTrap),                    REMFNDESC_FLAGS_RET_INT,    sizeof(int),        NULL },
  • trunk/src/recompiler/cpu-exec.c

    r19660 r19821  
    533533                                            | CPU_INTERRUPT_SINGLE_INSTR | CPU_INTERRUPT_SINGLE_INSTR_IN_FLIGHT))
    534534            &&  (   (env->interrupt_request & CPU_INTERRUPT_EXTERNAL_TIMER)
    535                  || !TMTimerPoll(env->pVM, env->pVCpu)) ) {
     535                 || TMTimerPollBool(env->pVM, env->pVCpu)) ) {
    536536            ASMAtomicAndS32((int32_t volatile *)&env->interrupt_request, ~CPU_INTERRUPT_EXTERNAL_TIMER);
    537537            remR3ProfileStart(STATS_QEMU_RUN_TIMERS);
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