From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 4B40120945C16 for ; Mon, 11 Sep 2017 22:38:23 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 11 Sep 2017 22:41:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,382,1500966000"; d="scan'208";a="134326713" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 11 Sep 2017 22:41:19 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 11 Sep 2017 22:41:19 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 11 Sep 2017 22:41:18 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.39]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.219]) with mapi id 14.03.0319.002; Tue, 12 Sep 2017 13:41:17 +0800 From: "Bi, Dandan" To: Laszlo Ersek , edk2-devel-01 CC: "Ni, Ruiyu" , "Dong, Eric" , "Zeng, Star" , Ard Biesheuvel Thread-Topic: [edk2] [PATCH 4/5] MdeModulePkg/PartitionDxe: don't divide 64-bit values with C operators Thread-Index: AQHTKcmmHt7LuJNXo0WnKGhucozg7aKwvunQ Date: Tue, 12 Sep 2017 05:41:16 +0000 Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB3B96FA5D@shsmsx102.ccr.corp.intel.com> References: <20170910001304.8628-1-lersek@redhat.com> <20170910001304.8628-5-lersek@redhat.com> In-Reply-To: <20170910001304.8628-5-lersek@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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 05:38:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Laszlo, When do you plan to push this patch? IA32 build is blocked for this issue n= ow. Thanks, Dandan -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Lasz= lo 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-la= nguage operators, because the compiler may generate intrinsic calls for the= m. 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, wh= ich 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 =3D EFI_UDF_DEVICE_PATH_GUID= ; @@ -246,11 +247,16 @@ PartitionInstallUdfChildHandles ( Media =3D BlockIo->Media; =20 // // Check if UDF logical block size is multiple of underlying device bloc= k size // - if ((UDF_LOGICAL_SECTOR_SIZE % Media->BlockSize) !=3D 0 || + DivU64x32Remainder ( + UDF_LOGICAL_SECTOR_SIZE, // Dividend + Media->BlockSize, // Divisor + &RemainderByMediaBlockSize // Remainder + ); + if (RemainderByMediaBlockSize !=3D 0 || Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE) { return EFI_NOT_FOUND; } =20 DevicePathNode =3D DevicePath; -- 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel