VirtualBox

Changeset 46231 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
May 23, 2013 11:23:15 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85960
Message:

GetTickCount isn't usable, bit the bullet and read interrupt time from KUSER_SHARED_DATA in ring-3.

Location:
trunk/src/VBox/Runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp

    r46223 r46231  
    3939     * Note! The time source we use here must be exactly the same as in
    4040     *       the ring-3 code!
     41     *
     42     * Using interrupt time is the simplest and requires the least calculation.
     43     * It is also accounting for suspended time. Unfortuantely, there is no
     44     * ring-3 for reading it... but that won't stop us.
     45     *
     46     * Using the tick count is problematic in ring-3 on older windows version
     47     * as we can only get the 32-bit tick value, i.e. we'll roll over sooner or
     48     * later.
    4149     */
    42 #if 0
     50#if 1
     51    /* Interrupt time. (NT4 doesn't have an API for it.) */
    4352# ifndef IPRT_TARGET_NT4
    4453    ULONGLONG InterruptTime = KeQueryInterruptTime();
     
    5564# endif
    5665#else
     66    /* Tick Count (NT4 SP1 has these APIs, haven't got SP0 to check). */
    5767    LARGE_INTEGER Tick;
    5868    KeQueryTickCount(&Tick);
  • trunk/src/VBox/Runtime/r3/win/time-win.cpp

    r46223 r46231  
    4343 * Note! The selected time source be the exact same one as we use in kernel land!
    4444 */
    45 #define USE_TICK_COUNT
     45//#define USE_TICK_COUNT
    4646//#define USE_PERFORMANCE_COUNTER
    4747//# define USE_FILE_TIME
    4848//#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    49 //# define USE_INTERRUPT_TIME
     49# define USE_INTERRUPT_TIME
    5050//#else
    5151//# define USE_TICK_COUNT
     
    109109
    110110#elif defined USE_INTERRUPT_TIME
     111# if 0 /* ASSUME 0x7ffe0000 is set in stone */
    111112    /*
    112113     * This is exactly what we want, but we have to obtain it by non-official
     
    121122        s_pUserSharedData = (PMY_KUSER_SHARED_DATA)(uintptr_t)0x7ffe0000;
    122123    }
     124# endif
     125    PMY_KUSER_SHARED_DATA pUserSharedData = (PMY_KUSER_SHARED_DATA)(uintptr_t)0x7ffe0000;
    123126
    124127    /* use interrupt time */
     
    126129    do
    127130    {
    128         Time.HighPart = s_pUserSharedData->InterruptTime.High1Time;
    129         Time.LowPart  = s_pUserSharedData->InterruptTime.LowPart;
    130     } while (s_pUserSharedData->InterruptTime.High2Time != Time.HighPart);
     131        Time.HighPart = pUserSharedData->InterruptTime.High1Time;
     132        Time.LowPart  = pUserSharedData->InterruptTime.LowPart;
     133    } while (pUserSharedData->InterruptTime.High2Time != Time.HighPart);
    131134
    132135    return (uint64_t)Time.QuadPart * 100;
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