Actually, TimerCycle is APIC timer's initial count. Timer count value 0 is missed when calculating Delta value.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <[email protected]> CC: Ruiyu Ni <[email protected]> --- SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c | 4 ++-- SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c index bf965cb..72e67d2 100644 --- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c +++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c @@ -109,7 +109,7 @@ SaveAndSetDebugTimerInterrupt ( /** Check if the timer is time out. - @param[in] TimerCycle Timer total count. + @param[in] TimerCycle Timer initial count. @param[in] Timer The start timer from the begin. @param[in] TimeoutTicker Ticker number need time out. @@ -140,7 +140,7 @@ IsDebugTimerTimeout ( // // Handle one roll-over. // - Delta = TimerCycle - (CurrentTimer - Timer); + Delta = TimerCycle - (CurrentTimer - Timer) + 1; } return (BOOLEAN) (Delta >= TimeoutTicker); diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h index 60550d4..2294fcd 100644 --- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h +++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h @@ -32,7 +32,7 @@ InitializeDebugTimer ( /** Check if the timer is time out. - @param[in] TimerCycle Timer total count. + @param[in] TimerCycle Timer initial count. @param[in] Timer The start timer from the begin. @param[in] TimeoutTicker Ticker number need time out. -- 1.9.5.msysgit.0 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

