UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation
Export DumpCpuCotext() to display CPU Context. We will invoke PeCoffGetEntrypointLib's PeCoffSerachImageBase() to get PE/COFF image base. Display exception data bit value for page fault exception. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Common header file for CPU Exception Handler Library.
|
||||
|
||||
Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -24,11 +24,23 @@
|
||||
#include <Library/PeCoffGetEntryPointLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/SynchronizationLib.h>
|
||||
#include <Library/CpuExceptionHandlerLib.h>
|
||||
|
||||
#define CPU_EXCEPTION_NUM 32
|
||||
#define CPU_INTERRUPT_NUM 256
|
||||
#define HOOKAFTER_STUB_SIZE 16
|
||||
|
||||
//
|
||||
// Exception Error Code of Page-Fault Exception
|
||||
//
|
||||
#define IA32_PF_EC_P BIT0
|
||||
#define IA32_PF_EC_WR BIT1
|
||||
#define IA32_PF_EC_US BIT2
|
||||
#define IA32_PF_EC_RSVD BIT3
|
||||
#define IA32_PF_EC_ID BIT4
|
||||
#define IA32_PF_EC_PK BIT5
|
||||
#define IA32_PF_EC_SGX BIT15
|
||||
|
||||
#include "ArchInterruptDefs.h"
|
||||
|
||||
#define CPU_EXCEPTION_HANDLER_LIB_HOB_GUID \
|
||||
@@ -53,7 +65,6 @@ typedef struct {
|
||||
} EXCEPTION_HANDLER_DATA;
|
||||
|
||||
extern CONST UINT32 mErrorCodeFlag;
|
||||
extern CONST UINTN mImageAlignSize;
|
||||
extern CONST UINTN mDoFarReturnFlag;
|
||||
|
||||
/**
|
||||
@@ -112,15 +123,11 @@ InternalPrintMessage (
|
||||
Find and display image base address and return image base and its entry point.
|
||||
|
||||
@param CurrentEip Current instruction pointer.
|
||||
@param EntryPoint Return module entry point if module header is found.
|
||||
|
||||
@return !0 Image base address.
|
||||
@return 0 Image header cannot be found.
|
||||
**/
|
||||
UINTN
|
||||
FindModuleImageBase (
|
||||
IN UINTN CurrentEip,
|
||||
OUT UINTN *EntryPoint
|
||||
VOID
|
||||
DumpModuleImageInfo (
|
||||
IN UINTN CurrentEip
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -130,7 +137,7 @@ FindModuleImageBase (
|
||||
@param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
|
||||
**/
|
||||
VOID
|
||||
DumpCpuContent (
|
||||
DumpImageAndCpuContent (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
Reference in New Issue
Block a user