public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhiguang Liu" <zhiguang.liu@intel.com>
To: devel@edk2.groups.io
Cc: Zhiguang Liu <zhiguang.liu@intel.com>,
	Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
	Rahul Kumar <rahul1.kumar@intel.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Dandan Bi <dandan.bi@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Jian J Wang <jian.j.wang@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>
Subject: [PATCH 2/2] MdeModulePkg: Move CPU_EXCEPTION_INIT_DATA to UefiCpuPkg
Date: Fri, 22 Jul 2022 15:57:37 +0800	[thread overview]
Message-ID: <20220722075737.897-3-zhiguang.liu@intel.com> (raw)
In-Reply-To: <20220722075737.897-1-zhiguang.liu@intel.com>

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@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@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


      parent reply	other threads:[~2022-07-22  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22  7:57 [PATCH 0/2] Simplify InitializeSeparateExceptionStacks Zhiguang Liu
2022-07-22  7:57 ` [PATCH 1/2] UefiCpuPkg: " Zhiguang Liu
2022-07-22 10:48   ` Sami Mujawar
2022-08-04  5:37   ` Ni, Ray
2022-07-22  7:57 ` Zhiguang Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220722075737.897-3-zhiguang.liu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox