* [PATCH 0/9] Export Dump CPU Context service
@ 2017-04-01 13:25 Jeff Fan
2017-04-01 13:25 ` [PATCH 1/9] MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase() Jeff Fan
` (9 more replies)
0 siblings, 10 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
This serial of patches are:
1. Export PeCoffSerachImageBase() that could serach PE/COFF image base.
2. Export DumpCpuContext that could dump CPU context when exception happened.
https://bugzilla.tianocore.org/show_bug.cgi?id=242
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>
Jeff Fan (9):
MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase()
MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext()
UefiCpuPkg/CpuExceptionHandlerLib: Rename internal DumpCpuContent()
UefiCpuPkg/CpuExceptionHandlerLib: Add DumpModuleImageInfo()
UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation
UefiCpuPkg/CpuExceptionHandlerLib: Display PF Excption Data bit
UefiCpuPkg/PiSmmCpuDxeSmm: Consume PeCoffSerachImageBase()
UefiCpuPkg/PiSmmCpuDxeSmm: Consume DumpCpuContext()
SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()
.../Include/Library/CpuExceptionHandlerLib.h | 15 ++++-
.../CpuExceptionHandlerLibNull.c | 16 ++++-
MdePkg/Include/Library/PeCoffGetEntryPointLib.h | 20 +++++-
.../PeCoffGetEntryPoint.c | 72 ++++++++++++++++++++-
.../DebugAgent/DebugAgentCommon/DebugAgent.c | 50 ++-------------
.../CpuExceptionHandlerLib/CpuExceptionCommon.c | 75 ++++++----------------
.../CpuExceptionHandlerLib/CpuExceptionCommon.h | 27 +++++---
.../Library/CpuExceptionHandlerLib/DxeException.c | 7 +-
.../Ia32/ArchExceptionHandler.c | 65 ++++++++++++-------
.../CpuExceptionHandlerLib/PeiCpuException.c | 6 +-
.../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c | 4 +-
.../CpuExceptionHandlerLib/SecPeiCpuException.c | 8 +--
.../Library/CpuExceptionHandlerLib/SmmException.c | 7 +-
.../X64/ArchExceptionHandler.c | 57 ++++++++++------
UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 18 ++----
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 37 +----------
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 4 +-
UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 6 +-
UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 18 ++----
19 files changed, 265 insertions(+), 247 deletions(-)
--
2.9.3.windows.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/9] MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase()
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-01 13:25 ` [PATCH 2/9] MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext() Jeff Fan
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Liming Gao
This new API only works on DEBUG build. It will search the PE/COFF image base
forward the input address in this PE/COFF image and returns it.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
---
MdePkg/Include/Library/PeCoffGetEntryPointLib.h | 20 +++++-
.../PeCoffGetEntryPoint.c | 72 +++++++++++++++++++++-
2 files changed, 90 insertions(+), 2 deletions(-)
diff --git a/MdePkg/Include/Library/PeCoffGetEntryPointLib.h b/MdePkg/Include/Library/PeCoffGetEntryPointLib.h
index e517ca2..647503b 100644
--- a/MdePkg/Include/Library/PeCoffGetEntryPointLib.h
+++ b/MdePkg/Include/Library/PeCoffGetEntryPointLib.h
@@ -1,7 +1,7 @@
/** @file
Provides a service to retrieve the PE/COFF entry point from a PE/COFF image.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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 that accompanies this distribution.
The full text of the license may be found at
@@ -101,4 +101,22 @@ PeCoffGetSizeOfHeaders (
IN VOID *Pe32Data
);
+/**
+ Returns PE/COFF image base specified by the address in this PE/COFF image.
+
+ On DEBUG build, searches the PE/COFF image base forward the address in this
+ PE/COFF image and returns it.
+
+ @param Address Address located in one PE/COFF image.
+
+ @retval 0 RELEASE build or cannot find the PE/COFF image base.
+ @retval others PE/COFF image base found.
+
+**/
+UINTN
+EFIAPI
+PeCoffSerachImageBase (
+ IN UINTN Address
+ );
+
#endif
diff --git a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
index 0fb7e84..00f6d7d 100644
--- a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
+++ b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
@@ -2,7 +2,7 @@
Provides the services to get the entry point to a PE/COFF image that has either been
loaded into memory or is executing at it's linked address.
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -22,6 +22,8 @@
#include <IndustryStandard/PeImage.h>
+#define PE_COFF_IMAGE_ALIGN_SIZE 4
+
/**
Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded
into system memory with the PE/COFF Loader Library functions.
@@ -316,3 +318,71 @@ PeCoffGetSizeOfHeaders (
return (UINT32) SizeOfHeaders;
}
+/**
+ Returns PE/COFF image base is loaded in system memory where the input address is in.
+
+ On DEBUG build, searches the PE/COFF image base forward the input address and
+ returns it.
+
+ @param Address Address located in one PE/COFF image.
+
+ @retval 0 RELEASE build or cannot find the PE/COFF image base.
+ @retval others PE/COFF image base found.
+
+**/
+UINTN
+EFIAPI
+PeCoffSerachImageBase (
+ IN UINTN Address
+ )
+{
+ UINTN Pe32Data;
+
+ Pe32Data = 0;
+
+ DEBUG_CODE (
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+
+ //
+ // Find Image Base
+ //
+ Pe32Data = Address & ~(PE_COFF_IMAGE_ALIGN_SIZE - 1);
+ while (Pe32Data != 0) {
+ DosHdr = (EFI_IMAGE_DOS_HEADER *) Pe32Data;
+ if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ //
+ // DOS image header is present, so read the PE header after the DOS image header.
+ //
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+ //
+ // Make sure PE header address does not overflow and is less than the initial address.
+ //
+ if (((UINTN)Hdr.Pe32 > Pe32Data) && ((UINTN)Hdr.Pe32 < Address)) {
+ if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
+ break;
+ }
+ }
+ } else {
+ //
+ // DOS image header is not present, TE header is at the image base.
+ //
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
+ if ((Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) &&
+ ((Hdr.Te->Machine == IMAGE_FILE_MACHINE_I386) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_IA64) ||
+ (Hdr.Te->Machine == IMAGE_FILE_MACHINE_EBC) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_X64) ||
+ (Hdr.Te->Machine == IMAGE_FILE_MACHINE_ARM64) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_ARMTHUMB_MIXED))
+ ) {
+ break;
+ }
+ }
+
+ //
+ // Not found the image base, check the previous aligned address
+ //
+ Pe32Data -= PE_COFF_IMAGE_ALIGN_SIZE;
+ }
+ );
+
+ return Pe32Data;
+}
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/9] MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext()
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
2017-04-01 13:25 ` [PATCH 1/9] MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase() Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-01 13:25 ` [PATCH 3/9] UefiCpuPkg/CpuExceptionHandlerLib: Rename internal DumpCpuContent() Jeff Fan
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
This API is used to display exception type and all processor context for debug
purpose.
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>
---
MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h | 15 ++++++++++++++-
.../CpuExceptionHandlerLibNull.c | 16 +++++++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h b/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
index b3016ee..6cd8230 100644
--- a/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
+++ b/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
@@ -2,7 +2,7 @@
CPU Exception library provides the default CPU interrupt/exception handler.
It also provides capability to register user interrupt/exception handler.
- Copyright (c) 2012 - 2013, 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
@@ -93,4 +93,17 @@ RegisterCpuInterruptHandler (
IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
);
+/**
+ Display processor context.
+
+ @param[in] ExceptionType Exception type.
+ @param[in] SystemContext Processor context to be display.
+**/
+VOID
+EFIAPI
+DumpCpuContext (
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ );
+
#endif
diff --git a/MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c b/MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c
index 68ee9a9..cbe4768 100644
--- a/MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c
+++ b/MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c
@@ -1,7 +1,7 @@
/** @file
CPU Exception Handler library implementition with empty functions.
- 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
@@ -97,3 +97,17 @@ RegisterCpuInterruptHandler (
return EFI_UNSUPPORTED;
}
+/**
+ Display processor context.
+
+ @param[in] ExceptionType Exception type.
+ @param[in] SystemContext Processor context to be display.
+**/
+VOID
+EFIAPI
+DumpCpuContext (
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ )
+{
+}
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/9] UefiCpuPkg/CpuExceptionHandlerLib: Rename internal DumpCpuContent()
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
2017-04-01 13:25 ` [PATCH 1/9] MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase() Jeff Fan
2017-04-01 13:25 ` [PATCH 2/9] MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext() Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-01 13:25 ` [PATCH 4/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpModuleImageInfo() Jeff Fan
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
Rename internal DumpCpuContent() to DumpImageAndCpuContent().
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>
---
UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h | 4 ++--
UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c | 4 ++--
UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c | 4 ++--
UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c | 4 ++--
UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
index 4639ed2..9adb6a1 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
@@ -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
@@ -130,7 +130,7 @@ FindModuleImageBase (
@param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
**/
VOID
-DumpCpuContent (
+DumpImageAndCpuContent (
IN EFI_EXCEPTION_TYPE ExceptionType,
IN EFI_SYSTEM_CONTEXT SystemContext
);
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
index 7ab2438..aaf90f6 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
@@ -1,7 +1,7 @@
/** @file
IA32 CPU Exception Handler functons.
- 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
@@ -114,7 +114,7 @@ ArchRestoreExceptionContext (
@param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
**/
VOID
-DumpCpuContent (
+DumpImageAndCpuContent (
IN EFI_EXCEPTION_TYPE ExceptionType,
IN EFI_SYSTEM_CONTEXT SystemContext
)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
index c0fc9a6..fb679b5 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
@@ -1,7 +1,7 @@
/** @file
CPU Exception Library provides PEI/DXE/SMM CPU common exception handler.
-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 that accompanies this distribution.
The full text of the license may be found at
@@ -101,7 +101,7 @@ CommonExceptionHandlerWorker (
//
// Display ExceptionType, CPU information and Image information
//
- DumpCpuContent (ExceptionType, SystemContext);
+ DumpImageAndCpuContent (ExceptionType, SystemContext);
//
// Release Spinlock of output message
//
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
index 7e94e38..7ac3fc2 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
@@ -1,7 +1,7 @@
/** @file
CPU exception handler library implemenation for SEC/PEIM modules.
-Copyright (c) 2012 - 2013, 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 that accompanies this distribution.
The full text of the license may be found at
@@ -37,7 +37,7 @@ CommonExceptionHandler (
//
// Display ExceptionType, CPU information and Image information
//
- DumpCpuContent (ExceptionType, SystemContext);
+ DumpImageAndCpuContent (ExceptionType, SystemContext);
//
// Enter a dead loop.
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
index 7495b14..3cda7d5 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
@@ -1,7 +1,7 @@
/** @file
x64 CPU Exception Handler.
- 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
@@ -119,7 +119,7 @@ ArchRestoreExceptionContext (
@param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
**/
VOID
-DumpCpuContent (
+DumpImageAndCpuContent (
IN EFI_EXCEPTION_TYPE ExceptionType,
IN EFI_SYSTEM_CONTEXT SystemContext
)
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpModuleImageInfo()
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
` (2 preceding siblings ...)
2017-04-01 13:25 ` [PATCH 3/9] UefiCpuPkg/CpuExceptionHandlerLib: Rename internal DumpCpuContent() Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-01 13:25 ` [PATCH 5/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation Jeff Fan
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
Add internal DumpModuleImageInfo() to replace FindModuleImageBase(). It will
consume PeCoffGetEntrypointLib's PeCoffSerachImageBase() to get PE/COFF image
base.
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>
---
.../CpuExceptionHandlerLib/CpuExceptionCommon.c | 75 ++++++----------------
.../CpuExceptionHandlerLib/CpuExceptionCommon.h | 11 +---
.../Library/CpuExceptionHandlerLib/DxeException.c | 7 +-
.../Ia32/ArchExceptionHandler.c | 15 +----
.../CpuExceptionHandlerLib/PeiCpuException.c | 6 +-
.../CpuExceptionHandlerLib/SecPeiCpuException.c | 4 --
.../Library/CpuExceptionHandlerLib/SmmException.c | 7 +-
.../X64/ArchExceptionHandler.c | 12 +---
8 files changed, 30 insertions(+), 107 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c
index 3d85b0c..6080d1e 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c
@@ -113,75 +113,40 @@ InternalPrintMessage (
@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
)
{
+ EFI_STATUS Status;
UINTN Pe32Data;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
VOID *PdbPointer;
+ VOID *EntryPoint;
- //
- // Find Image Base
- //
- Pe32Data = CurrentEip & ~(mImageAlignSize - 1);
- while (Pe32Data != 0) {
- DosHdr = (EFI_IMAGE_DOS_HEADER *) Pe32Data;
- if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present, so read the PE header after the DOS image header.
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
- //
- // Make sure PE header address does not overflow and is less than the initial address.
- //
- if (((UINTN)Hdr.Pe32 > Pe32Data) && ((UINTN)Hdr.Pe32 < CurrentEip)) {
- if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
- //
- // It's PE image.
- //
- InternalPrintMessage ("!!!! Find PE image ");
- *EntryPoint = (UINTN)Pe32Data + (UINTN)(Hdr.Pe32->OptionalHeader.AddressOfEntryPoint & 0x0ffffffff);
- break;
- }
- }
- } else {
- //
- // DOS image header is not present, TE header is at the image base.
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
- if ((Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) &&
- ((Hdr.Te->Machine == IMAGE_FILE_MACHINE_I386) || Hdr.Te->Machine == IMAGE_FILE_MACHINE_X64)) {
- //
- // It's TE image, it TE header and Machine type match
- //
- InternalPrintMessage ("!!!! Find TE image ");
- *EntryPoint = (UINTN)Pe32Data + (UINTN)(Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) + sizeof(EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
- break;
- }
- }
-
+ Pe32Data = PeCoffSerachImageBase (CurrentEip);
+ if (Pe32Data == 0) {
+ InternalPrintMessage ("!!!! Can't find image information. !!!!\n");
+ } else {
//
- // Not found the image base, check the previous aligned address
+ // Find Image Base entry point
//
- Pe32Data -= mImageAlignSize;
- }
-
- if (Pe32Data != 0) {
+ Status = PeCoffLoaderGetEntryPoint ((VOID *) Pe32Data, &EntryPoint);
+ if (EFI_ERROR (Status)) {
+ EntryPoint = NULL;
+ }
+ InternalPrintMessage ("!!!! Find image ");
PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *) Pe32Data);
if (PdbPointer != NULL) {
InternalPrintMessage ("%a", PdbPointer);
} else {
InternalPrintMessage ("(No PDB) " );
}
- } else {
- InternalPrintMessage ("!!!! Can't find image information. !!!!\n");
+ InternalPrintMessage (
+ " (ImageBase=%016lp, EntryPoint=%016p) !!!!\n",
+ (VOID *) Pe32Data,
+ EntryPoint
+ );
}
-
- return Pe32Data;
}
/**
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
index 9adb6a1..0047ad6 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
@@ -53,7 +53,6 @@ typedef struct {
} EXCEPTION_HANDLER_DATA;
extern CONST UINT32 mErrorCodeFlag;
-extern CONST UINTN mImageAlignSize;
extern CONST UINTN mDoFarReturnFlag;
/**
@@ -112,15 +111,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
);
/**
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
index a61a52b..ab13e5e 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
@@ -1,7 +1,7 @@
/** @file
CPU exception handler library implemenation for DXE modules.
- Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2013 - 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
@@ -19,11 +19,6 @@
CONST UINTN mDoFarReturnFlag = 0;
-//
-// Image align size for DXE/SMM
-//
-CONST UINTN mImageAlignSize = SIZE_4KB;
-
RESERVED_VECTORS_DATA mReservedVectorsData[CPU_EXCEPTION_NUM];
EFI_CPU_INTERRUPT_HANDLER mExternalInterruptHandlerTable[CPU_EXCEPTION_NUM];
UINTN mEnabledInterruptNum = 0;
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
index aaf90f6..d3b26d3 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
@@ -119,9 +119,6 @@ DumpImageAndCpuContent (
IN EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN ImageBase;
- UINTN EntryPoint;
-
InternalPrintMessage (
"!!!! IA32 Exception Type - %02x(%a) CPU Apic ID - %08x !!!!\n",
ExceptionType,
@@ -200,14 +197,8 @@ DumpImageAndCpuContent (
);
//
- // Find module image base and module entry point by RIP
+ // Find module image base and module entry point by EIP
//
- ImageBase = FindModuleImageBase (SystemContext.SystemContextIa32->Eip, &EntryPoint);
- if (ImageBase != 0) {
- InternalPrintMessage (
- " (ImageBase=%08x, EntryPoint=%08x) !!!!\n",
- ImageBase,
- EntryPoint
- );
- }
+ DumpModuleImageInfo (SystemContext.SystemContextIa32->Eip);
+
}
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c
index c3fd8ae..53fa3c6 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c
@@ -1,7 +1,7 @@
/** @file
CPU exception handler library implementation for PEIM module.
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2016 - 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 that accompanies this distribution.
The full text of the license may be found at
@@ -18,10 +18,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/HobLib.h>
#include <Library/MemoryAllocationLib.h>
-//
-// Image Alignment size for PEI phase
-//
-CONST UINTN mImageAlignSize = 4;
CONST UINTN mDoFarReturnFlag = 0;
EFI_GUID mCpuExceptrionHandlerLibHobGuid = CPU_EXCEPTION_HANDLER_LIB_HOB_GUID;
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
index 7ac3fc2..5d6807b 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
@@ -15,10 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <PiPei.h>
#include "CpuExceptionCommon.h"
-//
-// Image Aglinment size for SEC/PEI phase
-//
-CONST UINTN mImageAlignSize = 4;
CONST UINTN mDoFarReturnFlag = 0;
/**
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c
index 7ad228c..5a3d416 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c
@@ -1,7 +1,7 @@
/** @file
CPU exception handler library implemenation for SMM modules.
- Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2013 - 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
@@ -22,11 +22,6 @@ CONST UINTN mDoFarReturnFlag = 1;
//
SPIN_LOCK mDisplayMessageSpinLock;
-//
-// Image align size for DXE/SMM
-//
-CONST UINTN mImageAlignSize = SIZE_4KB;
-
RESERVED_VECTORS_DATA mReservedVectorsData[CPU_EXCEPTION_NUM];
EFI_CPU_INTERRUPT_HANDLER mExternalInterruptHandlerTable[CPU_EXCEPTION_NUM];
EXCEPTION_HANDLER_DATA mExceptionHandlerData;
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
index 3cda7d5..9cd2cc2 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
@@ -124,9 +124,6 @@ DumpImageAndCpuContent (
IN EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN ImageBase;
- UINTN EntryPoint;
-
InternalPrintMessage (
"!!!! X64 Exception Type - %02x(%a) CPU Apic ID - %08x !!!!\n",
ExceptionType,
@@ -234,12 +231,5 @@ DumpImageAndCpuContent (
//
// Find module image base and module entry point by RIP
//
- ImageBase = FindModuleImageBase (SystemContext.SystemContextX64->Rip, &EntryPoint);
- if (ImageBase != 0) {
- InternalPrintMessage (
- " (ImageBase=%016lx, EntryPoint=%016lx) !!!!\n",
- ImageBase,
- EntryPoint
- );
- }
+ DumpModuleImageInfo (SystemContext.SystemContextX64->Rip);
}
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
` (3 preceding siblings ...)
2017-04-01 13:25 ` [PATCH 4/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpModuleImageInfo() Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-01 13:25 ` [PATCH 6/9] UefiCpuPkg/CpuExceptionHandlerLib: Display PF Excption Data bit Jeff Fan
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
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>
---
.../CpuExceptionHandlerLib/CpuExceptionCommon.h | 1 +
.../Ia32/ArchExceptionHandler.c | 24 +++++++++++++++++-----
.../X64/ArchExceptionHandler.c | 17 ++++++++++++++-
3 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
index 0047ad6..5b3a9b9 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
@@ -24,6 +24,7 @@
#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
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
index d3b26d3..59ed058 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
@@ -108,13 +108,14 @@ ArchRestoreExceptionContext (
}
/**
- Display CPU information.
+ Display processor context.
- @param ExceptionType Exception type.
- @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
+ @param[in] ExceptionType Exception type.
+ @param[in] SystemContext Processor context to be display.
**/
VOID
-DumpImageAndCpuContent (
+EFIAPI
+DumpCpuContext (
IN EFI_EXCEPTION_TYPE ExceptionType,
IN EFI_SYSTEM_CONTEXT SystemContext
)
@@ -195,10 +196,23 @@ DumpImageAndCpuContent (
"FXSAVE_STATE - %08x\n",
&SystemContext.SystemContextIa32->FxSaveState
);
+}
+/**
+ Display CPU information.
+
+ @param ExceptionType Exception type.
+ @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
+**/
+VOID
+DumpImageAndCpuContent (
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ )
+{
+ DumpCpuContext (ExceptionType, SystemContext);
//
// Find module image base and module entry point by EIP
//
DumpModuleImageInfo (SystemContext.SystemContextIa32->Eip);
-
}
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
index 9cd2cc2..5199559 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
@@ -119,7 +119,8 @@ ArchRestoreExceptionContext (
@param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
**/
VOID
-DumpImageAndCpuContent (
+EFIAPI
+DumpCpuContext (
IN EFI_EXCEPTION_TYPE ExceptionType,
IN EFI_SYSTEM_CONTEXT SystemContext
)
@@ -227,7 +228,21 @@ DumpImageAndCpuContent (
"FXSAVE_STATE - %016lx\n",
&SystemContext.SystemContextX64->FxSaveState
);
+}
+/**
+ Display CPU information.
+
+ @param ExceptionType Exception type.
+ @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
+**/
+VOID
+DumpImageAndCpuContent (
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ )
+{
+ DumpCpuContext (ExceptionType, SystemContext);
//
// Find module image base and module entry point by RIP
//
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/9] UefiCpuPkg/CpuExceptionHandlerLib: Display PF Excption Data bit
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
` (4 preceding siblings ...)
2017-04-01 13:25 ` [PATCH 5/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-01 13:25 ` [PATCH 7/9] UefiCpuPkg/PiSmmCpuDxeSmm: Consume PeCoffSerachImageBase() Jeff Fan
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
Page-fault exception data bit displaying is very useful.
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>
---
.../CpuExceptionHandlerLib/CpuExceptionCommon.h | 11 +++++++++
.../Ia32/ArchExceptionHandler.c | 26 ++++++++++++++++------
.../X64/ArchExceptionHandler.c | 26 ++++++++++++++++------
3 files changed, 49 insertions(+), 14 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
index 5b3a9b9..e66a5df 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
@@ -30,6 +30,17 @@
#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 \
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
index 59ed058..013e19b 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
@@ -126,19 +126,31 @@ DumpCpuContext (
GetExceptionNameStr (ExceptionType),
GetApicId ()
);
-
+ if ((mErrorCodeFlag & (1 << ExceptionType)) != 0) {
+ InternalPrintMessage (
+ "ExceptionData - %08x",
+ SystemContext.SystemContextIa32->ExceptionData
+ );
+ if (ExceptionType == EXCEPT_IA32_PAGE_FAULT) {
+ InternalPrintMessage (
+ " I:%x R:%x U:%x W:%x P:%x PK:%x S:%x",
+ (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_ID) != 0,
+ (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_RSVD) != 0,
+ (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_US) != 0,
+ (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_WR) != 0,
+ (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_P) != 0,
+ (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_PK) != 0,
+ (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_SGX) != 0
+ );
+ }
+ InternalPrintMessage ("\n");
+ }
InternalPrintMessage (
"EIP - %08x, CS - %08x, EFLAGS - %08x\n",
SystemContext.SystemContextIa32->Eip,
SystemContext.SystemContextIa32->Cs,
SystemContext.SystemContextIa32->Eflags
);
- if ((mErrorCodeFlag & (1 << ExceptionType)) != 0) {
- InternalPrintMessage (
- "ExceptionData - %08x\n",
- SystemContext.SystemContextIa32->ExceptionData
- );
- }
InternalPrintMessage (
"EAX - %08x, ECX - %08x, EDX - %08x, EBX - %08x\n",
SystemContext.SystemContextIa32->Eax,
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
index 5199559..98a776f 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
@@ -131,19 +131,31 @@ DumpCpuContext (
GetExceptionNameStr (ExceptionType),
GetApicId ()
);
-
+ if ((mErrorCodeFlag & (1 << ExceptionType)) != 0) {
+ InternalPrintMessage (
+ "ExceptionData - %016lx",
+ SystemContext.SystemContextX64->ExceptionData
+ );
+ if (ExceptionType == EXCEPT_IA32_PAGE_FAULT) {
+ InternalPrintMessage (
+ " I:%x R:%x U:%x W:%x P:%x PK:%x S:%x",
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0,
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_RSVD) != 0,
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_US) != 0,
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_WR) != 0,
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_P) != 0,
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_PK) != 0,
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_SGX) != 0
+ );
+ }
+ InternalPrintMessage ("\n");
+ }
InternalPrintMessage (
"RIP - %016lx, CS - %016lx, RFLAGS - %016lx\n",
SystemContext.SystemContextX64->Rip,
SystemContext.SystemContextX64->Cs,
SystemContext.SystemContextX64->Rflags
);
- if (mErrorCodeFlag & (1 << ExceptionType)) {
- InternalPrintMessage (
- "ExceptionData - %016lx\n",
- SystemContext.SystemContextX64->ExceptionData
- );
- }
InternalPrintMessage (
"RAX - %016lx, RCX - %016lx, RDX - %016lx\n",
SystemContext.SystemContextX64->Rax,
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/9] UefiCpuPkg/PiSmmCpuDxeSmm: Consume PeCoffSerachImageBase()
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
` (5 preceding siblings ...)
2017-04-01 13:25 ` [PATCH 6/9] UefiCpuPkg/CpuExceptionHandlerLib: Display PF Excption Data bit Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-01 13:25 ` [PATCH 8/9] UefiCpuPkg/PiSmmCpuDxeSmm: Consume DumpCpuContext() Jeff Fan
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
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>
---
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 37 +++---------------------------
1 file changed, 3 insertions(+), 34 deletions(-)
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
index d061482..7b23986 100755
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -167,48 +167,17 @@ DumpModuleInfoByIp (
)
{
UINTN Pe32Data;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
VOID *PdbPointer;
- UINT64 DumpIpAddress;
//
// Find Image Base
//
- Pe32Data = CallerIpAddress & ~(SIZE_4KB - 1);
- while (Pe32Data != 0) {
- DosHdr = (EFI_IMAGE_DOS_HEADER *) Pe32Data;
- if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present, so read the PE header after the DOS image header.
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
- //
- // Make sure PE header address does not overflow and is less than the initial address.
- //
- if (((UINTN)Hdr.Pe32 > Pe32Data) && ((UINTN)Hdr.Pe32 < CallerIpAddress)) {
- if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
- //
- // It's PE image.
- //
- break;
- }
- }
- }
-
- //
- // Not found the image base, check the previous aligned address
- //
- Pe32Data -= SIZE_4KB;
- }
-
- DumpIpAddress = CallerIpAddress;
- DEBUG ((EFI_D_ERROR, "It is invoked from the instruction before IP(0x%lx)", DumpIpAddress));
-
+ Pe32Data = PeCoffSerachImageBase (CallerIpAddress);
if (Pe32Data != 0) {
+ DEBUG ((DEBUG_ERROR, "It is invoked from the instruction before IP(0x%p)", (VOID *) CallerIpAddress));
PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *) Pe32Data);
if (PdbPointer != NULL) {
- DEBUG ((EFI_D_ERROR, " in module (%a)", PdbPointer));
+ DEBUG ((DEBUG_ERROR, " in module (%a)\n", PdbPointer));
}
}
}
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 8/9] UefiCpuPkg/PiSmmCpuDxeSmm: Consume DumpCpuContext()
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
` (6 preceding siblings ...)
2017-04-01 13:25 ` [PATCH 7/9] UefiCpuPkg/PiSmmCpuDxeSmm: Consume PeCoffSerachImageBase() Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-01 13:25 ` [PATCH 9/9] SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase() Jeff Fan
2017-04-07 0:41 ` [PATCH 0/9] Export Dump CPU Context service Yao, Jiewen
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
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>
---
UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 18 ++++++------------
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 4 ++--
UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 6 +-----
UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 18 ++++++------------
4 files changed, 15 insertions(+), 31 deletions(-)
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
index 119810a..32ce595 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
@@ -1,7 +1,7 @@
/** @file
Page table manipulation functions for IA-32 processors
-Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
This program and the accompanying materials
@@ -88,8 +88,8 @@ SmiDefaultPFHandler (
VOID
EFIAPI
SmiPFHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
)
{
UINTN PFAddress;
@@ -108,6 +108,7 @@ SmiPFHandler (
//
if ((PFAddress >= mCpuHotPlugData.SmrrBase) &&
(PFAddress < (mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize))) {
+ DumpCpuContext (InterruptType, SystemContext);
CpuIndex = GetCpuIndex ();
GuardPageAddress = (mSmmStackArrayBase + EFI_PAGE_SIZE + CpuIndex * mSmmStackSize);
if ((FeaturePcdGet (PcdCpuSmmStackGuard)) &&
@@ -115,15 +116,6 @@ SmiPFHandler (
(PFAddress < (GuardPageAddress + EFI_PAGE_SIZE))) {
DEBUG ((DEBUG_ERROR, "SMM stack overflow!\n"));
} else {
- DEBUG ((DEBUG_ERROR, "SMM exception data - 0x%x(", SystemContext.SystemContextIa32->ExceptionData));
- DEBUG ((DEBUG_ERROR, "I:%x, R:%x, U:%x, W:%x, P:%x",
- (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_ID) != 0,
- (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_RSVD) != 0,
- (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_US) != 0,
- (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_WR) != 0,
- (SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_P) != 0
- ));
- DEBUG ((DEBUG_ERROR, ")\n"));
if ((SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_ID) != 0) {
DEBUG ((DEBUG_ERROR, "SMM exception at execution (0x%x)\n", PFAddress));
DEBUG_CODE (
@@ -144,6 +136,7 @@ SmiPFHandler (
//
if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
(PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
+ DumpCpuContext (InterruptType, SystemContext);
if ((SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_ID) != 0) {
DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%x) out of SMM range after SMM is locked!\n", PFAddress));
DEBUG_CODE (
@@ -166,6 +159,7 @@ SmiPFHandler (
SystemContext.SystemContextIa32->ExceptionData
);
} else {
+ DumpCpuContext (InterruptType, SystemContext);
SmiDefaultPFHandler ();
}
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index 71af2f1..92b0fe6 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -690,8 +690,8 @@ SmmRelocateBases (
VOID
EFIAPI
SmiPFHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
);
/**
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
index 5aaf945..a216891 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
@@ -1,7 +1,7 @@
/** @file
SMM profile internal header file.
-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
@@ -41,10 +41,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// Please disable it.
//
-#define IA32_PF_EC_P (1u << 0)
-#define IA32_PF_EC_WR (1u << 1)
-#define IA32_PF_EC_US (1u << 2)
-#define IA32_PF_EC_RSVD (1u << 3)
#define IA32_PF_EC_ID (1u << 4)
#define SMM_PROFILE_NAME L"SmmProfileData"
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 19b19d8..32385fa 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -1,7 +1,7 @@
/** @file
Page Fault (#PF) handler for X64 processors
-Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
This program and the accompanying materials
@@ -802,8 +802,8 @@ SmiDefaultPFHandler (
VOID
EFIAPI
SmiPFHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
)
{
UINTN PFAddress;
@@ -817,6 +817,7 @@ SmiPFHandler (
PFAddress = AsmReadCr2 ();
if (mCpuSmmStaticPageTable && (PFAddress >= LShiftU64 (1, (mPhysicalAddressBits - 1)))) {
+ DumpCpuContext (InterruptType, SystemContext);
DEBUG ((DEBUG_ERROR, "Do not support address 0x%lx by processor!\n", PFAddress));
CpuDeadLoop ();
}
@@ -827,6 +828,7 @@ SmiPFHandler (
//
if ((PFAddress >= mCpuHotPlugData.SmrrBase) &&
(PFAddress < (mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize))) {
+ DumpCpuContext (InterruptType, SystemContext);
CpuIndex = GetCpuIndex ();
GuardPageAddress = (mSmmStackArrayBase + EFI_PAGE_SIZE + CpuIndex * mSmmStackSize);
if ((FeaturePcdGet (PcdCpuSmmStackGuard)) &&
@@ -834,15 +836,6 @@ SmiPFHandler (
(PFAddress < (GuardPageAddress + EFI_PAGE_SIZE))) {
DEBUG ((DEBUG_ERROR, "SMM stack overflow!\n"));
} else {
- DEBUG ((DEBUG_ERROR, "SMM exception data - 0x%lx(", SystemContext.SystemContextX64->ExceptionData));
- DEBUG ((DEBUG_ERROR, "I:%x, R:%x, U:%x, W:%x, P:%x",
- (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0,
- (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_RSVD) != 0,
- (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_US) != 0,
- (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_WR) != 0,
- (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_P) != 0
- ));
- DEBUG ((DEBUG_ERROR, ")\n"));
if ((SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0) {
DEBUG ((DEBUG_ERROR, "SMM exception at execution (0x%lx)\n", PFAddress));
DEBUG_CODE (
@@ -863,6 +856,7 @@ SmiPFHandler (
//
if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
(PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
+ DumpCpuContext (InterruptType, SystemContext);
if ((SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0) {
DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%lx) out of SMM range after SMM is locked!\n", PFAddress));
DEBUG_CODE (
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 9/9] SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
` (7 preceding siblings ...)
2017-04-01 13:25 ` [PATCH 8/9] UefiCpuPkg/PiSmmCpuDxeSmm: Consume DumpCpuContext() Jeff Fan
@ 2017-04-01 13:25 ` Jeff Fan
2017-04-07 0:41 ` [PATCH 0/9] Export Dump CPU Context service Yao, Jiewen
9 siblings, 0 replies; 13+ messages in thread
From: Jeff Fan @ 2017-04-01 13:25 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiewen Yao, Michael Kinney, Feng Tian
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>
---
.../DebugAgent/DebugAgentCommon/DebugAgent.c | 50 +++-------------------
1 file changed, 6 insertions(+), 44 deletions(-)
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
index edd0de1..6f3c419 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
@@ -4,7 +4,7 @@
read/write debug packet to communication with HOST based on transfer
protocol.
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 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
@@ -201,55 +201,17 @@ FindAndReportModuleImageInfo (
)
{
UINTN Pe32Data;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
//
// Find Image Base
//
- Pe32Data = ((UINTN)mErrorMsgVersionAlert) & ~(AlignSize - 1);
- while (Pe32Data != 0) {
- DosHdr = (EFI_IMAGE_DOS_HEADER *) Pe32Data;
- if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present, so read the PE header after the DOS image header.
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
- //
- // Make sure PE header address does not overflow and is less than the initial address.
- //
- if (((UINTN)Hdr.Pe32 > Pe32Data) && ((UINTN)Hdr.Pe32 < (UINTN)mErrorMsgVersionAlert)) {
- if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
- //
- // It's PE image.
- //
- break;
- }
- }
- } else {
- //
- // DOS image header is not present, TE header is at the image base.
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
- if ((Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) &&
- ((Hdr.Te->Machine == IMAGE_FILE_MACHINE_I386) || Hdr.Te->Machine == IMAGE_FILE_MACHINE_X64)) {
- //
- // It's TE image, it TE header and Machine type match
- //
- break;
- }
- }
-
- //
- // Not found the image base, check the previous aligned address
- //
- Pe32Data -= AlignSize;
+ Pe32Data = PeCoffSerachImageBase ((UINTN) mErrorMsgVersionAlert);
+ if (Pe32Data != 0) {
+ ImageContext.ImageAddress = Pe32Data;
+ ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress);
+ PeCoffLoaderRelocateImageExtraAction (&ImageContext);
}
-
- ImageContext.ImageAddress = Pe32Data;
- ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress);
- PeCoffLoaderRelocateImageExtraAction (&ImageContext);
}
/**
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 0/9] Export Dump CPU Context service
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
` (8 preceding siblings ...)
2017-04-01 13:25 ` [PATCH 9/9] SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase() Jeff Fan
@ 2017-04-07 0:41 ` Yao, Jiewen
2017-04-07 0:46 ` Fan, Jeff
9 siblings, 1 reply; 13+ messages in thread
From: Yao, Jiewen @ 2017-04-07 0:41 UTC (permalink / raw)
To: Fan, Jeff, edk2-devel@lists.01.org; +Cc: Kinney, Michael D, Tian, Feng
Hi
I do not think it is necessary to split this simple patch to so many.
It brings burden to me to review the change. For example, there are 4 patches for CpuExceptionHandlerLib.
Can we combine the patch based upon the module?
Thank you
Yao Jiewen
> -----Original Message-----
> From: Fan, Jeff
> Sent: Saturday, April 1, 2017 9:25 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Tian, Feng <feng.tian@intel.com>
> Subject: [PATCH 0/9] Export Dump CPU Context service
>
> This serial of patches are:
> 1. Export PeCoffSerachImageBase() that could serach PE/COFF image base.
> 2. Export DumpCpuContext that could dump CPU context when exception
> happened.
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=242
>
> 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>
>
> Jeff Fan (9):
> MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase()
> MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext()
> UefiCpuPkg/CpuExceptionHandlerLib: Rename internal DumpCpuContent()
> UefiCpuPkg/CpuExceptionHandlerLib: Add DumpModuleImageInfo()
> UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext()
> implementation
> UefiCpuPkg/CpuExceptionHandlerLib: Display PF Excption Data bit
> UefiCpuPkg/PiSmmCpuDxeSmm: Consume PeCoffSerachImageBase()
> UefiCpuPkg/PiSmmCpuDxeSmm: Consume DumpCpuContext()
> SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()
>
> .../Include/Library/CpuExceptionHandlerLib.h | 15 ++++-
> .../CpuExceptionHandlerLibNull.c | 16 ++++-
> MdePkg/Include/Library/PeCoffGetEntryPointLib.h | 20 +++++-
> .../PeCoffGetEntryPoint.c | 72
> ++++++++++++++++++++-
> .../DebugAgent/DebugAgentCommon/DebugAgent.c | 50 ++-------------
> .../CpuExceptionHandlerLib/CpuExceptionCommon.c | 75
> ++++++----------------
> .../CpuExceptionHandlerLib/CpuExceptionCommon.h | 27 +++++---
> .../Library/CpuExceptionHandlerLib/DxeException.c | 7 +-
> .../Ia32/ArchExceptionHandler.c | 65
> ++++++++++++-------
> .../CpuExceptionHandlerLib/PeiCpuException.c | 6 +-
> .../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c | 4 +-
> .../CpuExceptionHandlerLib/SecPeiCpuException.c | 8 +--
> .../Library/CpuExceptionHandlerLib/SmmException.c | 7 +-
> .../X64/ArchExceptionHandler.c | 57 ++++++++++------
> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 18 ++----
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 37 +----------
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 4 +-
> UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 6 +-
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 18 ++----
> 19 files changed, 265 insertions(+), 247 deletions(-)
>
> --
> 2.9.3.windows.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/9] Export Dump CPU Context service
2017-04-07 0:41 ` [PATCH 0/9] Export Dump CPU Context service Yao, Jiewen
@ 2017-04-07 0:46 ` Fan, Jeff
2017-04-07 0:50 ` Yao, Jiewen
0 siblings, 1 reply; 13+ messages in thread
From: Fan, Jeff @ 2017-04-07 0:46 UTC (permalink / raw)
To: Yao, Jiewen, edk2-devel@lists.01.org; +Cc: Kinney, Michael D, Tian, Feng
Jiewen,
That's fine. If you consider the patch based on module for this case is better your review, I will combine some of them soon.
Thanks!
Jeff
From: Yao, Jiewen
Sent: Friday, April 07, 2017 8:41 AM
To: Fan, Jeff; edk2-devel@lists.01.org
Cc: Kinney, Michael D; Tian, Feng
Subject: RE: [PATCH 0/9] Export Dump CPU Context service
Hi
I do not think it is necessary to split this simple patch to so many.
It brings burden to me to review the change. For example, there are 4 patches for CpuExceptionHandlerLib.
Can we combine the patch based upon the module?
Thank you
Yao Jiewen
> -----Original Message-----
> From: Fan, Jeff
> Sent: Saturday, April 1, 2017 9:25 PM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Kinney, Michael D
> <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Tian, Feng <feng.tian@intel.com<mailto:feng.tian@intel.com>>
> Subject: [PATCH 0/9] Export Dump CPU Context service
>
> This serial of patches are:
> 1. Export PeCoffSerachImageBase() that could serach PE/COFF image base.
> 2. Export DumpCpuContext that could dump CPU context when exception
> happened.
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=242
>
> Cc: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>
> Cc: Michael Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
> Cc: Feng Tian <feng.tian@intel.com<mailto:feng.tian@intel.com>>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Fan <jeff.fan@intel.com<mailto:jeff.fan@intel.com>>
>
> Jeff Fan (9):
> MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase()
> MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext()
> UefiCpuPkg/CpuExceptionHandlerLib: Rename internal DumpCpuContent()
> UefiCpuPkg/CpuExceptionHandlerLib: Add DumpModuleImageInfo()
> UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext()
> implementation
> UefiCpuPkg/CpuExceptionHandlerLib: Display PF Excption Data bit
> UefiCpuPkg/PiSmmCpuDxeSmm: Consume PeCoffSerachImageBase()
> UefiCpuPkg/PiSmmCpuDxeSmm: Consume DumpCpuContext()
> SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()
>
> .../Include/Library/CpuExceptionHandlerLib.h | 15 ++++-
> .../CpuExceptionHandlerLibNull.c | 16 ++++-
> MdePkg/Include/Library/PeCoffGetEntryPointLib.h | 20 +++++-
> .../PeCoffGetEntryPoint.c | 72
> ++++++++++++++++++++-
> .../DebugAgent/DebugAgentCommon/DebugAgent.c | 50 ++-------------
> .../CpuExceptionHandlerLib/CpuExceptionCommon.c | 75
> ++++++----------------
> .../CpuExceptionHandlerLib/CpuExceptionCommon.h | 27 +++++---
> .../Library/CpuExceptionHandlerLib/DxeException.c | 7 +-
> .../Ia32/ArchExceptionHandler.c | 65
> ++++++++++++-------
> .../CpuExceptionHandlerLib/PeiCpuException.c | 6 +-
> .../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c | 4 +-
> .../CpuExceptionHandlerLib/SecPeiCpuException.c | 8 +--
> .../Library/CpuExceptionHandlerLib/SmmException.c | 7 +-
> .../X64/ArchExceptionHandler.c | 57 ++++++++++------
> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 18 ++----
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 37 +----------
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 4 +-
> UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 6 +-
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 18 ++----
> 19 files changed, 265 insertions(+), 247 deletions(-)
>
> --
> 2.9.3.windows.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/9] Export Dump CPU Context service
2017-04-07 0:46 ` Fan, Jeff
@ 2017-04-07 0:50 ` Yao, Jiewen
0 siblings, 0 replies; 13+ messages in thread
From: Yao, Jiewen @ 2017-04-07 0:50 UTC (permalink / raw)
To: Fan, Jeff, edk2-devel@lists.01.org; +Cc: Kinney, Michael D, Tian, Feng
Thank you!
From: Fan, Jeff
Sent: Friday, April 7, 2017 8:46 AM
To: Yao, Jiewen <jiewen.yao@intel.com>; edk2-devel@lists.01.org
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Tian, Feng <feng.tian@intel.com>
Subject: RE: [PATCH 0/9] Export Dump CPU Context service
Jiewen,
That's fine. If you consider the patch based on module for this case is better your review, I will combine some of them soon.
Thanks!
Jeff
From: Yao, Jiewen
Sent: Friday, April 07, 2017 8:41 AM
To: Fan, Jeff; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Kinney, Michael D; Tian, Feng
Subject: RE: [PATCH 0/9] Export Dump CPU Context service
Hi
I do not think it is necessary to split this simple patch to so many.
It brings burden to me to review the change. For example, there are 4 patches for CpuExceptionHandlerLib.
Can we combine the patch based upon the module?
Thank you
Yao Jiewen
> -----Original Message-----
> From: Fan, Jeff
> Sent: Saturday, April 1, 2017 9:25 PM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Kinney, Michael D
> <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Tian, Feng <feng.tian@intel.com<mailto:feng.tian@intel.com>>
> Subject: [PATCH 0/9] Export Dump CPU Context service
>
> This serial of patches are:
> 1. Export PeCoffSerachImageBase() that could serach PE/COFF image base.
> 2. Export DumpCpuContext that could dump CPU context when exception
> happened.
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=242
>
> Cc: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>
> Cc: Michael Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
> Cc: Feng Tian <feng.tian@intel.com<mailto:feng.tian@intel.com>>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Fan <jeff.fan@intel.com<mailto:jeff.fan@intel.com>>
>
> Jeff Fan (9):
> MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase()
> MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext()
> UefiCpuPkg/CpuExceptionHandlerLib: Rename internal DumpCpuContent()
> UefiCpuPkg/CpuExceptionHandlerLib: Add DumpModuleImageInfo()
> UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext()
> implementation
> UefiCpuPkg/CpuExceptionHandlerLib: Display PF Excption Data bit
> UefiCpuPkg/PiSmmCpuDxeSmm: Consume PeCoffSerachImageBase()
> UefiCpuPkg/PiSmmCpuDxeSmm: Consume DumpCpuContext()
> SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()
>
> .../Include/Library/CpuExceptionHandlerLib.h | 15 ++++-
> .../CpuExceptionHandlerLibNull.c | 16 ++++-
> MdePkg/Include/Library/PeCoffGetEntryPointLib.h | 20 +++++-
> .../PeCoffGetEntryPoint.c | 72
> ++++++++++++++++++++-
> .../DebugAgent/DebugAgentCommon/DebugAgent.c | 50 ++-------------
> .../CpuExceptionHandlerLib/CpuExceptionCommon.c | 75
> ++++++----------------
> .../CpuExceptionHandlerLib/CpuExceptionCommon.h | 27 +++++---
> .../Library/CpuExceptionHandlerLib/DxeException.c | 7 +-
> .../Ia32/ArchExceptionHandler.c | 65
> ++++++++++++-------
> .../CpuExceptionHandlerLib/PeiCpuException.c | 6 +-
> .../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c | 4 +-
> .../CpuExceptionHandlerLib/SecPeiCpuException.c | 8 +--
> .../Library/CpuExceptionHandlerLib/SmmException.c | 7 +-
> .../X64/ArchExceptionHandler.c | 57 ++++++++++------
> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 18 ++----
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 37 +----------
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 4 +-
> UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 6 +-
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 18 ++----
> 19 files changed, 265 insertions(+), 247 deletions(-)
>
> --
> 2.9.3.windows.2
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-04-07 0:50 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-01 13:25 [PATCH 0/9] Export Dump CPU Context service Jeff Fan
2017-04-01 13:25 ` [PATCH 1/9] MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase() Jeff Fan
2017-04-01 13:25 ` [PATCH 2/9] MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext() Jeff Fan
2017-04-01 13:25 ` [PATCH 3/9] UefiCpuPkg/CpuExceptionHandlerLib: Rename internal DumpCpuContent() Jeff Fan
2017-04-01 13:25 ` [PATCH 4/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpModuleImageInfo() Jeff Fan
2017-04-01 13:25 ` [PATCH 5/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation Jeff Fan
2017-04-01 13:25 ` [PATCH 6/9] UefiCpuPkg/CpuExceptionHandlerLib: Display PF Excption Data bit Jeff Fan
2017-04-01 13:25 ` [PATCH 7/9] UefiCpuPkg/PiSmmCpuDxeSmm: Consume PeCoffSerachImageBase() Jeff Fan
2017-04-01 13:25 ` [PATCH 8/9] UefiCpuPkg/PiSmmCpuDxeSmm: Consume DumpCpuContext() Jeff Fan
2017-04-01 13:25 ` [PATCH 9/9] SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase() Jeff Fan
2017-04-07 0:41 ` [PATCH 0/9] Export Dump CPU Context service Yao, Jiewen
2017-04-07 0:46 ` Fan, Jeff
2017-04-07 0:50 ` Yao, Jiewen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox