diff options
-rw-r--r-- | Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c | 35 | ||||
-rw-r--r-- | Nt32Pkg/Library/PeiNt32PeCoffExtraActionLib/PeiNt32PeCoffExtraActionLib.c | 32 |
2 files changed, 34 insertions, 33 deletions
diff --git a/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c b/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c index ff5028d4a8..ef46107742 100644 --- a/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c +++ b/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c @@ -250,15 +250,14 @@ RemoveModeHandle ( }
/**
- Applies additional actions to relocate fixups to a PE/COFF image.
+ Performs additional actions after a PE/COFF image has been loaded and relocated.
- Generally this function is called after sucessfully Applying relocation fixups
- to a PE/COFF image for some specicial purpose.
- As a example, For NT32 emulator, the function should be implemented and called
- to support source level debug.
-
- @param ImageContext Pointer to the image context structure that describes the PE/COFF
- image that is being relocated.
+ For NT32, this function load symbols to support source level debugging.
+
+ If ImageContext is NULL, then ASSERT().
+
+ @param ImageContext Pointer to the image context structure that describes the
+ PE/COFF image that has already been loaded and relocated.
**/
VOID
@@ -271,7 +270,9 @@ PeCoffLoaderRelocateImageExtraAction ( CHAR16 *DllFileName;
HMODULE Library;
UINTN Index;
-
+
+ ASSERT (ImageContext != NULL);
+
//
// If we load our own PE COFF images the Windows debugger can not source
// level debug our code. If a valid PDB pointer exists usw it to load
@@ -351,17 +352,15 @@ PeCoffLoaderRelocateImageExtraAction ( }
/**
- Unloads a loaded PE/COFF image from memory and releases its taken resource.
-
- Releases any environment specific resources that were allocated when the image
- specified by ImageContext was loaded using PeCoffLoaderLoadImage().
- For NT32 emulator, the PE/COFF image loaded by system needs to release.
- For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded,
+ Performs additional actions just before a PE/COFF image is unloaded. Any resources
+ that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
+ For NT32, this function unloads symbols for source level debugging.
+
If ImageContext is NULL, then ASSERT().
- @param ImageContext Pointer to the image context structure that describes the PE/COFF
- image to be unloaded.
+ @param ImageContext Pointer to the image context structure that describes the
+ PE/COFF image that is being unloaded.
**/
VOID
@@ -372,6 +371,8 @@ PeCoffLoaderUnloadImageExtraAction ( {
VOID *ModHandle;
+ ASSERT (ImageContext != NULL);
+
ModHandle = RemoveModeHandle (ImageContext);
if (ModHandle != NULL) {
mWinNt->FreeLibrary (ModHandle);
diff --git a/Nt32Pkg/Library/PeiNt32PeCoffExtraActionLib/PeiNt32PeCoffExtraActionLib.c b/Nt32Pkg/Library/PeiNt32PeCoffExtraActionLib/PeiNt32PeCoffExtraActionLib.c index e491bf3a10..d3ac3ae183 100644 --- a/Nt32Pkg/Library/PeiNt32PeCoffExtraActionLib/PeiNt32PeCoffExtraActionLib.c +++ b/Nt32Pkg/Library/PeiNt32PeCoffExtraActionLib/PeiNt32PeCoffExtraActionLib.c @@ -126,15 +126,14 @@ AsciiToUnicode ( }
/**
- Applies additional actions to relocate fixups to a PE/COFF image.
+ Performs additional actions after a PE/COFF image has been loaded and relocated.
- Generally this function is called after sucessfully Applying relocation fixups
- to a PE/COFF image for some specicial purpose.
- As a example, For NT32 emulator, the function should be implemented and called
- to support source level debug.
-
- @param ImageContext Pointer to the image context structure that describes the PE/COFF
- image that is being relocated.
+ For NT32, this function load symbols to support source level debugging.
+
+ If ImageContext is NULL, then ASSERT().
+
+ @param ImageContext Pointer to the image context structure that describes the
+ PE/COFF image that has already been loaded and relocated.
**/
VOID
@@ -148,6 +147,8 @@ PeCoffLoaderRelocateImageExtraAction ( HMODULE Library;
UINTN Index;
+ ASSERT (ImageContext != NULL);
+
if (mWinNt == NULL) {
Nt32PeCoffGetWinNtThunkStucture ();
}
@@ -229,17 +230,15 @@ PeCoffLoaderRelocateImageExtraAction ( }
/**
- Unloads a loaded PE/COFF image from memory and releases its taken resource.
-
- Releases any environment specific resources that were allocated when the image
- specified by ImageContext was loaded using PeCoffLoaderLoadImage().
- For NT32 emulator, the PE/COFF image loaded by system needs to release.
- For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded,
+ Performs additional actions just before a PE/COFF image is unloaded. Any resources
+ that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
+ For NT32, this function unloads symbols for source level debugging.
+
If ImageContext is NULL, then ASSERT().
- @param ImageContext Pointer to the image context structure that describes the PE/COFF
- image to be unloaded.
+ @param ImageContext Pointer to the image context structure that describes the
+ PE/COFF image that is being unloaded.
**/
VOID
@@ -248,4 +247,5 @@ PeCoffLoaderUnloadImageExtraAction ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
+ ASSERT (ImageContext != NULL);
}
|