UINT16 Magic;\r
\r
//\r
- // Read the DOS image header to check for it's existance\r
+ // Read the DOS image header to check for its existence\r
//\r
Size = sizeof (EFI_IMAGE_DOS_HEADER);\r
Status = ImageContext->ImageRead (\r
ImageContext->DestinationAddress = 0;\r
\r
//\r
- // Initialize the codeview pointer.\r
+ // Initialize the debug codeview pointer.\r
//\r
- ImageContext->CodeView = NULL;\r
- ImageContext->PdbPointer = NULL;\r
+ ImageContext->DebugDirectoryEntryRva = 0;\r
+ ImageContext->CodeView = NULL;\r
+ ImageContext->PdbPointer = NULL;\r
\r
//\r
// Three cases with regards to relocations:\r
\r
If ImageContext is NULL, then ASSERT().\r
\r
+ Note that if the platform does not maintain coherency between the instruction cache(s) and the data\r
+ cache(s) in hardware, then the caller is responsible for performing cache maintenance operations\r
+ prior to transferring control to a PE/COFF image that is loaded using this library.\r
+\r
@param ImageContext Pointer to the image context structure that describes the PE/COFF\r
image that is being relocated.\r
\r
\r
If ImageContext is NULL, then ASSERT().\r
\r
+ Note that if the platform does not maintain coherency between the instruction cache(s) and the data\r
+ cache(s) in hardware, then the caller is responsible for performing cache maintenance operations\r
+ prior to transferring control to a PE/COFF image that is loaded using this library.\r
+\r
@param ImageContext Pointer to the image context structure that describes the PE/COFF\r
image that is being loaded.\r
\r
\r
if (DirectoryEntry->Size != 0) {\r
Base = PeCoffLoaderImageAddress (ImageContext, DirectoryEntry->VirtualAddress);\r
-\r
- ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) Base;\r
- ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);\r
-\r
- for (Index = 0; Index < ResourceDirectory->NumberOfNamedEntries; Index++) {\r
- if (ResourceDirectoryEntry->u1.s.NameIsString) {\r
- ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (Base + ResourceDirectoryEntry->u1.s.NameOffset);\r
-\r
- if (ResourceDirectoryString->Length == 3 &&\r
- ResourceDirectoryString->String[0] == L'H' &&\r
- ResourceDirectoryString->String[1] == L'I' &&\r
- ResourceDirectoryString->String[2] == L'I') {\r
- //\r
- // Resource Type "HII" found\r
- //\r
- if (ResourceDirectoryEntry->u2.s.DataIsDirectory) {\r
+ if (Base != NULL) {\r
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) Base;\r
+ ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);\r
+\r
+ for (Index = 0; Index < ResourceDirectory->NumberOfNamedEntries; Index++) {\r
+ if (ResourceDirectoryEntry->u1.s.NameIsString) {\r
+ ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (Base + ResourceDirectoryEntry->u1.s.NameOffset);\r
+\r
+ if (ResourceDirectoryString->Length == 3 &&\r
+ ResourceDirectoryString->String[0] == L'H' &&\r
+ ResourceDirectoryString->String[1] == L'I' &&\r
+ ResourceDirectoryString->String[2] == L'I') {\r
//\r
- // Move to next level - resource Name\r
+ // Resource Type "HII" found\r
//\r
- ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);\r
- ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);\r
-\r
if (ResourceDirectoryEntry->u2.s.DataIsDirectory) {\r
//\r
- // Move to next level - resource Language\r
+ // Move to next level - resource Name\r
//\r
ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);\r
ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);\r
+\r
+ if (ResourceDirectoryEntry->u2.s.DataIsDirectory) {\r
+ //\r
+ // Move to next level - resource Language\r
+ //\r
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);\r
+ ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);\r
+ }\r
}\r
- }\r
\r
- //\r
- // Now it ought to be resource Data\r
- //\r
- if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) {\r
- ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (Base + ResourceDirectoryEntry->u2.OffsetToData);\r
- ImageContext->HiiResourceData = (PHYSICAL_ADDRESS) (UINTN) PeCoffLoaderImageAddress (ImageContext, ResourceDataEntry->OffsetToData);\r
- break;\r
+ //\r
+ // Now it ought to be resource Data\r
+ //\r
+ if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) {\r
+ ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (Base + ResourceDirectoryEntry->u2.OffsetToData);\r
+ ImageContext->HiiResourceData = (PHYSICAL_ADDRESS) (UINTN) PeCoffLoaderImageAddress (ImageContext, ResourceDataEntry->OffsetToData);\r
+ break;\r
+ }\r
}\r
}\r
+ ResourceDirectoryEntry++;\r
}\r
-\r
- ResourceDirectoryEntry++;\r
}\r
}\r
}\r
to the FiuxupData buffer from the PE_COFF_LOADER_IMAGE_CONTEXT structure \r
after this PE/COFF image was relocated with PeCoffLoaderRelocateImage().\r
\r
+ Note that if the platform does not maintain coherency between the instruction cache(s) and the data\r
+ cache(s) in hardware, then the caller is responsible for performing cache maintenance operations\r
+ prior to transferring control to a PE/COFF image that is loaded using this library.\r
+\r
@param ImageBase Base address of a PE/COFF image that has been loaded \r
and relocated into system memory.\r
@param VirtImageBase The request virtual address that the PE/COFF image is to\r