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>
\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
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