From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.117]) by mx.groups.io with SMTP id smtpd.web12.16653.1586459642868717256 for ; Thu, 09 Apr 2020 12:14:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=cOa6bD7Q; spf=pass (domain: microsoft.com, ip: 40.107.93.117, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9LXLIjXtkxeWG9Ci29upHzRL2OhVtM6rI1W2K9ROSiMyZSK2BYHVjsvI98fc/5VFGn1kpsaJ+5EjLBodhU4uFzVXCKWL/MBYcPvqeueuEWhFK6I9ENm56YjyBv+odF7e/t+yjg4Z3nIZf1uSlZoFNtFRROJpw8viRsGNhiDR2xD4V1eYqi153RlvNIgaoGWY+V+TP8vOekpeqK13/nObeO9pDEQd7ieSJgSM2ECWBqbHXlRimdJZiO+NH5Pd/MELzSbh05GmhOQ5J6T34IdZdgsGR7HRUk6Q2dTOr+l25Q4+cvMHuuu/eV8TIaqm5Xi9v6BMWIBBT4dkMV5sMQVNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FWrIe4DmxvLRvjOK7fd2JOZNv0m+4S6dJluJWO4FnYk=; b=B0hXclM9lJiVTOduIGfU+DVP+hQ90+WzTjkN1/KmP7e+BjmDmp6bJFEEa6KGDU+V08E6f3PgaMAmu1rFve/t+RXzs5p7hh0vy/b45PAdLk+lu+R66g5HcTJRVNI6NQBUYiGlXCnUtu/Ph3qcD5TDvqsLBjKgYc7PGAKS+p2ZK7ryZnMI2vGP8HXrjgVNqhvNGvyGMNuPI/OmrEyndX1D7xonoRf8F75jOo/jDyXMdywByyf8Fn8kTljiHbLwztwxNmGypFaWXpbKLH49dYno8Hn8yasrJ+TO5xpQuLMYntza09QDdqqGXjq17RvwM9QBLUuwVWWl/fR05DmOcNscrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FWrIe4DmxvLRvjOK7fd2JOZNv0m+4S6dJluJWO4FnYk=; b=cOa6bD7QMeKtELtmqP30jH5Tx/I8ZjbFG3rUi7Op9F5uaHMrHR9WX+h/L31dCtfITFCwvQoXIZjKdHz9g1XE9/sbh+HiqU1ljzaIpwCl7NwtlET3h/P7XwL6tLV3TLD6y0wBpEZB7vu4+HyQkEFGymEp0KQwtxH512nRfeQSUog= Received: from CY4PR21MB0743.namprd21.prod.outlook.com (2603:10b6:903:b2::9) by CY4PR21MB0183.namprd21.prod.outlook.com (2603:10b6:903:ba::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.14; Thu, 9 Apr 2020 19:14:01 +0000 Received: from CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::90d:10d9:c5bc:5318]) by CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::90d:10d9:c5bc:5318%12]) with mapi id 15.20.2921.009; Thu, 9 Apr 2020 19:14:01 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , "ard.biesheuvel@arm.com" CC: "jian.j.wang@intel.com" , "hao.a.wu@intel.com" , Ard Biesheuvel Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 2/2] MdeModulePkg/DxeCore/Image: remove unused function arguments Thread-Topic: [EXTERNAL] [edk2-devel] [PATCH 2/2] MdeModulePkg/DxeCore/Image: remove unused function arguments Thread-Index: AQHWDolRBIz1+7edqEeMf9r6IyxNYahxKPUr Date: Thu, 9 Apr 2020 19:14:01 +0000 Message-ID: References: <20200409160948.23427-1-ard.biesheuvel@arm.com>,<20200409160948.23427-3-ard.biesheuvel@arm.com> In-Reply-To: <20200409160948.23427-3-ard.biesheuvel@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-04-09T19:13:56.5051883Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bret.Barkelew@microsoft.com; x-originating-ip: [71.212.145.195] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 79030e40-c1fc-4581-57ba-08d7dcba295e x-ms-traffictypediagnostic: CY4PR21MB0183: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0368E78B5B x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR21MB0743.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10019020)(4636009)(136003)(376002)(346002)(366004)(396003)(39860400002)(7696005)(55016002)(9686003)(66446008)(5660300002)(8936002)(316002)(64756008)(66556008)(81156014)(66476007)(54906003)(53546011)(6506007)(110136005)(52536014)(76116006)(66946007)(8676002)(71200400001)(478600001)(86362001)(10290500003)(4326008)(81166007)(8990500004)(966005)(2906002)(33656002)(82950400001)(82960400001)(26005)(186003);DIR:OUT;SFP:1102; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SNeY6A4q3gVElSpyq8FrlAeAKTxn4at0SVEhqEkwHvqCI4Il8ak/ME01NuS7luYaKTF5Unq7iLfjex/yjx1vYwEaOIpC6GznvjZ45q/K6zwJqxrwvYDnDPuWNtuH/jEwDcn7dCSm0+3bQOE3ZhO3mK6RMG/OvssEXYMYK86qJ/xpMG4mmktF3UrxpuodgTDsZV5pHlMDblNNr8jJ0rP94ypLsXKn0ufI9vvcb8wik3NKAXIRih2co5bTmz3bQ1vG4UdjoIItyDAhaPtP49tmZVdoyhD58ad174+y80QupmTP4B/SP7APLmh/N24Vl07cC2dvnbqhykv1RqcOeIpNOWnm1OBpZ4aeL2QihUKTVQjao3klT6qjxR35dmqV0zbqFR4XOC8j4apmBsXpa73N/NubiSBy3aGwO1Q7LsW56u8RBGHSO8YolwrJh+oXEYiG/vTLkuTOwDkdkkl8F/f8/q7OTv9SReRH3sVYyQxRpRGsVFRCTHGZzy1dSfF9QTsHheUeORATJp1L8xNO3w2qlQ== x-ms-exchange-antispam-messagedata: XFugnL5rjrZxbmdjRo1Qdh1bJOYacWZ2/Em2qoCquiZuie5nVhRkqyErKAQr4Re6OFJNs369PB5tPpBVAKoEYpsOcvbckO5ysrpzGR/SHovsmu4l8ocreZncQFIfsoIYBMCzoq4P5xKN1HnyNuqMvg== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79030e40-c1fc-4581-57ba-08d7dcba295e X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2020 19:14:01.1561 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2mOYjxQ8EQyCwr+9PD0KeyJmbQz4wrn3XuXwGX8fzlbQtztTkBjrzD76v8voDRoluacTnjzvJjj5rYpip5QFOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0183 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CY4PR21MB07435021E3A6EF94B09B4BB9EFC10CY4PR21MB0743namp_" --_000_CY4PR21MB07435021E3A6EF94B09B4BB9EFC10CY4PR21MB0743namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bret Barkelew - Bret ________________________________ From: devel@edk2.groups.io on behalf of Ard Biesheu= vel via groups.io Sent: Thursday, April 9, 2020 9:09:48 AM To: devel@edk2.groups.io Cc: jian.j.wang@intel.com ; hao.a.wu@intel.com ; Ard Biesheuvel Subject: [EXTERNAL] [edk2-devel] [PATCH 2/2] MdeModulePkg/DxeCore/Image: r= emove unused function arguments Image.c defines a CoreLoadImageCommon() function that has some arguments that are marked OPTIONAL. The function only has a single caller living in the same file, and it does not pass any arguments for these OPTIONAL arguments. So let's simplify the code, and remove these arguments and all the transitive conditional dependencies on them. Signed-off-by: Ard Biesheuvel --- NOTE: this patch was generated with the -w option, to suppress indentation changes from cluttering the diff. MdeModulePkg/Core/Dxe/Image/Image.c | 81 ++------------------ 1 file changed, 7 insertions(+), 74 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/I= mage/Image.c index aae2c1eaa516..9fdde87f2df3 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -564,13 +564,10 @@ CoreLoadPeImage ( IN BOOLEAN BootPolicy, IN VOID *Pe32Handle, IN LOADED_IMAGE_PRIVATE_DATA *Image, - IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL, - OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL, IN UINT32 Attribute ) { EFI_STATUS Status; - BOOLEAN DstBufAlocated; UINTN Size; ZeroMem (&Image->ImageContext, sizeof (Image->ImageContext)); @@ -619,15 +616,6 @@ CoreLoadPeImage ( return EFI_UNSUPPORTED; } - // - // Allocate memory of the correct memory type aligned on the required i= mage boundary - // - DstBufAlocated =3D FALSE; - if (DstBuffer =3D=3D 0) { - // - // Allocate Destination Buffer as caller did not pass it in - // - if (Image->ImageContext.SectionAlignment > EFI_PAGE_SIZE) { Size =3D (UINTN)Image->ImageContext.ImageSize + Image->ImageContext.S= ectionAlignment; } else { @@ -685,31 +673,6 @@ CoreLoadPeImage ( if (EFI_ERROR (Status)) { return Status; } - DstBufAlocated =3D TRUE; - } else { - // - // Caller provided the destination buffer - // - - if (Image->ImageContext.RelocationsStripped && (Image->ImageContext.I= mageAddress !=3D DstBuffer)) { - // - // If the image relocations were stripped, and the caller provided = a - // destination buffer address that does not match the address that = the - // image is linked at, then the image cannot be loaded. - // - return EFI_INVALID_PARAMETER; - } - - if (Image->NumberOfPages !=3D 0 && - Image->NumberOfPages < - (EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContext.ImageSize + Image-= >ImageContext.SectionAlignment))) { - Image->NumberOfPages =3D EFI_SIZE_TO_PAGES ((UINTN)Image->ImageCont= ext.ImageSize + Image->ImageContext.SectionAlignment); - return EFI_BUFFER_TOO_SMALL; - } - - Image->NumberOfPages =3D EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContex= t.ImageSize + Image->ImageContext.SectionAlignment); - Image->ImageContext.ImageAddress =3D DstBuffer; - } Image->ImageBasePage =3D Image->ImageContext.ImageAddress; if (!Image->ImageContext.IsTeImage) { @@ -790,13 +753,6 @@ CoreLoadPeImage ( } } - // - // Fill in the entry point of the image if it is available - // - if (EntryPoint !=3D NULL) { - *EntryPoint =3D Image->ImageContext.EntryPoint; - } - // // Print the load address and the PDB file name if it is available // @@ -861,11 +817,9 @@ CoreLoadPeImage ( // Free memory. // - if (DstBufAlocated) { CoreFreePages (Image->ImageContext.ImageAddress, Image->NumberOfPages); Image->ImageContext.ImageAddress =3D 0; Image->ImageBasePage =3D 0; - } if (Image->ImageContext.FixupData !=3D NULL) { CoreFreePool (Image->ImageContext.FixupData); @@ -920,8 +874,7 @@ CoreLoadedImageInfo ( STATIC VOID CoreUnloadAndCloseImage ( - IN LOADED_IMAGE_PRIVATE_DATA *Image, - IN BOOLEAN FreePage + IN LOADED_IMAGE_PRIVATE_DATA *Image ) { EFI_STATUS Status; @@ -1047,7 +1000,7 @@ CoreUnloadAndCloseImage ( // // Free the Image from memory // - if ((Image->ImageBasePage !=3D 0) && FreePage) { + if ((Image->ImageBasePage !=3D 0)) { CoreFreePages (Image->ImageBasePage, Image->NumberOfPages); } @@ -1122,10 +1075,7 @@ CoreLoadImageCommon ( IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, - IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL, - IN OUT UINTN *NumberOfPages OPTIONAL, OUT EFI_HANDLE *ImageHandle, - OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL, IN UINT32 Attribute ) { @@ -1330,12 +1280,7 @@ CoreLoadImageCommon ( Image->Info.FilePath =3D DuplicateDevicePath (FilePath); Image->Info.ParentHandle =3D ParentImageHandle; - - if (NumberOfPages !=3D NULL) { - Image->NumberOfPages =3D *NumberOfPages ; - } else { Image->NumberOfPages =3D 0 ; - } // // Install the protocol interfaces for this image @@ -1355,20 +1300,11 @@ CoreLoadImageCommon ( // // Load the image. If EntryPoint is Null, it will not be set. // - Status =3D CoreLoadPeImage (BootPolicy, &FHand, Image, DstBuffer, Entry= Point, Attribute); + Status =3D CoreLoadPeImage (BootPolicy, &FHand, Image, Attribute); if (EFI_ERROR (Status)) { - if ((Status =3D=3D EFI_BUFFER_TOO_SMALL) || (Status =3D=3D EFI_OUT_OF= _RESOURCES)) { - if (NumberOfPages !=3D NULL) { - *NumberOfPages =3D Image->NumberOfPages; - } - } goto Done; } - if (NumberOfPages !=3D NULL) { - *NumberOfPages =3D Image->NumberOfPages; - } - // // Register the image in the Debug Image Info Table if the attribute is= set // @@ -1448,7 +1384,7 @@ CoreLoadImageCommon ( // if (EFI_ERROR (Status)) { if (Image !=3D NULL) { - CoreUnloadAndCloseImage (Image, (BOOLEAN)(DstBuffer =3D=3D 0)); + CoreUnloadAndCloseImage (Image); Image =3D NULL; } } else if (EFI_ERROR (SecurityStatus)) { @@ -1524,10 +1460,7 @@ CoreLoadImage ( FilePath, SourceBuffer, SourceSize, - (EFI_PHYSICAL_ADDRESS) (UINTN) NULL, - NULL, ImageHandle, - NULL, EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION | EFI_LOAD_= PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION ); @@ -1744,7 +1677,7 @@ CoreStartImage ( // unload it // if (EFI_ERROR (Image->Status) || Image->Type =3D=3D EFI_IMAGE_SUBSYSTEM= _EFI_APPLICATION) { - CoreUnloadAndCloseImage (Image, TRUE); + CoreUnloadAndCloseImage (Image); // // ImageHandle may be invalid after the image is unloaded, so use NUL= L handle to record perf log. // @@ -1809,7 +1742,7 @@ CoreExit ( // // The image has not been started so just free its resources // - CoreUnloadAndCloseImage (Image, TRUE); + CoreUnloadAndCloseImage (Image); Status =3D EFI_SUCCESS; goto Done; } @@ -1911,7 +1844,7 @@ CoreUnloadImage ( // // if the Image was not started or Unloaded O.K. then clean up // - CoreUnloadAndCloseImage (Image, TRUE); + CoreUnloadAndCloseImage (Image); } Done: -- 2.17.1 --_000_CY4PR21MB07435021E3A6EF94B09B4BB9EFC10CY4PR21MB0743namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Reviewed-by: Bret Barkelew <bret.barkelew@micros= oft.com>

 

- Bret

 


From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of Ard Biesheuvel via groups.io <= ;ard.biesheuvel=3Darm.com@groups.io>
Sent: Thursday, April 9, 2020 9:09:48 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: jian.j.wang@intel.com <jian.j.wang@intel.com>; hao.a.wu@i= ntel.com <hao.a.wu@intel.com>; Ard Biesheuvel <ard.biesheuvel@arm.= com>
Subject: [EXTERNAL] [edk2-devel] [PATCH 2/2] MdeModulePkg/DxeCore/I= mage: remove unused function arguments
 
Image.c defines a CoreLoadImageCommon() function = that has some arguments
that are marked OPTIONAL. The function only has a single caller living in<= br> the same file, and it does not pass any arguments for these OPTIONAL
arguments.

So let's simplify the code, and remove these arguments and all the
transitive conditional dependencies on them.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---

NOTE: this patch was generated with the -w option, to suppress indentation=
changes from cluttering the diff.

 MdeModulePkg/Core/Dxe/Image/Image.c | 81 ++-----------------= -
 1 file changed, 7 insertions(+), 74 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/I= mage/Image.c
index aae2c1eaa516..9fdde87f2df3 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -564,13 +564,10 @@ CoreLoadPeImage (
   IN BOOLEAN        &nb= sp;            BootP= olicy,
   IN VOID         =             &nb= sp;  *Pe32Handle,
   IN LOADED_IMAGE_PRIVATE_DATA   *Image,
-  IN EFI_PHYSICAL_ADDRESS        = DstBuffer    OPTIONAL,
-  OUT EFI_PHYSICAL_ADDRESS       *Entr= yPoint  OPTIONAL,
   IN  UINT32       &nbs= p;             = Attribute
   )
 {
   EFI_STATUS        &nb= sp;       Status;
-  BOOLEAN          = ;         DstBufAlocated;
   UINTN         &n= bsp;           Size;
 
   ZeroMem (&Image->ImageContext, sizeof (Image->Image= Context));
@@ -619,15 +616,6 @@ CoreLoadPeImage (
     return EFI_UNSUPPORTED;
   }
 
-  //
-  // Allocate memory of the correct memory type aligned on the requi= red image boundary
-  //
-  DstBufAlocated =3D FALSE;
-  if (DstBuffer =3D=3D 0) {
-    //
-    // Allocate Destination Buffer as caller did not pass = it in
-    //
-
   if (Image->ImageContext.SectionAlignment > EFI_PAGE_SIZ= E) {
     Size =3D (UINTN)Image->ImageContext.ImageSize = + Image->ImageContext.SectionAlignment;
   } else {
@@ -685,31 +673,6 @@ CoreLoadPeImage (
   if (EFI_ERROR (Status)) {
     return Status;
   }
-    DstBufAlocated =3D TRUE;
-  } else {
-    //
-    // Caller provided the destination buffer
-    //
-
-    if (Image->ImageContext.RelocationsStripped &&a= mp; (Image->ImageContext.ImageAddress !=3D DstBuffer)) {
-      //
-      // If the image relocations were stripped,= and the caller provided a
-      // destination buffer address that does no= t match the address that the
-      // image is linked at, then the image cann= ot be loaded.
-      //
-      return EFI_INVALID_PARAMETER;
-    }
-
-    if (Image->NumberOfPages !=3D 0 &&
-        Image->NumberOfPages < -        (EFI_SIZE_TO_PAGES ((UINTN)Ima= ge->ImageContext.ImageSize + Image->ImageContext.SectionAlignment= ))) {
-      Image->NumberOfPages =3D EFI_SIZE_TO_PA= GES ((UINTN)Image->ImageContext.ImageSize + Image->ImageContext.S= ectionAlignment);
-      return EFI_BUFFER_TOO_SMALL;
-    }
-
-    Image->NumberOfPages =3D EFI_SIZE_TO_PAGES ((UINTN)= Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignm= ent);
-    Image->ImageContext.ImageAddress =3D DstBuffer;
-  }
 
   Image->ImageBasePage =3D Image->ImageContext.ImageAddre= ss;
   if (!Image->ImageContext.IsTeImage) {
@@ -790,13 +753,6 @@ CoreLoadPeImage (
     }
   }
 
-  //
-  // Fill in the entry point of the image if it is available
-  //
-  if (EntryPoint !=3D NULL) {
-    *EntryPoint =3D Image->ImageContext.EntryPoint;
-  }
-
   //
   // Print the load address and the PDB file name if it is avai= lable
   //
@@ -861,11 +817,9 @@ CoreLoadPeImage (
   // Free memory.
   //
 
-  if (DstBufAlocated) {
   CoreFreePages (Image->ImageContext.ImageAddress, Image->= ;NumberOfPages);
   Image->ImageContext.ImageAddress =3D 0;
   Image->ImageBasePage =3D 0;
-  }
 
   if (Image->ImageContext.FixupData !=3D NULL) {
     CoreFreePool (Image->ImageContext.FixupData);<= br> @@ -920,8 +874,7 @@ CoreLoadedImageInfo (
 STATIC
 VOID
 CoreUnloadAndCloseImage (
-  IN LOADED_IMAGE_PRIVATE_DATA  *Image,
-  IN BOOLEAN         &n= bsp;          FreePage
+  IN LOADED_IMAGE_PRIVATE_DATA  *Image
   )
 {
   EFI_STATUS        &nb= sp;            =      Status;
@@ -1047,7 +1000,7 @@ CoreUnloadAndCloseImage (
   //
   // Free the Image from memory
   //
-  if ((Image->ImageBasePage !=3D 0) && FreePage) {
+  if ((Image->ImageBasePage !=3D 0)) {
     CoreFreePages (Image->ImageBasePage, Image->= ;NumberOfPages);
   }
 
@@ -1122,10 +1075,7 @@ CoreLoadImageCommon (
   IN  EFI_DEVICE_PATH_PROTOCOL    &nbs= p;    *FilePath,
   IN  VOID        =             &nb= sp;        *SourceBuffer  &nbs= p;    OPTIONAL,
   IN  UINTN        = ;            &n= bsp;       SourceSize,
-  IN  EFI_PHYSICAL_ADDRESS      &= nbsp;      DstBuffer     =       OPTIONAL,
-  IN OUT UINTN         =             &nb= sp;   *NumberOfPages      OPTIONAL,
   OUT EFI_HANDLE        = ;            &n= bsp;  *ImageHandle,
-  OUT EFI_PHYSICAL_ADDRESS       =       *EntryPoint     &nb= sp;   OPTIONAL,
   IN  UINT32       &nbs= p;            &= nbsp;      Attribute
   )
 {
@@ -1330,12 +1280,7 @@ CoreLoadImageCommon (
   Image->Info.FilePath     =3D Duplicate= DevicePath (FilePath);
   Image->Info.ParentHandle =3D ParentImageHandle;
 
-
-  if (NumberOfPages !=3D NULL) {
-    Image->NumberOfPages =3D *NumberOfPages ;
-  } else {
   Image->NumberOfPages =3D 0 ;
-  }
 
   //
   // Install the protocol interfaces for this image
@@ -1355,20 +1300,11 @@ CoreLoadImageCommon (
   //
   // Load the image.  If EntryPoint is Null, it will not b= e set.
   //
-  Status =3D CoreLoadPeImage (BootPolicy, &FHand, Image, DstBuff= er, EntryPoint, Attribute);
+  Status =3D CoreLoadPeImage (BootPolicy, &FHand, Image, Att= ribute);
   if (EFI_ERROR (Status)) {
-    if ((Status =3D=3D EFI_BUFFER_TOO_SMALL) || (Status = =3D=3D EFI_OUT_OF_RESOURCES)) {
-      if (NumberOfPages !=3D NULL) {
-        *NumberOfPages =3D Image->N= umberOfPages;
-      }
-    }
     goto Done;
   }
 
-  if (NumberOfPages !=3D NULL) {
-    *NumberOfPages =3D Image->NumberOfPages;
-  }
-
   //
   // Register the image in the Debug Image Info Table if the at= tribute is set
   //
@@ -1448,7 +1384,7 @@ CoreLoadImageCommon (
   //
   if (EFI_ERROR (Status)) {
     if (Image !=3D NULL) {
-      CoreUnloadAndCloseImage (Image, (BOOLEAN)(= DstBuffer =3D=3D 0));
+      CoreUnloadAndCloseImage (Image);
       Image =3D NULL;
     }
   } else if (EFI_ERROR (SecurityStatus)) {
@@ -1524,10 +1460,7 @@ CoreLoadImage (
            &n= bsp; FilePath,
            &n= bsp; SourceBuffer,
            &n= bsp; SourceSize,
-             = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL,
-             = NULL,
            &n= bsp; ImageHandle,
-             = NULL,
            &n= bsp; EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION | EFI_LOAD_PE_IMAGE_A= TTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION
            &n= bsp; );
 
@@ -1744,7 +1677,7 @@ CoreStartImage (
   // unload it
   //
   if (EFI_ERROR (Image->Status) || Image->Type =3D=3D EFI= _IMAGE_SUBSYSTEM_EFI_APPLICATION) {
-    CoreUnloadAndCloseImage (Image, TRUE);
+    CoreUnloadAndCloseImage (Image);
     //
     // ImageHandle may be invalid after the image is = unloaded, so use NULL handle to record perf log.
     //
@@ -1809,7 +1742,7 @@ CoreExit (
     //
     // The image has not been started so just free it= s resources
     //
-    CoreUnloadAndCloseImage (Image, TRUE);
+    CoreUnloadAndCloseImage (Image);
     Status =3D EFI_SUCCESS;
     goto Done;
   }
@@ -1911,7 +1844,7 @@ CoreUnloadImage (
     //
     // if the Image was not started or Unloaded O.K. = then clean up
     //
-    CoreUnloadAndCloseImage (Image, TRUE);
+    CoreUnloadAndCloseImage (Image);
   }
 
 Done:
--
2.17.1




--_000_CY4PR21MB07435021E3A6EF94B09B4BB9EFC10CY4PR21MB0743namp_--