summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2007-03-19 09:05:41 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2007-03-19 09:05:41 +0000
commitb06af5d71ec9fc353b9433a26fc55d14077f7cde (patch)
tree3fe4148444f15d2845b75d754708cd48fecf8c76
parent4bdeaa6bb4c8b0ed211fe26ff808f7fa4c505600 (diff)
downloadedk2-b06af5d71ec9fc353b9433a26fc55d14077f7cde.zip
edk2-b06af5d71ec9fc353b9433a26fc55d14077f7cde.tar.gz
edk2-b06af5d71ec9fc353b9433a26fc55d14077f7cde.tar.bz2
Change the EfiAquireLock with RaiseTPL as the call to Boot Service UnloadImage can be nested in another call to UnloadImage. So RaiseTPL is proper (EfiAcquireLock will ASSERT when these this API are nested in the call chain) in this situation to server the sychronization purposes.
The same change has been done to Boot Service Exit with the same reason applied. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2486 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--EdkModulePkg/Core/Dxe/Image/Image.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/EdkModulePkg/Core/Dxe/Image/Image.c b/EdkModulePkg/Core/Dxe/Image/Image.c
index f1b2c7a..3696400 100644
--- a/EdkModulePkg/Core/Dxe/Image/Image.c
+++ b/EdkModulePkg/Core/Dxe/Image/Image.c
@@ -24,9 +24,6 @@ Abstract:
// Module Globals
//
-EFI_LOCK mBsExitLock = EFI_INITIALIZE_LOCK_VARIABLE(EFI_TPL_NOTIFY);
-EFI_LOCK mBsUnloadImageLock = EFI_INITIALIZE_LOCK_VARIABLE(EFI_TPL_NOTIFY);
-
LOADED_IMAGE_PRIVATE_DATA *mCurrentImage = NULL;
LOAD_PE32_IMAGE_PRIVATE_DATA mLoadPe32PrivateData = {
@@ -1221,9 +1218,14 @@ Returns:
--*/
{
LOADED_IMAGE_PRIVATE_DATA *Image;
+ EFI_TPL OldTpl;
- EfiAcquireLock (&mBsExitLock);
-
+ //
+ // Prevent possible reentrance to this function
+ // for the same ImageHandle
+ //
+ OldTpl = CoreRaiseTpl (EFI_TPL_NOTIFY);
+
Image = CoreLoadedImageInfo (ImageHandle);
if (Image == NULL_HANDLE) {
Status = EFI_INVALID_PARAMETER;
@@ -1266,7 +1268,7 @@ Returns:
CopyMem (Image->ExitData, ExitData, Image->ExitDataSize);
}
- EfiReleaseLock (&mBsExitLock);
+ CoreRestoreTpl (OldTpl);
//
// return to StartImage
//
@@ -1278,7 +1280,7 @@ Returns:
ASSERT (FALSE);
Status = EFI_ACCESS_DENIED;
Done:
- EfiReleaseLock (&mBsExitLock);
+ CoreRestoreTpl (OldTpl);
return Status;
}
@@ -1309,9 +1311,14 @@ Returns:
{
EFI_STATUS Status;
LOADED_IMAGE_PRIVATE_DATA *Image;
+ EFI_TPL OldTpl;
- EfiAcquireLock (&mBsUnloadImageLock);
-
+ //
+ // Prevent possible reentrance to this function
+ // for the same ImageHandle
+ //
+ OldTpl = CoreRaiseTpl (EFI_TPL_NOTIFY);
+
Image = CoreLoadedImageInfo (ImageHandle);
if (Image == NULL ) {
//
@@ -1346,7 +1353,7 @@ Returns:
}
Done:
- EfiReleaseLock (&mBsUnloadImageLock);
+ CoreRestoreTpl (OldTpl);
return Status;
}