From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 97E3320945C0B for ; Tue, 12 Sep 2017 00:55:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 877374E028; Tue, 12 Sep 2017 07:58:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 877374E028 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-50.rdu2.redhat.com [10.10.120.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6555756D9; Tue, 12 Sep 2017 07:58:41 +0000 (UTC) To: "Bi, Dandan" , edk2-devel-01 Cc: "Ni, Ruiyu" , "Dong, Eric" , "Zeng, Star" , Ard Biesheuvel References: <20170910001304.8628-1-lersek@redhat.com> <20170910001304.8628-5-lersek@redhat.com> <3C0D5C461C9E904E8F62152F6274C0BB3B96FA5D@shsmsx102.ccr.corp.intel.com> From: Laszlo Ersek Message-ID: <8e68d0c5-76c0-8a1d-bd38-5bb1a6c6b918@redhat.com> Date: Tue, 12 Sep 2017 09:58:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <3C0D5C461C9E904E8F62152F6274C0BB3B96FA5D@shsmsx102.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 12 Sep 2017 07:58:43 +0000 (UTC) Subject: Re: [PATCH 4/5] MdeModulePkg/PartitionDxe: don't divide 64-bit values with C operators X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 07:55:47 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/12/17 07:41, Bi, Dandan wrote: > Hi Laszlo, > > When do you plan to push this patch? IA32 build is blocked for this issue now. I was ready to push the series yesterday; I just hoped I'd get review feedback from MdeModulePkg maintainers as well, and/or from Ray, in one or two days. These are strongly localized changes that require no knowledge of the UDF driver. (I don't have that knowledge myself, to begin with.) At least an Acked-by would be nice. If someone from Intel tells me I can push this with the R-b's that are currently on the list, I'm totally game. Thanks! Laszlo > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Laszlo Ersek > Sent: Sunday, September 10, 2017 8:13 AM > To: edk2-devel-01 > Cc: Ni, Ruiyu ; Dong, Eric ; Zeng, Star ; Ard Biesheuvel > Subject: [edk2] [PATCH 4/5] MdeModulePkg/PartitionDxe: don't divide 64-bit values with C operators > > In edk2, the division and shifting of 64-bit values are forbidden with C-language operators, because the compiler may generate intrinsic calls for them. > > For example, clang-3.8 emits a call to "__umoddi3" for > > UDF_LOGICAL_SECTOR_SIZE % Media->BlockSize > > in PartitionInstallUdfChildHandles(), if PartitionDxe is built for IA32, which then fails to link. > > UDF_LOGICAL_SECTOR_SIZE has type UINT64, while EFI_BLOCK_IO_MEDIA.BlockSize has type UINT32(). Replace the % operator with a DivU64x32Remainder() call. > > Cc: Ard Biesheuvel > Cc: Eric Dong > Cc: Paulo Alcantara > Cc: Ruiyu Ni > Cc: Star Zeng > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Laszlo Ersek > --- > MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c > index c1d44809bfd2..c491ef25f47e 100644 > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c > @@ -234,10 +234,11 @@ PartitionInstallUdfChildHandles ( > IN EFI_BLOCK_IO_PROTOCOL *BlockIo, > IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, > IN EFI_DEVICE_PATH_PROTOCOL *DevicePath > ) > { > + UINT32 RemainderByMediaBlockSize; > EFI_STATUS Status; > EFI_BLOCK_IO_MEDIA *Media; > EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; > EFI_GUID *VendorDefinedGuid; > EFI_GUID UdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID; > @@ -246,11 +247,16 @@ PartitionInstallUdfChildHandles ( > Media = BlockIo->Media; > > // > // Check if UDF logical block size is multiple of underlying device block size > // > - if ((UDF_LOGICAL_SECTOR_SIZE % Media->BlockSize) != 0 || > + DivU64x32Remainder ( > + UDF_LOGICAL_SECTOR_SIZE, // Dividend > + Media->BlockSize, // Divisor > + &RemainderByMediaBlockSize // Remainder > + ); > + if (RemainderByMediaBlockSize != 0 || > Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE) { > return EFI_NOT_FOUND; > } > > DevicePathNode = DevicePath; > -- > 2.14.1.3.gb7cf6e02401b > > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel >