Hi Ray,

Thank you for this patch.

I have one minor suggestion marked inline as [SAMI], otherwise this patch looks good to me.

With that updated.

Reviewed-by: Sami Mujawar <[email protected]>

Regards,

Sami Mujawar

On 13/06/2022 04:39 am, Ray Ni wrote:
CpuExceptionHandlerLib has been refactored with following changes:
1. Removed InitializeCpuInterruptHandlers in 2a09527ebcb459b40
2. Removed InitializeCpuExceptionHandlersEx and
    added InitializeSeparateExceptionStacks in e7abb94d1fb8a0e7

The patch updates ARM version of CpuExceptionHandlerLib to follow
the API changes.

The functionality to ARM platforms should be none.

Signed-off-by: Ray Ni<[email protected]>
Cc: Leif Lindholm<[email protected]>
Cc: Ard Biesheuvel<[email protected]>
Cc: Sami Mujawar<[email protected]>
---
  .../Library/ArmExceptionLib/ArmExceptionLib.c | 58 ++++---------------
  1 file changed, 11 insertions(+), 47 deletions(-)

diff --git a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c 
b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
index 1904816c16..2c7bc66aa7 100644
--- a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
+++ b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
@@ -4,6 +4,7 @@
  *  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>

  *  Copyright (c) 2011-2021, Arm Limited. All rights reserved.<BR>

  *  Copyright (c) 2016 HP Development Company, L.P.

+*  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>

  *

  *  SPDX-License-Identifier: BSD-2-Clause-Patent

  *

@@ -194,32 +195,6 @@ CopyExceptionHandlers (
    return RETURN_SUCCESS;

  }

-/**

-Initializes all CPU interrupt/exceptions entries and provides the default 
interrupt/exception handlers.

-

-Caller should try to get an array of interrupt and/or exception vectors that 
are in use and need to

-persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.

-If caller cannot get reserved vector list or it does not exists, set 
VectorInfo to NULL.

-If VectorInfo is not NULL, the exception vectors will be initialized per 
vector attribute accordingly.

-

-@param[in]  VectorInfo    Pointer to reserved vector list.

-

-@retval EFI_SUCCESS           All CPU interrupt/exception entries have been 
successfully initialized

-with default interrupt/exception handlers.

-@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if 
VectorInfo is not NULL.

-@retval EFI_UNSUPPORTED       This function is not supported.

-

-**/

-EFI_STATUS

-EFIAPI

-InitializeCpuInterruptHandlers (

-  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL

-  )

-{

-  // not needed, this is what the CPU driver is for

-  return EFI_UNSUPPORTED;

-}

-

  /**

  Registers a function to be called from the processor exception handler. (On 
ARM/AArch64 this only

  provides exception handlers, not interrupt handling which is provided through 
the Hardware Interrupt

@@ -229,8 +204,8 @@ This function registers and enables the handler specified 
by ExceptionHandler fo
  interrupt or exception type specified by ExceptionType. If ExceptionHandler 
is NULL, then the

  handler for the processor interrupt or exception type specified by 
ExceptionType is uninstalled.

  The installed handler is called once for each processor interrupt or 
exception.

-NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or

-InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.

+NOTE: This function should be invoked after InitializeCpuExceptionHandlers() 
is invoked,

+otherwise EFI_UNSUPPORTED returned.

  @param[in]  ExceptionType     Defines which interrupt or exception to hook.

  @param[in]  ExceptionHandler  A pointer to a function of type 
EFI_CPU_INTERRUPT_HANDLER that is called

@@ -312,33 +287,22 @@ CommonCExceptionHandler (
  }

  /**

-  Initializes all CPU exceptions entries with optional extra initializations.

-

-  By default, this method should include all functionalities implemented by

-  InitializeCpuExceptionHandlers(), plus extra initialization works, if any.

-  This could be done by calling InitializeCpuExceptionHandlers() directly

-  in this method besides the extra works.

+  Setup separate stacks for certain exception handlers.

-  InitData is optional and its use and content are processor arch dependent.

-  The typical usage of it is to convey resources which have to be reserved

-  elsewhere and are necessary for the extra initializations of exception.

+  InitData is optional and processor arch dependent.

-  @param[in]  VectorInfo    Pointer to reserved vector list.

-  @param[in]  InitData      Pointer to data optional for extra initializations

-                            of exception.

+  @param[in]  InitData      Pointer to data optional for information about how

+                            to assign stacks for certain exception handlers.

-  @retval EFI_SUCCESS             The exceptions have been successfully

-                                  initialized.

-  @retval EFI_INVALID_PARAMETER   VectorInfo or InitData contains invalid

-                                  content.

+  @retval EFI_SUCCESS             The stacks are assigned successfully.

+  @retval EFI_UNSUPPORTED         This function is not supported.

  **/

  EFI_STATUS

  EFIAPI

-InitializeCpuExceptionHandlersEx (

-  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL,

+InitializeSeparateExceptionStacks (

    IN CPU_EXCEPTION_INIT_DATA  *InitData OPTIONAL

    )

  {

-  return InitializeCpuExceptionHandlers (VectorInfo);

+  return EFI_SUCCESS;

[SAMI] I think this function should return EFI_UNSUPPORTED. Doing this should not impact the functionality as PcdCpuStackGuard is not enabled on Arm.

So, your patch [PATCH 2/2] DxeMain: Fix the bug that StackGuard is not enabled <https://edk2.groups.io/g/devel/topic/patch_2_2_dxemain_fix_the/91719888?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,91719888,previd%3D1655113540627857877,nextid%3D1655040814392344888&previd=1655113540627857877&nextid=1655040814392344888> () does take care of this.

[/SAMI]


  }



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90484): https://edk2.groups.io/g/devel/message/90484
Mute This Topic: https://groups.io/mt/91719887/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to