diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 8ec6793966..8033b449d9 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -1120,6 +1120,14 @@ CoreStartImage ( return EFI_INVALID_PARAMETER; } + if (!EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Image->Machine)) { + // + // The image to be started must have the machine type supported by DxeCore. + // + ASSERT (FALSE); + return EFI_UNSUPPORTED; + } + // // Don't profile Objects or invalid start requests // diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c index 03e1d86ad7..84c9e4b5bf 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -434,6 +434,13 @@ PeiLoadImage ( AuthenticationState ); if (!EFI_ERROR (Status)) { + if (!EFI_IMAGE_MACHINE_TYPE_SUPPORTED (PeCoffLoaderGetMachineType ((VOID *) (UINTN) ImageAddress))) { + // + // The image to be started must have the machine type supported by PeiCore. + // + ASSERT (FALSE); + return EFI_UNSUPPORTED; + } return Status; } }