mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
PiDxeS3BootScriptLib has a constructor S3BootScriptLibInitialize() that
registers ready-to-lock callback S3BootScriptSmmEventCallBack() and several
more. The library is linked to SMM modules. If the module entry-point
function returns error (because of lack of resources, unsupported,
whatever), the module will be unloaded and the notify callback pointers
will point to undefined memory. On ready-to-lock exception occurs when
calling S3BootScriptSmmEventCallBack(), and probably all the other
callbacks registered by the constructor would also cause exception.
This patch is to implement library Destructor to free the resources
allocated by S3BootScriptLibInitialize() and unregister callbacks.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit cfd79783d6)
74 lines
2.3 KiB
INI
74 lines
2.3 KiB
INI
## @file
|
|
# DXE S3 boot script Library.
|
|
#
|
|
# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<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
|
|
# http://opensource.org/licenses/bsd-license.php
|
|
#
|
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
#
|
|
##
|
|
|
|
[Defines]
|
|
INF_VERSION = 0x00010005
|
|
BASE_NAME = DxeS3BootScriptLib
|
|
MODULE_UNI_FILE = DxeS3BootScriptLib.uni
|
|
FILE_GUID = 57F9967B-26CD-4262-837A-55B8AA158254
|
|
MODULE_TYPE = DXE_DRIVER
|
|
VERSION_STRING = 1.0
|
|
LIBRARY_CLASS = S3BootScriptLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
|
|
|
|
|
|
CONSTRUCTOR = S3BootScriptLibInitialize
|
|
DESTRUCTOR = S3BootScriptLibDeinitialize
|
|
|
|
#
|
|
# The following information is for reference only and not required by the build tools.
|
|
#
|
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
|
#
|
|
|
|
[Sources]
|
|
BootScriptSave.c
|
|
BootScriptExecute.c
|
|
InternalBootScriptLib.h
|
|
BootScriptInternalFormat.h
|
|
|
|
|
|
[Packages]
|
|
MdePkg/MdePkg.dec
|
|
MdeModulePkg/MdeModulePkg.dec
|
|
|
|
[LibraryClasses]
|
|
UefiBootServicesTableLib
|
|
BaseLib
|
|
BaseMemoryLib
|
|
TimerLib
|
|
DebugLib
|
|
PcdLib
|
|
UefiLib
|
|
SmbusLib
|
|
PciLib
|
|
IoLib
|
|
LockBoxLib
|
|
|
|
[Protocols]
|
|
gEfiSmmBase2ProtocolGuid ## SOMETIMES_CONSUMES
|
|
gEfiDxeSmmReadyToLockProtocolGuid ## NOTIFY
|
|
gEfiSmmReadyToLockProtocolGuid ## NOTIFY
|
|
gEdkiiSmmExitBootServicesProtocolGuid ## NOTIFY
|
|
gEdkiiSmmLegacyBootProtocolGuid ## NOTIFY
|
|
|
|
[Pcd]
|
|
## CONSUMES
|
|
## SOMETIMES_PRODUCES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateDataPtr
|
|
## CONSUMES
|
|
## SOMETIMES_PRODUCES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateSmmDataPtr
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptRuntimeTableReservePageNumber ## CONSUMES
|
|
|