If CPU runs fast and timer runs slow, two GetApicTimerCurrentCount() may return the same timer count value. We need to consider timer roll-over not happened. Otherwise, one false timeout flag will be set.
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 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c index 4a6ccdb..bf965cb 100644 --- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c +++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c @@ -131,8 +131,10 @@ IsDebugTimerTimeout ( // // This timer counter counts down. Check for roll over condition. + // If CurrentTimer is equal to Timer, it does not mean that roll over + // happened. // - if (CurrentTimer < Timer) { + if (CurrentTimer <= Timer) { Delta = Timer - CurrentTimer; } else { // -- 1.9.5.msysgit.0 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

