]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/UefiDebugLibConOut: Add destructor to CloseEvent
authorXu, Wei6 <wei6.xu@intel.com>
Fri, 26 Jul 2019 03:10:53 +0000 (11:10 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 29 Jul 2019 03:01:37 +0000 (11:01 +0800)
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>
MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf

index 80053703724f615d548aca819bd3d7e939fbe0a3..ed73f92818743454d702b836e6704ba646223aeb 100644 (file)
@@ -75,3 +75,26 @@ DxeDebugLibConstructor(
 \r
   return EFI_SUCCESS;\r
 }\r
+\r
+/**\r
+  The destructor closes Exit Boot Services Event.\r
+\r
+  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
+  @param  SystemTable   A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS   The destructor always returns EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DxeDebugLibDestructor(\r
+  IN EFI_HANDLE                 ImageHandle,\r
+  IN EFI_SYSTEM_TABLE           *SystemTable\r
+  )\r
+{\r
+  if (mExitBootServicesEvent != NULL) {\r
+    SystemTable->BootServices->CloseEvent (mExitBootServicesEvent);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
index 4c279a5bf2f90211da35199c174d76a795cacf51..b577d52ac66ba1c61e59a83f4417d1ad5547125d 100644 (file)
@@ -22,6 +22,7 @@
   LIBRARY_CLASS                  = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER\r
 \r
   CONSTRUCTOR                    = DxeDebugLibConstructor\r
+  DESTRUCTOR                     = DxeDebugLibDestructor\r
 \r
 #\r
 #  VALID_ARCHITECTURES           = IA32 X64 EBC\r