2 CPU Exception Library provides DXE/SMM CPU exception handler.
4 Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "CpuExceptionCommon.h"
18 #include <Library/SynchronizationLib.h>
21 // Spinlock for CPU information display
23 SPIN_LOCK mDisplayMessageSpinLock
;
26 // Image align size for DXE/SMM
28 CONST UINTN mImageAlignSize
= SIZE_4KB
;
31 Common exception handler.
33 @param ExceptionType Exception type.
34 @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
38 CommonExceptionHandler (
39 IN EFI_EXCEPTION_TYPE ExceptionType
,
40 IN EFI_SYSTEM_CONTEXT SystemContext
44 // Get Spinlock to display CPU information
46 while (!AcquireSpinLockOrFail (&mDisplayMessageSpinLock
)) {
51 // Display ExceptionType, CPU information and Image information
53 DumpCpuContent (ExceptionType
, SystemContext
);
58 ReleaseSpinLock (&mDisplayMessageSpinLock
);
67 Setup CPU exception handlers.
69 This API will setups the CPU exception handler to display CPU contents and run into
71 Note: Before invoking this API, caller must allocate memory for IDT table and load
72 IDTR by AsmWriteIdtr().
77 SetupCpuExceptionHandlers (
81 InitializeSpinLock (&mDisplayMessageSpinLock
);
82 InternalSetupCpuExceptionHandlers ();