VirtualBox

Changeset 2285 in vbox for trunk


Ignore:
Timestamp:
Apr 20, 2007 10:35:30 PM (18 years ago)
Author:
vboxsync
Message:

TMCLOCK_VIRTUAL_SYNC changes. (define VBOX_WITH_VIRTUAL_SYNC_TIMERS to enable)

Location:
trunk/src/VBox/Devices
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Makefile

    r2246 r2285  
    5353ifdef VBOX_WITH_INTERNAL_NETWORKING
    5454 DEFS += VBOX_WITH_INTERNAL_NETWORKING
     55endif
     56ifeq ($(USERNAME),bird)
     57 DEFS += VBOX_WITH_VIRTUAL_SYNC_TIMERS
    5558endif
    5659
  • trunk/src/VBox/Devices/PC/DevACPI.cpp

    r1912 r2285  
    15951595    }
    15961596
     1597#ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
     1598    rc = PDMDevHlpTMTimerCreate (pDevIns, TMCLOCK_VIRTUAL_SYNC, acpiTimer, "ACPI Timer", &s->tsHC);
     1599#else
    15971600    rc = PDMDevHlpTMTimerCreate (pDevIns, TMCLOCK_VIRTUAL, acpiTimer, "ACPI Timer", &s->tsHC);
     1601#endif
    15981602    if (VBOX_FAILURE(rc))
    15991603    {
  • trunk/src/VBox/Devices/PC/DevAPIC.cpp

    r1931 r2285  
    17251725     * Create the APIC timer.
    17261726     */
     1727#ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
     1728    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, apicTimer,
     1729#else
    17271730    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, apicTimer,
     1731#endif
    17281732                                "APIC Timer", &pData->CTXSUFF(pTimer));
    17291733    if (VBOX_FAILURE(rc))
  • trunk/src/VBox/Devices/PC/DevPit-i8254.cpp

    r1912 r2285  
    9393     * As apposed to the next_transition_time which contains the correct time of the next tick. */
    9494    uint64_t            u64NextTS;
     95#ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    9596    /** When to give up catching up. (negative number) */
    9697    int64_t             i64MaxCatchupTS;
     98#endif
    9799
    98100    /** (count_load_time is only set by TMTimerGet() which returns uint64_t) */
     
    136138    /** Profiling the timer callback handler. */
    137139    STAMPROFILEADV          StatPITHandler;
     140#ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    138141    /** The number of times we've had to speed up the time because we lagged too far behind. */
    139142    STAMCOUNTER             StatPITCatchup;
    140143    /** The number of times we've lagged too far behind for it to be worth trying to catch up. */
    141144    STAMCOUNTER             StatPITGiveup;
     145#endif
    142146} PITState;
    143147
     
    400404    }
    401405
     406#ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
     407    if (expire_time != -1)
     408    {
     409        s->u64NextTS = expire_time;
     410        TMTimerSet(s->CTXSUFF(pTimer), s->u64NextTS);
     411    }
     412#else
    402413    /* check if it expires too soon - move at 4x rate if it does. */
    403414    if (expire_time != -1)
     
    439450        TMTimerSet(s->CTXSUFF(pTimer), s->u64NextTS);
    440451    }
     452#endif
    441453    else
    442454    {
     
    981993     * Create timer, register I/O Ports and save state.
    982994     */
     995#ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
     996    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pitTimer, "i8254 Programmable Interval Timer",
     997#else
    983998    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, pitTimer, "i8254 Programmable Interval Timer",
     999#endif
    9841000                                &pData->channels[0].CTXSUFF(pTimer));
    9851001    if (VBOX_FAILURE(rc))
     
    10241040        return rc;
    10251041
     1042#ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    10261043    /*
    10271044     * Calculate max catchup time.
     
    10291046    pData->channels[0].i64MaxCatchupTS = pData->channels[1].i64MaxCatchupTS
    10301047        = pData->channels[2].i64MaxCatchupTS = -TMTimerFromMilli(pData->channels[0].CTXSUFF(pTimer), 1000*60*2); /* 2 min */
     1048#endif
    10311049
    10321050    /*
     
    10401058    PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITIrq,      STAMTYPE_COUNTER, "/TM/PIT/Irq",      STAMUNIT_OCCURENCES,     "The number of times a timer interrupt was triggered.");
    10411059    PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITHandler,  STAMTYPE_PROFILE, "/TM/PIT/Handler",  STAMUNIT_TICKS_PER_CALL, "Profiling timer callback handler.");
     1060#ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    10421061    PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITCatchup,  STAMTYPE_COUNTER, "/TM/PIT/Catchup",  STAMUNIT_OCCURENCES,     "The number of times we lagged too far behind.");
    10431062    PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITGiveup,   STAMTYPE_COUNTER, "/TM/PIT/Giveup",   STAMUNIT_OCCURENCES,     "The number of times we lagged so far behind that we simply gave up.");
     1063#endif
    10441064
    10451065    PDMDevHlpDBGFInfoRegister(pDevIns, "pit", "Display PIT (i8254) status. (no arguments)", pitInfo);
  • trunk/src/VBox/Devices/PC/DevRTC.cpp

    r1912 r2285  
    149149{
    150150    int period_code, period;
    151     uint64_t cur_clock, next_irq_clock, now, quarter_period_time;
    152     int64_t delta;
     151    uint64_t cur_clock, next_irq_clock;
    153152    uint32_t freq;
    154153
     
    166165        next_irq_clock = (cur_clock & ~(uint64_t)(period - 1)) + period;
    167166        s->next_periodic_time = ASMMultU64ByU32DivByU32(next_irq_clock, freq, 32768) + 1;
    168 
     167#ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
     168        TMTimerSet(s->CTXSUFF(pPeriodicTimer), s->next_periodic_time);
     169       
     170#else
    169171        /* fiddly bits for dealing with running to keep up and losing interrupts. */
    170         quarter_period_time = ASMMultU64ByU32DivByU32(period, freq, 32768 * 4);
    171         now = TMTimerGet(s->CTXSUFF(pPeriodicTimer));
    172         delta = s->next_periodic_time - now;
     172        uint64_t quarter_period_time = ASMMultU64ByU32DivByU32(period, freq, 32768 * 4);
     173        uint64_t now = TMTimerGet(s->CTXSUFF(pPeriodicTimer));
     174        int64_t delta = s->next_periodic_time - now;
    173175        if (delta >= (int64_t)quarter_period_time)
    174176        {
     
    183185                  s->next_periodic_time, delta, now, next));
    184186        }
     187#endif
    185188    } else {
    186189        TMTimerStop(s->CTXSUFF(pPeriodicTimer));
     
    853856     * Create timers, arm them, register I/O Ports and save state.
    854857     */
     858#ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
     859    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, rtcTimerPeriodic, "MC146818 RTC/CMOS - Periodic", &pData->pPeriodicTimerHC);
     860#else
    855861    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, rtcTimerPeriodic, "MC146818 RTC/CMOS - Periodic", &pData->pPeriodicTimerHC);
     862#endif
    856863    if (VBOX_FAILURE(rc))
    857864    {
     
    859866        return rc;
    860867    }
     868#ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
     869    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, rtcTimerSecond, "MC146818 RTC/CMOS - Second", &pData->pSecondTimerHC);
     870#else
    861871    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, rtcTimerSecond, "MC146818 RTC/CMOS - Second", &pData->pSecondTimerHC);
     872#endif
    862873    if (VBOX_FAILURE(rc))
    863874    {
     
    865876        return rc;
    866877    }
     878#ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
     879    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, rtcTimerSecond2, "MC146818 RTC/CMOS - Second2", &pData->pSecondTimer2HC);
     880#else
    867881    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, rtcTimerSecond2, "MC146818 RTC/CMOS - Second2", &pData->pSecondTimer2HC);
     882#endif
    868883    if (VBOX_FAILURE(rc))
    869884    {
  • trunk/src/VBox/Devices/testcase/Makefile

    r735 r2285  
    2626#
    2727PROGRAMS = tstDeviceStructSize tstDeviceStructSizeGC
     28
     29# temp hack.
     30ifeq ($(USERNAME),bird)
     31 DEFS += VBOX_WITH_VIRTUAL_SYNC_TIMERS
     32endif
     33
    2834
    2935#
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp

    r2269 r2285  
    447447    GEN_CHECK_OFF(PITChannelState, u64ReloadTS);
    448448    GEN_CHECK_OFF(PITChannelState, u64NextTS);
     449#ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    449450    GEN_CHECK_OFF(PITChannelState, i64MaxCatchupTS);
     451#endif
    450452    GEN_CHECK_OFF(PITChannelState, count_load_time);
    451453    GEN_CHECK_OFF(PITChannelState, next_transition_time);
     
    472474    GEN_CHECK_OFF(PITState, StatPITIrq);
    473475    GEN_CHECK_OFF(PITState, StatPITHandler);
     476#ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    474477    GEN_CHECK_OFF(PITState, StatPITCatchup);
    475478    GEN_CHECK_OFF(PITState, StatPITGiveup);
     479#endif
    476480
    477481    /* PC/DevRTC.cpp */
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