VirtualBox

Changeset 92712 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Dec 2, 2021 5:34:24 PM (3 years ago)
Author:
vboxsync
Message:

VMM/TM: Made timer allocation work in driverless mode. bugref:10138

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/TMAll.cpp

    r92709 r92712  
    4141#include <iprt/asm.h>
    4242#include <iprt/asm-math.h>
     43#include <iprt/string.h>
    4344#ifdef IN_RING3
    4445# include <iprt/thread.h>
     
    25922593
    25932594
     2595#if defined(IN_RING0) || defined(IN_RING3)
     2596/**
     2597 * Copies over old timers and initialized newly allocted ones.
     2598 *
     2599 * Helper for TMR0TimerQueueGrow an tmR3TimerQueueGrow.
     2600 *
     2601 * @param   paTimers            The new timer allocation.
     2602 * @param   paOldTimers         The old timers.
     2603 * @param   cNewTimers          Number of new timers.
     2604 * @param   cOldTimers          Number of old timers.
     2605 */
     2606void tmHCTimerQueueGrowInit(PTMTIMER paTimers, TMTIMER const *paOldTimers, uint32_t cNewTimers, uint32_t cOldTimers)
     2607{
     2608    Assert(cOldTimers < cNewTimers);
     2609
     2610    /*
     2611     * Copy over the old info and initialize the new handles.
     2612     */
     2613    if (cOldTimers > 0)
     2614        memcpy(paTimers, paOldTimers, sizeof(TMTIMER) * cOldTimers);
     2615
     2616    size_t i = cNewTimers;
     2617    while (i-- > cOldTimers)
     2618    {
     2619        paTimers[i].u64Expire       = UINT64_MAX;
     2620        paTimers[i].enmType         = TMTIMERTYPE_INVALID;
     2621        paTimers[i].enmState        = TMTIMERSTATE_FREE;
     2622        paTimers[i].idxScheduleNext = UINT32_MAX;
     2623        paTimers[i].idxNext         = UINT32_MAX;
     2624        paTimers[i].idxPrev         = UINT32_MAX;
     2625        paTimers[i].hSelf           = NIL_TMTIMERHANDLE;
     2626    }
     2627
     2628    /*
     2629     * Mark the zero'th entry as allocated but invalid if we just allocated it.
     2630     */
     2631    if (cOldTimers == 0)
     2632    {
     2633        paTimers[0].enmState = TMTIMERSTATE_INVALID;
     2634        paTimers[0].szName[0] = 'n';
     2635        paTimers[0].szName[1] = 'i';
     2636        paTimers[0].szName[2] = 'l';
     2637        paTimers[0].szName[3] = '\0';
     2638    }
     2639}
     2640#endif /* IN_RING0 || IN_RING3 */
     2641
     2642
    25942643/**
    25952644 * The slow path of tmGetFrequencyHint() where we try to recalculate the value.
Note: See TracChangeset for help on using the changeset viewer.

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