mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg: Add ASSERT to handle local APIC not config properly
When the local APIC is not configurated properly, function GetApicTimerInitCount() in LocalApicLib may return zero, which will lead to a divide by zero exception in SecPeiDxeTimerLibUefiCpu. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18594 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
53fa8748fd
commit
f17e2f8c9e
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
This library uses the local APIC library so that it supports x2APIC mode.
|
This library uses the local APIC library so that it supports x2APIC mode.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
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
|
Stalls the CPU for at least the given number of ticks. It's invoked by
|
||||||
MicroSecondDelay() and NanoSecondDelay().
|
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.
|
@param Delay A period of time to delay in ticks.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -67,6 +70,7 @@ InternalX86Delay (
|
||||||
// Delay and the Init Count.
|
// Delay and the Init Count.
|
||||||
//
|
//
|
||||||
InitCount = GetApicTimerInitCount ();
|
InitCount = GetApicTimerInitCount ();
|
||||||
|
ASSERT (InitCount != 0);
|
||||||
Times = Delay / (InitCount / 2);
|
Times = Delay / (InitCount / 2);
|
||||||
Delay = Delay % (InitCount / 2);
|
Delay = Delay % (InitCount / 2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue