VirtualBox

Changeset 97045 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 7, 2022 10:15:39 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
153992
Message:

DevHPET: Fixed constant overflow issue in previous change (mostly harmless). bugref:10301

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevHPET.cpp

    r97028 r97045  
    9999 * Femtosecods in a nanosecond
    100100 */
    101 #define FS_PER_NS                   1000000
    102 
    103 /** Number of HPET ticks per second (Hz), ICH9 frequency.
    104  * Value: 14318179 */
    105 #define HPET_TICKS_PER_SEC_ICH9     ((RT_NS_1SEC * FS_PER_NS) / HPET_CLK_PERIOD_ICH9)
    106 
    107 /** Number of HPET ticks per second (Hz), made-up PIIX frequency.
    108  * Value: 100000000   */
    109 #define HPET_TICKS_PER_SEC_PIIX     ((RT_NS_1SEC * FS_PER_NS) / HPET_CLK_PERIOD_PIIX)
    110 
    111 /** Number of HPET ticks in 100 years, ICH9 frequency.
    112  * Value: 45153809294400000 (0x00A06B26'7B3F9A00) */
     101#define FS_PER_NS                   UINT32_C(1000000)
     102
     103/** Number of HPET ticks per second (Hz), ICH9 frequency.  */
     104#define HPET_TICKS_PER_SEC_ICH9     UINT32_C(14318180)
     105AssertCompile(HPET_TICKS_PER_SEC_ICH9 == (RT_NS_1SEC_64 * FS_PER_NS + HPET_CLK_PERIOD_ICH9 / 2) / HPET_CLK_PERIOD_ICH9);
     106
     107/** Number of HPET ticks per second (Hz), made-up PIIX frequency.  */
     108#define HPET_TICKS_PER_SEC_PIIX     UINT32_C(100000000)
     109AssertCompile(HPET_TICKS_PER_SEC_PIIX == (RT_NS_1SEC_64 * FS_PER_NS + HPET_CLK_PERIOD_PIIX / 2) / HPET_CLK_PERIOD_PIIX);
     110
     111/** Number of HPET ticks in 100 years (approximate), ICH9 frequency.
     112 * Value: 45153812448000000 (0x00A06B27'3737B800) */
    113113#define HPET_TICKS_IN_100YR_ICH9    (HPET_TICKS_PER_SEC_ICH9 * RT_SEC_1DAY_64 * 365 * 100)
     114AssertCompile(HPET_TICKS_IN_100YR_ICH9 >= UINT64_C(45153812448000000));
    114115
    115116/**  Number of HPET ticks in 100 years, made-up PIIX frequency.
    116117 * Value: 315360000000000000 (0x0460623F'C85E0000) */
    117118#define HPET_TICKS_IN_100YR_PIIX    (HPET_TICKS_PER_SEC_PIIX * RT_SEC_1DAY_64 * 365 * 100)
     119AssertCompile(HPET_TICKS_IN_100YR_PIIX >= UINT64_C(315360000000000000));
    118120
    119121/** @name Interrupt type
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