public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] MdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch
Date: Wed, 29 Mar 2017 08:39:08 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D706197@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20170327122216.29760-1-ard.biesheuvel@linaro.org>

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard
>Biesheuvel
>Sent: Monday, March 27, 2017 8:22 PM
>To: edk2-devel@lists.01.org; Gao, Liming <liming.gao@intel.com>
>Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>Subject: [edk2] [PATCH] MdeModulePkg/PeiCore: avoid
>EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch
>
>The EFI_IMAGE_MACHINE_TYPE_SUPPORTED() macro is abused in the
>PeiCore
>code to decide whether the system we are compiling for can deal with
>executable code being copied elsewhere and executed from there.
>
>As stated in the comment, this is fundamentally a property of the compiler
>target, and so this should be made dependent on MDE_CPU_xxx
>preprocessor
>defines, and not on whether or not the runtime target can deal with
>PE/COFF images of a certain machine type.
>
>On X86/IA32, this mostly boils down to the same thing, but not on other
>architectures, so let's clean this up.
>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>---
> MdeModulePkg/Core/Pei/Image/Image.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/MdeModulePkg/Core/Pei/Image/Image.c
>b/MdeModulePkg/Core/Pei/Image/Image.c
>index c8bb2300a0a6..198541128512 100644
>--- a/MdeModulePkg/Core/Pei/Image/Image.c
>+++ b/MdeModulePkg/Core/Pei/Image/Image.c
>@@ -112,6 +112,7 @@ GetImageReadFunction (
>   IN      PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
>   )
> {
>+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
>   PEI_CORE_INSTANCE     *Private;
>   EFI_PHYSICAL_ADDRESS  MemoryBuffer;
>
>@@ -119,8 +120,7 @@ GetImageReadFunction (
>   MemoryBuffer = 0;
>
>   if (Private->PeiMemoryInstalled  && (((Private-
>>HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME)
>&& PcdGetBool (PcdShadowPeimOnBoot)) ||
>-      ((Private->HobList.HandoffInformationTable->BootMode ==
>BOOT_ON_S3_RESUME) && PcdGetBool (PcdShadowPeimOnS3Boot))) &&
>-      (EFI_IMAGE_MACHINE_TYPE_SUPPORTED(EFI_IMAGE_MACHINE_X64)
>|| EFI_IMAGE_MACHINE_TYPE_SUPPORTED(EFI_IMAGE_MACHINE_IA32))) {
>+      ((Private->HobList.HandoffInformationTable->BootMode ==
>BOOT_ON_S3_RESUME) && PcdGetBool (PcdShadowPeimOnS3Boot)))) {
>     //
>     // Shadow algorithm makes lots of non ANSI C assumptions and only works
>for IA32 and X64
>     //  compilers that have been tested
>@@ -136,7 +136,9 @@ GetImageReadFunction (
>   } else {
>     ImageContext->ImageRead = PeiImageRead;
>   }
>-
>+#else
>+  ImageContext->ImageRead = PeiImageRead;
>+#endif
>   return EFI_SUCCESS;
> }
> /**
>--
>2.9.3
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2017-03-29  8:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 12:22 [PATCH] MdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch Ard Biesheuvel
2017-03-29  8:39 ` Gao, Liming [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14D706197@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox