On 2016/3/4 11:15, El-Haj-Mahmoud, Samer wrote:
Star,

It has been a while since I have seen this, so I will need to go back to some 
old notes to get the details.. But I am pretty sure we didn't see the ASSERT 
below. The code ended up accessing gBds which was NULL and causing an exception.

Let me know if you want me to dig through the details.

If that, the BDS ARCH PROTOCOL installed must have been installed, but with NULL instance, or with ->Entry interface == NULL. That means the debug log is wrong with ""EFI_BDS_ARCH_PROTOCOL was not installed.\n", and how about to update the code like below?

//
// Ensure BDS ARCH PROTOCOL installed correctly.
//
ASSERT ((gBds != NULL) && (gBds->Entry != NULL));

And update the title like below?

MdeModulePkg DxeCore: Add ASSERT check to ensure BDS ARCH PROTO installed correctly

Thanks,
Star


Thanks,
--Samer

-----Original Message-----
From: Zeng, Star [mailto:star.z...@intel.com]
Sent: Thursday, March 3, 2016 8:25 PM
To: El-Haj-Mahmoud, Samer <samer.el-haj-mahm...@hpe.com>; 
edk2-devel@lists.01.org
Cc: El-Haj-Mahmoud, Samer <samer.el-haj-mahm...@hpe.com>; feng.t...@intel.com
Subject: Re: [edk2] [PATCH] MdeModulePkg: Add DEBUG and ASSERT on failed BDS 
entry

Samer,

Was your code not asserted at below if BDS ARCH PROTOCOL not installed?

    //
    // Assert if the Architectural Protocols are not present.
    //
    Status = CoreAllEfiServicesAvailable ();
    if (EFI_ERROR(Status)) {
      //
      // Report Status code that some Architectural Protocols are not present.
      //
      REPORT_STATUS_CODE (
        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
        (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH)
        );
    }
*  ASSERT_EFI_ERROR (Status);*


Thanks,
Star

On 2016/3/4 9:43, Samer El-Haj-Mahmoud wrote:
Add a DEBUG message and ASSERT if gBds is NULL before entering BDS. This
helps in debugging issues with EFI_BDS_ARC_PROTOCOL not getting
installed because of bad dependencies.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <el...@hpe.com>
---
   MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 7 +++++++
   1 file changed, 7 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index 0a34711..b08871f 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -2,6 +2,7 @@
     DXE Core Main Entry Point

   Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
@@ -508,6 +509,12 @@ DxeMain (
     //
     // Transfer control to the BDS Architectural Protocol
     //
+
+  if ((gBds == NULL) || (gBds->Entry == NULL)) {
+    DEBUG((DEBUG_ERROR, "EFI_BDS_ARCH_PROTOCOL was not installed.\n"));
+    ASSERT (FALSE);
+  }
+
     gBds->Entry (gBds);

     //


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

Reply via email to