]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Core/Dxe/Image/Image.c
Removed cross references from PciCf8Lib and PciExpressLib class to PciLib class.
[mirror_edk2.git] / EdkModulePkg / Core / Dxe / Image / Image.c
index c818cc213135fdee2618082f086d5915232d4c6c..d77f4c4fca23c5af4ab7b14cd66fd07bddac1c0c 100644 (file)
@@ -268,6 +268,15 @@ Returns:
     return Status;\r
   }\r
 \r
+  if (!EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Image->ImageContext.Machine)) {\r
+    //\r
+    // The PE/COFF loader can support loading image types that can be executed. \r
+    // If we loaded an image type that we can not execute return EFI_UNSUPORTED. \r
+    //\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+\r
   //\r
   // Allocate memory of the correct memory type aligned on the required image boundry\r
   //\r
@@ -440,8 +449,8 @@ Returns:
   // Print the load address and the PDB file name if it is available\r
   //\r
 \r
-  DEBUG_CODE (\r
-  {\r
+  DEBUG_CODE_BEGIN ();\r
\r
     UINTN Index;\r
     UINTN StartIndex;\r
     CHAR8 EfiFileName[256];\r
@@ -473,8 +482,8 @@ Returns:
       DEBUG ((EFI_D_INFO | EFI_D_LOAD, "%a", EfiFileName)); // &Image->ImageContext.PdbPointer[StartIndex]));\r
     }\r
     DEBUG ((EFI_D_INFO | EFI_D_LOAD, "\n"));\r
-  }\r
-  );\r
+  \r
+  DEBUG_CODE_END ();\r
 \r
   return EFI_SUCCESS;\r
 \r
@@ -924,22 +933,13 @@ Returns:
   //\r
   PERF_START (ImageHandle, START_IMAGE_TOK, NULL, 0);\r
 \r
-  if (sizeof (UINTN) == 4 && Image->Machine == EFI_IMAGE_MACHINE_X64) {\r
-    return EFI_UNSUPPORTED;\r
-  } else if (sizeof (UINTN) == 8 && Image->Machine == EFI_IMAGE_MACHINE_IA32) {\r
-    return EFI_UNSUPPORTED;\r
-  } else {\r
-    //\r
-    // For orther possible cases\r
-    //\r
-  }\r
 \r
   //\r
   // Push the current start image context, and\r
   // link the current image to the head.   This is the\r
   // only image that can call Exit()\r
   //\r
-  HandleDatabaseKey = CoreGetHandleDatabaseKey();\r
+  HandleDatabaseKey = CoreGetHandleDatabaseKey ();\r
   LastImage         = mCurrentImage;\r
   mCurrentImage     = Image;\r
   Image->Tpl        = gEfiCurrentTpl;\r
@@ -970,11 +970,11 @@ Returns:
     // This make the user aware and check if the driver image have already released\r
     // all the resource in this situation.\r
     //\r
-    DEBUG_CODE (\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
       }\r
-    );\r
+    DEBUG_CODE_END ();\r
 \r
     //\r
     // If the image returns, exit it through Exit()\r
@@ -1003,7 +1003,7 @@ Returns:
   //\r
   // Handle the image's returned ExitData\r
   //\r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     if (Image->ExitDataSize != 0 || Image->ExitData != NULL) {\r
 \r
       DEBUG (\r
@@ -1017,7 +1017,7 @@ Returns:
       }\r
       DEBUG ((EFI_D_LOAD, "\n"));\r
     }\r
-  );\r
+  DEBUG_CODE_END ();\r
 \r
   //\r
   //  Return the exit data to the caller\r