[edk2] [PATCH 5/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation

Jeff Fan posted 9 patches 7 years, 7 months ago
Only 8 patches received!
There is a newer version of this series
[edk2] [PATCH 5/9] UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation
Posted by Jeff Fan 7 years, 7 months ago
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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel