Enhance PeiCore and DxeCore check whether the image machine type is supported when...
authorlgao4 <lgao4@de2fecce-e211-0410-80a6-f3fac2684e05>
Wed, 16 Sep 2009 02:37:23 +0000 (02:37 +0000)
committerlgao4 <lgao4@de2fecce-e211-0410-80a6-f3fac2684e05>
Wed, 16 Sep 2009 02:37:23 +0000 (02:37 +0000)
git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@9266 de2fecce-e211-0410-80a6-f3fac2684e05

edk2/MdeModulePkg/Core/Dxe/Image/Image.c
edk2/MdeModulePkg/Core/Pei/Image/Image.c

index 8ec6793..8033b44 100644 (file)
@@ -1120,6 +1120,14 @@ CoreStartImage (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if (!EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Image->Machine)) {\r
+    //\r
+    // The image to be started must have the machine type supported by DxeCore.\r
+    //\r
+    ASSERT (FALSE);\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Don't profile Objects or invalid start requests\r
   //\r
index 03e1d86..84c9e4b 100644 (file)
@@ -434,6 +434,13 @@ PeiLoadImage (
                           AuthenticationState\r
                           );\r
       if (!EFI_ERROR (Status)) {\r
+        if (!EFI_IMAGE_MACHINE_TYPE_SUPPORTED (PeCoffLoaderGetMachineType ((VOID *) (UINTN) ImageAddress))) {\r
+          //\r
+          // The image to be started must have the machine type supported by PeiCore.\r
+          //\r
+          ASSERT (FALSE);\r
+          return EFI_UNSUPPORTED;\r
+        }\r
         return Status;\r
       }\r
     }\r