X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=UefiCpuPkg%2FLibrary%2FSecPeiDxeTimerLibUefiCpu%2FX86TimerLib.c;h=801ebdb1917b98651aa768cfeb3448274187381e;hp=52ae7717ddf5aff8b98a2b3011137a2a3937320e;hb=7367cc6c24d01b400d2370ffd58ae02854a56b32;hpb=253fcc8bdc94cc77f043c63b02071fb173413a6c
diff --git a/UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/X86TimerLib.c b/UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/X86TimerLib.c
index 52ae7717dd..801ebdb191 100644
--- a/UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/X86TimerLib.c
+++ b/UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/X86TimerLib.c
@@ -2,8 +2,8 @@
Timer Library functions built upon local APIC on IA32/x64.
This library uses the local APIC library so that it supports x2APIC mode.
-
- Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.
+
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -45,6 +45,9 @@ InternalX86GetTimerFrequency (
Stalls the CPU for at least the given number of ticks. It's invoked by
MicroSecondDelay() and NanoSecondDelay().
+ This function will ASSERT if the APIC timer intial count returned from
+ GetApicTimerInitCount() is zero.
+
@param Delay A period of time to delay in ticks.
**/
@@ -67,6 +70,7 @@ InternalX86Delay (
// Delay and the Init Count.
//
InitCount = GetApicTimerInitCount ();
+ ASSERT (InitCount != 0);
Times = Delay / (InitCount / 2);
Delay = Delay % (InitCount / 2);