/** @file\r
Support routines for SMRAM profile.\r
\r
- Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
@param[in, out] ProfileSize On entry, points to the size in bytes of the ProfileBuffer.\r
On return, points to the size of the data returned in ProfileBuffer.\r
@param[out] ProfileBuffer Profile buffer.\r
- \r
+\r
@return EFI_SUCCESS Get the memory profile data successfully.\r
@return EFI_UNSUPPORTED Memory profile is unsupported.\r
- @return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data. \r
+ @return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data.\r
ProfileSize is updated with the size required.\r
\r
**/\r
return mSmramProfileContextPtr;\r
}\r
\r
-/**\r
- Retrieves the magic value from the PE/COFF header.\r
-\r
- @param Hdr The buffer in which to return the PE32, PE32+, or TE header.\r
-\r
- @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32\r
- @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+\r
-\r
-**/\r
-UINT16\r
-InternalPeCoffGetPeHeaderMagicValue (\r
- IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr\r
- )\r
-{\r
- //\r
- // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value\r
- // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the\r
- // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC\r
- // then override the returned value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC\r
- //\r
- if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
- return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;\r
- }\r
- //\r
- // Return the magic value from the PC/COFF Optional Header\r
- //\r
- return Hdr.Pe32->OptionalHeader.Magic;\r
-}\r
-\r
/**\r
Retrieves and returns the Subsystem of a PE/COFF image that has been loaded into system memory.\r
If Pe32Data is NULL, then ASSERT().\r
if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {\r
return Hdr.Te->Subsystem;\r
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {\r
- Magic = InternalPeCoffGetPeHeaderMagicValue (Hdr);\r
+ Magic = Hdr.Pe32->OptionalHeader.Magic;\r
if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
return Hdr.Pe32->OptionalHeader.Subsystem;\r
} else if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {\r
//\r
return TRUE;\r
}\r
- \r
+\r
//\r
// Record FilePath without end node.\r
//\r
@param[in, out] ProfileSize On entry, points to the size in bytes of the ProfileBuffer.\r
On return, points to the size of the data returned in ProfileBuffer.\r
@param[out] ProfileBuffer Profile buffer.\r
- \r
+\r
@return EFI_SUCCESS Get the memory profile data successfully.\r
@return EFI_UNSUPPORTED Memory profile is unsupported.\r
- @return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data. \r
+ @return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data.\r
ProfileSize is updated with the size required.\r
\r
**/\r
EFI_SMM_DRIVER_ENTRY DriverEntry;\r
VOID *EntryPointInImage;\r
EFI_GUID *Name;\r
- \r
+\r
ZeroMem (&DriverEntry, sizeof (DriverEntry));\r
Name = GetFileNameFromFilePath (FilePath);\r
if (Name != NULL) {\r