diff options
author | Xu, Wei6 <wei6.xu@intel.com> | 2019-07-26 11:10:55 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2019-07-29 11:01:43 +0800 |
commit | 28bc6992400d56351d36b26f0841fbfcb1ea2fd4 (patch) | |
tree | 13d1db5ac0482977bb0b5f92ad679e5341c69a56 /MdePkg | |
parent | 0f4b77f5b2efe4de8694c02c1cead7418595f1cb (diff) | |
download | edk2-28bc6992400d56351d36b26f0841fbfcb1ea2fd4.tar.gz edk2-28bc6992400d56351d36b26f0841fbfcb1ea2fd4.tar.bz2 edk2-28bc6992400d56351d36b26f0841fbfcb1ea2fd4.zip |
MdePkg/UefiDebugLibStdErr: Add destructor to CloseEvent
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2012
When driver is unloaded, the ExitBootSerivesEvent must be closed at
the same time. Otherwise exception will occur when ExitBootServices.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c | 23 | ||||
-rw-r--r-- | MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c index 8005370372..ed73f92818 100644 --- a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c +++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c @@ -75,3 +75,26 @@ DxeDebugLibConstructor( return EFI_SUCCESS;
}
+
+/**
+ The destructor closes Exit Boot Services Event.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeDebugLibDestructor(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ if (mExitBootServicesEvent != NULL) {
+ SystemTable->BootServices->CloseEvent (mExitBootServicesEvent);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf b/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf index deaa3427f6..11f7594626 100644 --- a/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf +++ b/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf @@ -22,6 +22,7 @@ LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
CONSTRUCTOR = DxeDebugLibConstructor
+ DESTRUCTOR = DxeDebugLibDestructor
#
# VALID_ARCHITECTURES = IA32 X64 EBC
|