MdePkg/UefidebugLibConOut: Make it runtime safe

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1416

After ExitBootServices, some pointer would be invalid such as
the Protocol pointer and gST. The function depend on those should
be prevent. So disable the related function while after
ExitBootServices.
Change the gST to a internal one, because there will be a cycle
consume between UefiBootServicesTableLib and DebugLib due to the
library constructors.
Also remove the SMM support for this instance.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Aaron Antone
2019-04-08 11:00:28 +08:00
committed by Liming Gao
parent 2b5778c68b
commit 452702d0bc
3 changed files with 141 additions and 52 deletions

View File

@@ -3,7 +3,9 @@
#
# Debug Lib that sends messages to the Console Output Device in the EFI System Table.
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2018, Microsoft Corporation
#
# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -17,8 +19,9 @@
FILE_GUID = 5cddfaf3-e9a7-4d16-bdce-1e002df475bb
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
CONSTRUCTOR = DxeDebugLibConstructor
#
# VALID_ARCHITECTURES = IA32 X64 EBC
@@ -27,6 +30,7 @@
[Sources]
DebugLib.c
DebugLibConstructor.c
@@ -39,9 +43,11 @@
BaseLib
PcdLib
PrintLib
UefiBootServicesTableLib
DebugPrintErrorLevelLib
[Guids]
gEfiEventExitBootServicesGuid ## CONSUMES
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES