summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe/Image/Image.c
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-05-21 08:32:06 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-05-21 08:32:06 +0000
commit57d6f36db6c38d96e3faed6c0ecfff9fa442822b (patch)
tree72771ece7cc5f2fb6e558a44fb18596ddee4d8d4 /MdeModulePkg/Core/Dxe/Image/Image.c
parent7e1230b6a1081aaadcdf16451eda5864050ffa43 (diff)
downloadedk2-platforms-57d6f36db6c38d96e3faed6c0ecfff9fa442822b.tar.xz
add debug information.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5266 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe/Image/Image.c')
-rw-r--r--MdeModulePkg/Core/Dxe/Image/Image.c293
1 files changed, 147 insertions, 146 deletions
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index 64e5e34fc4..b4a1581f1f 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -76,7 +76,7 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage = {
Add the Image Services to EFI Boot Services Table and install the protocol
interfaces for this image.
- @param HobStart The HOB to initialize
+ @param HobStart The HOB to initialize
@return Status code.
@@ -158,27 +158,27 @@ CoreInitializeImageServices (
/**
Loads, relocates, and invokes a PE/COFF image
- @param BootPolicy If TRUE, indicates that the request originates
- from the boot manager, and that the boot
- manager is attempting to load FilePath as a
- boot selection.
- @param Pe32Handle The handle of PE32 image
- @param Image PE image to be loaded
- @param DstBuffer The buffer to store the image
- @param EntryPoint A pointer to the entry point
- @param Attribute The bit mask of attributes to set for the load
- PE image
-
- @retval EFI_SUCCESS The file was loaded, relocated, and invoked
- @retval EFI_OUT_OF_RESOURCES There was not enough memory to load and
- relocate the PE/COFF file
- @retval EFI_INVALID_PARAMETER Invalid parameter
+ @param BootPolicy If TRUE, indicates that the request originates
+ from the boot manager, and that the boot
+ manager is attempting to load FilePath as a
+ boot selection.
+ @param Pe32Handle The handle of PE32 image
+ @param Image PE image to be loaded
+ @param DstBuffer The buffer to store the image
+ @param EntryPoint A pointer to the entry point
+ @param Attribute The bit mask of attributes to set for the load
+ PE image
+
+ @retval EFI_SUCCESS The file was loaded, relocated, and invoked
+ @retval EFI_OUT_OF_RESOURCES There was not enough memory to load and
+ relocate the PE/COFF file
+ @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_BUFFER_TOO_SMALL Buffer for image is too small
**/
EFI_STATUS
CoreLoadPeImage (
- IN BOOLEAN BootPolicy,
+ IN BOOLEAN BootPolicy,
IN VOID *Pe32Handle,
IN LOADED_IMAGE_PRIVATE_DATA *Image,
IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
@@ -216,7 +216,7 @@ CoreLoadPeImage (
return EFI_UNSUPPORTED;
}
}
-
+
//
// Set EFI memory type based on ImageType
//
@@ -396,6 +396,7 @@ CoreLoadPeImage (
//
Status = CoreLocateProtocol (&gEfiEbcProtocolGuid, NULL, (VOID **)&Image->Ebc);
if (EFI_ERROR(Status)) {
+ DEBUG ((DEBUG_LOAD | DEBUG_ERROR, "CoreLoadPeImage: There is no EBC interpreter for an EBC image.\n"));
goto Done;
}
@@ -464,22 +465,22 @@ CoreLoadPeImage (
UINTN Index;
UINTN StartIndex;
CHAR8 EfiFileName[256];
-
+
if (Image->ImageContext.Machine != IMAGE_FILE_MACHINE_IA64) {
- DEBUG ((DEBUG_INFO | DEBUG_LOAD,
- "Loading driver at 0x%10p EntryPoint=0x%10p ",
- (VOID *)(UINTN)Image->ImageContext.ImageAddress,
+ DEBUG ((DEBUG_INFO | DEBUG_LOAD,
+ "Loading driver at 0x%10p EntryPoint=0x%10p ",
+ (VOID *)(UINTN)Image->ImageContext.ImageAddress,
(VOID *)(UINTN)Image->ImageContext.EntryPoint));
} else {
//
// For IPF Image, the real entry point should be print.
- //
- DEBUG ((DEBUG_INFO | DEBUG_LOAD,
- "Loading driver at 0x%10p EntryPoint=0x%10p ",
- (VOID *)(UINTN)Image->ImageContext.ImageAddress,
+ //
+ DEBUG ((DEBUG_INFO | DEBUG_LOAD,
+ "Loading driver at 0x%10p EntryPoint=0x%10p ",
+ (VOID *)(UINTN)Image->ImageContext.ImageAddress,
(VOID *)(UINTN)(*(UINT64 *)(UINTN)Image->ImageContext.EntryPoint)));
}
-
+
//
// Print Module Name by Pdb file path
//
@@ -536,7 +537,7 @@ Done:
/**
Get the image's private data from its handle.
- @param ImageHandle The image handle
+ @param ImageHandle The image handle
@return Return the image private data associated with ImageHandle.
@@ -569,36 +570,36 @@ CoreLoadedImageInfo (
/**
Loads an EFI image into memory and returns a handle to the image.
- @param BootPolicy If TRUE, indicates that the request originates
- from the boot manager, and that the boot
- manager is attempting to load FilePath as a
- boot selection.
- @param ParentImageHandle The caller's image handle.
- @param FilePath The specific file path from which the image is
- loaded.
- @param SourceBuffer If not NULL, a pointer to the memory location
- containing a copy of the image to be loaded.
- @param SourceSize The size in bytes of SourceBuffer.
- @param DstBuffer The buffer to store the image
- @param NumberOfPages If not NULL, it inputs a pointer to the page
- number of DstBuffer and outputs a pointer to
- the page number of the image. If this number is
- not enough, return EFI_BUFFER_TOO_SMALL and
- this parameter contains the required number.
- @param ImageHandle Pointer to the returned image handle that is
- created when the image is successfully loaded.
- @param EntryPoint A pointer to the entry point
- @param Attribute The bit mask of attributes to set for the load
- PE image
-
- @retval EFI_SUCCESS The image was loaded into memory.
- @retval EFI_NOT_FOUND The FilePath was not found.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_BUFFER_TOO_SMALL The buffer is too small
- @retval EFI_UNSUPPORTED The image type is not supported, or the device
- path cannot be parsed to locate the proper
- protocol for loading the file.
- @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
+ @param BootPolicy If TRUE, indicates that the request originates
+ from the boot manager, and that the boot
+ manager is attempting to load FilePath as a
+ boot selection.
+ @param ParentImageHandle The caller's image handle.
+ @param FilePath The specific file path from which the image is
+ loaded.
+ @param SourceBuffer If not NULL, a pointer to the memory location
+ containing a copy of the image to be loaded.
+ @param SourceSize The size in bytes of SourceBuffer.
+ @param DstBuffer The buffer to store the image
+ @param NumberOfPages If not NULL, it inputs a pointer to the page
+ number of DstBuffer and outputs a pointer to
+ the page number of the image. If this number is
+ not enough, return EFI_BUFFER_TOO_SMALL and
+ this parameter contains the required number.
+ @param ImageHandle Pointer to the returned image handle that is
+ created when the image is successfully loaded.
+ @param EntryPoint A pointer to the entry point
+ @param Attribute The bit mask of attributes to set for the load
+ PE image
+
+ @retval EFI_SUCCESS The image was loaded into memory.
+ @retval EFI_NOT_FOUND The FilePath was not found.
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
+ @retval EFI_BUFFER_TOO_SMALL The buffer is too small
+ @retval EFI_UNSUPPORTED The image type is not supported, or the device
+ path cannot be parsed to locate the proper
+ protocol for loading the file.
+ @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
resources.
**/
@@ -747,7 +748,7 @@ CoreLoadImageCommon (
if (NumberOfPages != NULL) {
*NumberOfPages = Image->NumberOfPages;
- }
+ }
//
// Register the image in the Debug Image Info Table if the attribute is set
@@ -825,26 +826,26 @@ Done:
/**
Loads an EFI image into memory and returns a handle to the image.
- @param BootPolicy If TRUE, indicates that the request originates
- from the boot manager, and that the boot
- manager is attempting to load FilePath as a
- boot selection.
- @param ParentImageHandle The caller's image handle.
- @param FilePath The specific file path from which the image is
- loaded.
- @param SourceBuffer If not NULL, a pointer to the memory location
- containing a copy of the image to be loaded.
- @param SourceSize The size in bytes of SourceBuffer.
- @param ImageHandle Pointer to the returned image handle that is
- created when the image is successfully loaded.
-
- @retval EFI_SUCCESS The image was loaded into memory.
- @retval EFI_NOT_FOUND The FilePath was not found.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED The image type is not supported, or the device
- path cannot be parsed to locate the proper
- protocol for loading the file.
- @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
+ @param BootPolicy If TRUE, indicates that the request originates
+ from the boot manager, and that the boot
+ manager is attempting to load FilePath as a
+ boot selection.
+ @param ParentImageHandle The caller's image handle.
+ @param FilePath The specific file path from which the image is
+ loaded.
+ @param SourceBuffer If not NULL, a pointer to the memory location
+ containing a copy of the image to be loaded.
+ @param SourceSize The size in bytes of SourceBuffer.
+ @param ImageHandle Pointer to the returned image handle that is
+ created when the image is successfully loaded.
+
+ @retval EFI_SUCCESS The image was loaded into memory.
+ @retval EFI_NOT_FOUND The FilePath was not found.
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
+ @retval EFI_UNSUPPORTED The image type is not supported, or the device
+ path cannot be parsed to locate the proper
+ protocol for loading the file.
+ @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
resources.
**/
@@ -886,29 +887,29 @@ CoreLoadImage (
/**
Loads an EFI image into memory and returns a handle to the image with extended parameters.
- @param This Calling context
- @param ParentImageHandle The caller's image handle.
- @param FilePath The specific file path from which the image is
- loaded.
- @param SourceBuffer If not NULL, a pointer to the memory location
- containing a copy of the image to be loaded.
- @param SourceSize The size in bytes of SourceBuffer.
- @param DstBuffer The buffer to store the image.
- @param NumberOfPages For input, specifies the space size of the
- image by caller if not NULL. For output,
- specifies the actual space size needed.
- @param ImageHandle Image handle for output.
- @param EntryPoint Image entry point for output.
- @param Attribute The bit mask of attributes to set for the load
- PE image.
-
- @retval EFI_SUCCESS The image was loaded into memory.
- @retval EFI_NOT_FOUND The FilePath was not found.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED The image type is not supported, or the device
- path cannot be parsed to locate the proper
- protocol for loading the file.
- @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
+ @param This Calling context
+ @param ParentImageHandle The caller's image handle.
+ @param FilePath The specific file path from which the image is
+ loaded.
+ @param SourceBuffer If not NULL, a pointer to the memory location
+ containing a copy of the image to be loaded.
+ @param SourceSize The size in bytes of SourceBuffer.
+ @param DstBuffer The buffer to store the image.
+ @param NumberOfPages For input, specifies the space size of the
+ image by caller if not NULL. For output,
+ specifies the actual space size needed.
+ @param ImageHandle Image handle for output.
+ @param EntryPoint Image entry point for output.
+ @param Attribute The bit mask of attributes to set for the load
+ PE image.
+
+ @retval EFI_SUCCESS The image was loaded into memory.
+ @retval EFI_NOT_FOUND The FilePath was not found.
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
+ @retval EFI_UNSUPPORTED The image type is not supported, or the device
+ path cannot be parsed to locate the proper
+ protocol for loading the file.
+ @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
resources.
**/
@@ -945,18 +946,18 @@ CoreLoadImageEx (
/**
Transfer control to a loaded image's entry point.
- @param ImageHandle Handle of image to be started.
- @param ExitDataSize Pointer of the size to ExitData
- @param ExitData Pointer to a pointer to a data buffer that
- includes a Null-terminated Unicode string,
- optionally followed by additional binary data.
- The string is a description that the caller may
- use to further indicate the reason for the
- image's exit.
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
- @retval EFI_SUCCESS Successfully transfer control to the image's
+ @param ImageHandle Handle of image to be started.
+ @param ExitDataSize Pointer of the size to ExitData
+ @param ExitData Pointer to a pointer to a data buffer that
+ includes a Null-terminated Unicode string,
+ optionally followed by additional binary data.
+ The string is a description that the caller may
+ use to further indicate the reason for the
+ image's exit.
+
+ @retval EFI_INVALID_PARAMETER Invalid parameter
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
+ @retval EFI_SUCCESS Successfully transfer control to the image's
entry point.
**/
@@ -1112,7 +1113,7 @@ CoreStartImage (
/**
Unloads EFI image from memory.
- @param Image EFI image
+ @param Image EFI image
@param FreePage Free allocated pages
**/
@@ -1255,23 +1256,23 @@ CoreUnloadAndCloseImage (
/**
Terminates the currently loaded EFI image and returns control to boot services.
- @param ImageHandle Handle that identifies the image. This
- parameter is passed to the image on entry.
- @param Status The image's exit code.
- @param ExitDataSize The size, in bytes, of ExitData. Ignored if
- ExitStatus is EFI_SUCCESS.
- @param ExitData Pointer to a data buffer that includes a
- Null-terminated Unicode string, optionally
- followed by additional binary data. The string
- is a description that the caller may use to
- further indicate the reason for the image's
- exit.
-
- @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
- image.
- @retval EFI_SUCCESS Successfully terminates the currently loaded
- EFI image.
- @retval EFI_ACCESS_DENIED Should never reach there.
+ @param ImageHandle Handle that identifies the image. This
+ parameter is passed to the image on entry.
+ @param Status The image's exit code.
+ @param ExitDataSize The size, in bytes, of ExitData. Ignored if
+ ExitStatus is EFI_SUCCESS.
+ @param ExitData Pointer to a data buffer that includes a
+ Null-terminated Unicode string, optionally
+ followed by additional binary data. The string
+ is a description that the caller may use to
+ further indicate the reason for the image's
+ exit.
+
+ @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
+ image.
+ @retval EFI_SUCCESS Successfully terminates the currently loaded
+ EFI image.
+ @retval EFI_ACCESS_DENIED Should never reach there.
@retval EFI_OUT_OF_RESOURCES Could not allocate pool
**/
@@ -1290,9 +1291,9 @@ CoreExit (
//
// Prevent possible reentrance to this function
// for the same ImageHandle
- //
- OldTpl = CoreRaiseTpl (TPL_NOTIFY);
-
+ //
+ OldTpl = CoreRaiseTpl (TPL_NOTIFY);
+
Image = CoreLoadedImageInfo (ImageHandle);
if (Image == NULL_HANDLE) {
Status = EFI_INVALID_PARAMETER;
@@ -1357,12 +1358,12 @@ Done:
/**
Unloads an image.
- @param ImageHandle Handle that identifies the image to be
- unloaded.
+ @param ImageHandle Handle that identifies the image to be
+ unloaded.
- @retval EFI_SUCCESS The image has been unloaded.
- @retval EFI_UNSUPPORTED The image has been sarted, and does not support
- unload.
+ @retval EFI_SUCCESS The image has been unloaded.
+ @retval EFI_UNSUPPORTED The image has been sarted, and does not support
+ unload.
@retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
**/
@@ -1379,9 +1380,9 @@ CoreUnloadImage (
//
// Prevent possible reentrance to this function
// for the same ImageHandle
- //
+ //
OldTpl = CoreRaiseTpl (TPL_NOTIFY);
-
+
Image = CoreLoadedImageInfo (ImageHandle);
if (Image == NULL ) {
//
@@ -1425,11 +1426,11 @@ Done:
/**
Unload the specified image.
- @param This Indicates the calling context.
- @param ImageHandle The specified image handle.
+ @param This Indicates the calling context.
+ @param ImageHandle The specified image handle.
- @retval EFI_INVALID_PARAMETER Image handle is NULL.
- @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.
+ @retval EFI_INVALID_PARAMETER Image handle is NULL.
+ @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.
@retval EFI_SUCCESS Image successfully unloaded.
**/