--*/\r
{\r
EFI_STATUS Status;\r
+ EFI_STATUS StatusTemp;\r
+ EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol;\r
+\r
+ //\r
+ // Measure invocation of ExitBootServices, \r
+ // which is defined by TCG_EFI_Platform_1_20_Final Specification\r
+ //\r
+ TcgPlatformProtocol = NULL;\r
+ Status = CoreLocateProtocol (\r
+ &gEfiTcgPlatformProtocolGuid,\r
+ NULL,\r
+ (VOID **) &TcgPlatformProtocol\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_INVOCATION);\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
\r
//\r
// Terminate memory services if the MapKey matches\r
//\r
Status = CoreTerminateMemoryMap (MapKey);\r
if (EFI_ERROR (Status)) {\r
+ //\r
+ // Measure failure of ExitBootServices\r
+ //\r
+ if (TcgPlatformProtocol != NULL) {\r
+ StatusTemp = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_FAILED);\r
+ ASSERT_EFI_ERROR (StatusTemp);\r
+ }\r
+\r
return Status;\r
}\r
\r
//\r
gRuntime->AtRuntime = TRUE;\r
\r
+ //\r
+ // Measure success of ExitBootServices\r
+ //\r
+ if (TcgPlatformProtocol != NULL) {\r
+ StatusTemp = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_SUCCEEDED);\r
+ ASSERT_EFI_ERROR (StatusTemp);\r
+ }\r
+ \r
return Status;\r
}\r
\r
\r
EFI_STATUS\r
CoreLoadPeImage (\r
+ IN BOOLEAN BootPolicy, \r
IN VOID *Pe32Handle,\r
IN LOADED_IMAGE_PRIVATE_DATA *Image,\r
IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r
Loads, relocates, and invokes a PE/COFF image\r
\r
Arguments:\r
-\r
+ BootPolicy - If TRUE, indicates that the request originates from the boot manager,\r
+ and that the boot manager is attempting to load FilePath as a boot selection.\r
Pe32Handle - The handle of PE32 image\r
Image - PE image to be loaded\r
DstBuffer - The buffer to store the image\r
\r
--*/\r
{\r
- EFI_STATUS Status;\r
- BOOLEAN DstBufAlocated;\r
- UINTN Size;\r
+ EFI_STATUS Status;\r
+ BOOLEAN DstBufAlocated;\r
+ UINTN Size;\r
+ UINTN LinkTimeBase;\r
+ EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol;\r
\r
ZeroMem (&Image->ImageContext, sizeof (Image->ImageContext));\r
\r
Image->ImageContext.ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;\r
return EFI_UNSUPPORTED;\r
}\r
+ //\r
+ // Get the image base address in the original PeImage.\r
+ //\r
+ LinkTimeBase = (UINTN) Image->ImageContext.ImageAddress;\r
\r
//\r
// Allocate memory of the correct memory type aligned on the required image boundry\r
}\r
}\r
\r
+ //\r
+ // Measure the image before applying fixup\r
+ //\r
+ Status = CoreLocateProtocol (\r
+ &gEfiTcgPlatformProtocolGuid,\r
+ NULL,\r
+ (VOID **) &TcgPlatformProtocol\r
+ );\r
+ if (!EFI_ERROR (Status)) { \r
+ Status = TcgPlatformProtocol->MeasurePeImage (\r
+ BootPolicy,\r
+ Image->ImageContext.ImageAddress,\r
+ (UINTN) Image->ImageContext.ImageSize,\r
+ LinkTimeBase,\r
+ Image->ImageContext.ImageType,\r
+ Image->Info.DeviceHandle,\r
+ Image->Info.FilePath\r
+ );\r
+ \r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+\r
//\r
// Relocate the image in memory\r
//\r
//\r
// Load the image. If EntryPoint is Null, it will not be set.\r
//\r
- Status = CoreLoadPeImage (&FHand, Image, DstBuffer, EntryPoint, Attribute);\r
+ Status = CoreLoadPeImage (BootPolicy, &FHand, Image, DstBuffer, EntryPoint, Attribute);\r
if (EFI_ERROR (Status)) {\r
if ((Status == EFI_BUFFER_TOO_SMALL) || (Status == EFI_OUT_OF_RESOURCES)) {\r
if (NumberOfPages != NULL) {\r
);\r
}\r
\r
-\r
-\r
-\r
EFI_STATUS\r
EFIAPI\r
CoreStartImage (\r