[edk2-devel] [PATCH 2/2] MdeModulePkg: Move CPU_EXCEPTION_INIT_DATA to UefiCpuPkg

Zhiguang Liu zhiguang.liu at intel.com
Fri Jul 22 07:57:37 UTC 2022


Since the API InitializeSeparateExceptionStacks is simplified and does't
use the struct CPU_EXCEPTION_INIT_DATA, CPU_EXCEPTION_INIT_DATA become
a inner implementation of CpuExcetionHandlerLib. Remove it from
MdeModulePkg. Also, two fields (Revision and InitDefaultHandlers)are
useless, can be removed.

Cc: Eric Dong <eric.dong at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Cc: Rahul Kumar <rahul1.kumar at intel.com>
Cc: Leif Lindholm <quic_llindhol at quicinc.com>
Cc: Dandan Bi <dandan.bi at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang at intel.com>
Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Sami Mujawar <sami.mujawar at arm.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu at intel.com>
---
 .../Include/Library/CpuExceptionHandlerLib.h  | 67 -------------------
 .../CpuExceptionCommon.h                      | 59 +++++++++++++++-
 2 files changed, 58 insertions(+), 68 deletions(-)

diff --git a/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h b/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
index 8d44ed916a..94e9b20ae1 100644
--- a/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
+++ b/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
@@ -13,73 +13,6 @@
 #include <Ppi/VectorHandoffInfo.h>
 #include <Protocol/Cpu.h>
 
-#define CPU_EXCEPTION_INIT_DATA_REV  1
-
-typedef union {
-  struct {
-    //
-    // Revision number of this structure.
-    //
-    UINT32     Revision;
-    //
-    // The address of top of known good stack reserved for *ALL* exceptions
-    // listed in field StackSwitchExceptions.
-    //
-    UINTN      KnownGoodStackTop;
-    //
-    // The size of known good stack for *ONE* exception only.
-    //
-    UINTN      KnownGoodStackSize;
-    //
-    // Buffer of exception vector list for stack switch.
-    //
-    UINT8      *StackSwitchExceptions;
-    //
-    // Number of exception vectors in StackSwitchExceptions.
-    //
-    UINTN      StackSwitchExceptionNumber;
-    //
-    // Buffer of IDT table. It must be type of IA32_IDT_GATE_DESCRIPTOR.
-    // Normally there's no need to change IDT table size.
-    //
-    VOID       *IdtTable;
-    //
-    // Size of buffer for IdtTable.
-    //
-    UINTN      IdtTableSize;
-    //
-    // Buffer of GDT table. It must be type of IA32_SEGMENT_DESCRIPTOR.
-    //
-    VOID       *GdtTable;
-    //
-    // Size of buffer for GdtTable.
-    //
-    UINTN      GdtTableSize;
-    //
-    // Pointer to start address of descriptor of exception task gate in the
-    // GDT table. It must be type of IA32_TSS_DESCRIPTOR.
-    //
-    VOID       *ExceptionTssDesc;
-    //
-    // Size of buffer for ExceptionTssDesc.
-    //
-    UINTN      ExceptionTssDescSize;
-    //
-    // Buffer of task-state segment for exceptions. It must be type of
-    // IA32_TASK_STATE_SEGMENT.
-    //
-    VOID       *ExceptionTss;
-    //
-    // Size of buffer for ExceptionTss.
-    //
-    UINTN      ExceptionTssSize;
-    //
-    // Flag to indicate if default handlers should be initialized or not.
-    //
-    BOOLEAN    InitDefaultHandlers;
-  } Ia32, X64;
-} CPU_EXCEPTION_INIT_DATA;
-
 /**
   Initializes all CPU exceptions entries and provides the default exception handlers.
 
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
index 0f012bccde..a42e19b54a 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 - 2019, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -49,6 +49,63 @@
 
 #define CPU_TSS_GDT_SIZE  (SIZE_2KB + CPU_TSS_DESC_SIZE + CPU_TSS_SIZE)
 
+typedef union {
+  struct {
+    //
+    // The address of top of known good stack reserved for *ALL* exceptions
+    // listed in field StackSwitchExceptions.
+    //
+    UINTN    KnownGoodStackTop;
+    //
+    // The size of known good stack for *ONE* exception only.
+    //
+    UINTN    KnownGoodStackSize;
+    //
+    // Buffer of exception vector list for stack switch.
+    //
+    UINT8    *StackSwitchExceptions;
+    //
+    // Number of exception vectors in StackSwitchExceptions.
+    //
+    UINTN    StackSwitchExceptionNumber;
+    //
+    // Buffer of IDT table. It must be type of IA32_IDT_GATE_DESCRIPTOR.
+    // Normally there's no need to change IDT table size.
+    //
+    VOID     *IdtTable;
+    //
+    // Size of buffer for IdtTable.
+    //
+    UINTN    IdtTableSize;
+    //
+    // Buffer of GDT table. It must be type of IA32_SEGMENT_DESCRIPTOR.
+    //
+    VOID     *GdtTable;
+    //
+    // Size of buffer for GdtTable.
+    //
+    UINTN    GdtTableSize;
+    //
+    // Pointer to start address of descriptor of exception task gate in the
+    // GDT table. It must be type of IA32_TSS_DESCRIPTOR.
+    //
+    VOID     *ExceptionTssDesc;
+    //
+    // Size of buffer for ExceptionTssDesc.
+    //
+    UINTN    ExceptionTssDescSize;
+    //
+    // Buffer of task-state segment for exceptions. It must be type of
+    // IA32_TASK_STATE_SEGMENT.
+    //
+    VOID     *ExceptionTss;
+    //
+    // Size of buffer for ExceptionTss.
+    //
+    UINTN    ExceptionTssSize;
+  } Ia32, X64;
+} CPU_EXCEPTION_INIT_DATA;
+
 //
 // Record exception handler information
 //
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91691): https://edk2.groups.io/g/devel/message/91691
Mute This Topic: https://groups.io/mt/92543321/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list