From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E24F381FEA for ; Mon, 27 Feb 2017 00:13:40 -0800 (PST) Received: by mail-io0-x232.google.com with SMTP id l7so13630335ioe.3 for ; Mon, 27 Feb 2017 00:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cSvLp772rL93YBbCD5FzK/ZFnYPh6M7QFr0k36ffpps=; b=D/Djwoz7Z64TMp2/VA/ScxR/TFZrAQKMVkM+odQOc98JA14htPilMFCJfklaG7csMP 5Z0L2hXAdLZmWR/vpIvavvPEiEA7yU5c/4RfiSTIK/H8lkjslg+priwiAN0lKjWeQ9Nk bB1z/3KArTjZTsEXIxeTbRQXmfH4qiVbxrf5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cSvLp772rL93YBbCD5FzK/ZFnYPh6M7QFr0k36ffpps=; b=hBApoGfs5O8DGWwPLpkJX76SAHy3C2zUC/nYKgr/BJSr3giA4kWKtGLfuWkGBAWRzJ XwGnxqVgmFI/FAvQZHHTRjSeswJJ1ZsmLrcaiARM9yNjEDNwMJbkdHug7hjGZNbsJ4o3 wWOe5xxnwVbBt5NrRyQ4c+K2r4RDvrt6y7dOc78skndzzfFUVHNnV+Dr1IfRMffyT0vM ph4n1C8QTEslbQIemwYwNhfeQwdxvntK3Tb2WDEt1dElKAkARgJz6uMU5sPqiwPHJgQa emM9Y+rIg70LyfJLkxV6mFzBWega3qjZPSwwkxPD3oxrkKcBHnrTqluNI2jCMlY1MU3f 2uIA== X-Gm-Message-State: AMke39lGF5moh6kzli26yii5b8oZ3afGKDFrJFBifYaOFU9NBQlkF2/U27ZkTlQjLSlVmKLhdAmZriUn6kY5xIgZ X-Received: by 10.107.132.155 with SMTP id o27mr1627000ioi.138.1488183220100; Mon, 27 Feb 2017 00:13:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.10.27 with HTTP; Mon, 27 Feb 2017 00:13:39 -0800 (PST) In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6E4EB9@shsmsx102.ccr.corp.intel.com> References: <1488133805-4773-1-git-send-email-ard.biesheuvel@linaro.org> <1488133805-4773-3-git-send-email-ard.biesheuvel@linaro.org> <4A89E2EF3DFEDB4C8BFDE51014F606A14D6E4EB9@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Mon, 27 Feb 2017 08:13:39 +0000 Message-ID: To: "Gao, Liming" Cc: "edk2-devel@lists.01.org" , "Yao, Jiewen" , "leif.lindholm@linaro.org" , "Tian, Feng" , "afish@apple.com" , "Kinney, Michael D" , "lersek@redhat.com" , "Zeng, Star" Subject: Re: [PATCH v3 2/6] MdeModulePkg/PeiCore: allocate BootServicesCode memory for PE/COFF images X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2017 08:13:41 -0000 Content-Type: text/plain; charset=UTF-8 On 27 February 2017 at 06:43, Gao, Liming wrote: > Ard: > In line 128, there is another AllocatePages() to allocate memory to store the code. To be consistent, could you help also update it? > OK >>-----Original Message----- >>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard >>Biesheuvel >>Sent: Monday, February 27, 2017 2:30 AM >>To: edk2-devel@lists.01.org; Yao, Jiewen ; >>leif.lindholm@linaro.org >>Cc: Tian, Feng ; Ard Biesheuvel >>; afish@apple.com; Gao, Liming >>; Kinney, Michael D ; >>lersek@redhat.com; Zeng, Star >>Subject: [edk2] [PATCH v3 2/6] MdeModulePkg/PeiCore: allocate >>BootServicesCode memory for PE/COFF images >> >>Ensure that any memory allocated for PE/COFF images is identifiable as >>a boot services code region, so that we know it requires its executable >>permissions to be preserved when we tighten mapping permissions later on. >> >>Contributed-under: TianoCore Contribution Agreement 1.0 >>Signed-off-by: Ard Biesheuvel >>Reviewed-by: Jiewen Yao >>--- >> MdeModulePkg/Core/Pei/Image/Image.c | 10 +++++++--- >> 1 file changed, 7 insertions(+), 3 deletions(-) >> >>diff --git a/MdeModulePkg/Core/Pei/Image/Image.c >>b/MdeModulePkg/Core/Pei/Image/Image.c >>index d659de8b3e64..8cc9ed93e9b6 100644 >>--- a/MdeModulePkg/Core/Pei/Image/Image.c >>+++ b/MdeModulePkg/Core/Pei/Image/Image.c >>@@ -453,12 +453,16 @@ LoadAndRelocatePeCoffImage ( >> // >> // The PEIM is not assiged valid address, try to allocate page to load it. >> // >>- ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) >>AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize)); >>+ Status = PeiServicesAllocatePages (EfiBootServicesCode, >>+ EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize), >>+ &ImageContext.ImageAddress); >> } >> } else { >>- ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) >>AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize)); >>+ Status = PeiServicesAllocatePages (EfiBootServicesCode, >>+ EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize), >>+ &ImageContext.ImageAddress); >> } >>- if (ImageContext.ImageAddress != 0) { >>+ if (!EFI_ERROR (Status)) { >> // >> // Adjust the Image Address to make sure it is section alignment. >> // >>-- >>2.7.4 >> >>_______________________________________________ >>edk2-devel mailing list >>edk2-devel@lists.01.org >>https://lists.01.org/mailman/listinfo/edk2-devel