]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Core/Dxe/Image/Image.c
Output DxeCore Entrypoint in DxeIpl module, and make dxecore module can correctly...
[mirror_edk2.git] / EdkModulePkg / Core / Dxe / Image / Image.c
index d77f4c4fca23c5af4ab7b14cd66fd07bddac1c0c..9d585a94ea4b52ea8a5fafa219fc2af9c2b36554 100644 (file)
@@ -74,6 +74,7 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage  = {
   EFI_SUCCESS,                // Status\r
   0,                          // ExitDataSize\r
   NULL,                       // ExitData\r
+  NULL,                       // JumpBuffer\r
   NULL,                       // JumpContext\r
   0,                          // Machine\r
   NULL,                       // Ebc\r
@@ -455,7 +456,7 @@ Returns:
     UINTN StartIndex;\r
     CHAR8 EfiFileName[256];\r
 \r
-    DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading driver at 0x%08x EntryPoint=0x%08x ", (UINTN)Image->ImageContext.ImageAddress, (UINTN)Image->ImageContext.EntryPoint));\r
+    DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading driver at 0x%10p EntryPoint=0x%10p ", (VOID *)(UINTN)Image->ImageContext.ImageAddress, (VOID *)(UINTN)Image->ImageContext.EntryPoint));\r
     if (Image->ImageContext.PdbPointer != NULL) {\r
       StartIndex = 0;\r
       for (Index = 0; Image->ImageContext.PdbPointer[Index] != 0; Index++) {\r
@@ -595,6 +596,7 @@ Returns:
   EFI_DEVICE_PATH_PROTOCOL   *HandleFilePath;\r
   UINTN                      FilePathSize;\r
 \r
+  SecurityStatus = EFI_SUCCESS;\r
 \r
   ASSERT (gEfiCurrentTpl < EFI_TPL_NOTIFY);\r
   ParentImage = NULL;\r
@@ -753,6 +755,8 @@ Done:
       CoreUnloadAndCloseImage (Image, (BOOLEAN)(DstBuffer == 0));\r
       *ImageHandle = NULL;\r
     }\r
+  } else if (EFI_ERROR (SecurityStatus)) {\r
+    Status = SecurityStatus;\r
   }\r
 \r
   return Status;\r
@@ -905,7 +909,7 @@ Arguments:
   ExitData        - Pointer to a pointer to a data buffer that includes a Null-terminated\r
                     Unicode string, optionally followed by additional binary data. The string\r
                     is a description that the caller may use to further indicate the reason for\r
-                    the image¡¯s exit.\r
+                    the image's exit.\r
 \r
 Returns:\r
 \r
@@ -946,12 +950,15 @@ Returns:
 \r
   //\r
   // Set long jump for Exit() support\r
+  // JumpContext must be aligned on a CPU specific boundary.\r
+  // Overallocate the buffer and force the required alignment\r
   //\r
-  Image->JumpContext = CoreAllocateBootServicesPool (sizeof (*Image->JumpContext));\r
-  if (Image->JumpContext == NULL) {\r
+  Image->JumpBuffer = CoreAllocateBootServicesPool (sizeof (*Image->JumpContext) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);\r
+  if (Image->JumpBuffer == NULL) {\r
     PERF_END (ImageHandle, START_IMAGE_TOK, NULL, 0);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
+  Image->JumpContext = (VOID *)((UINTN)(ALIGN_POINTER (Image->JumpBuffer, BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT)) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);\r
 \r
   SetJumpFlag = SetJump (Image->JumpContext);\r
   //\r
@@ -972,7 +979,7 @@ Returns:
     //\r
     DEBUG_CODE_BEGIN ();\r
       if (EFI_ERROR (Image->Status)) {\r
-        DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));\r
+        DEBUG ((EFI_D_ERROR, "Error: Image at %10p start failed: %r\n", Image->Info.ImageBase, Image->Status));\r
       }\r
     DEBUG_CODE_END ();\r
 \r
@@ -988,7 +995,7 @@ Returns:
   ASSERT (Image->Tpl == gEfiCurrentTpl);\r
   CoreRestoreTpl (Image->Tpl);\r
 \r
-  CoreFreePool (Image->JumpContext);\r
+  CoreFreePool (Image->JumpBuffer);\r
 \r
   //\r
   // Pop the current start image context\r
@@ -1209,13 +1216,13 @@ Arguments:
 \r
   ImageHandle       - Handle that identifies the image. This parameter is passed to the image\r
                       on entry.\r
-  Status            - The image¡¯s exit code.\r
+  Status            - The image's exit code.\r
   ExitDataSize      - The size, in bytes, of ExitData. Ignored if ExitStatus is\r
                       EFI_SUCCESS.\r
   ExitData          - Pointer to a data buffer that includes a Null-terminated Unicode string,\r
                       optionally followed by additional binary data. The string is a\r
                       description that the caller may use to further indicate the reason for\r
-                      the image¡¯s exit.\r
+                      the image's exit.\r
 \r
 Returns:\r
 \r