From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web12.22186.1595433593719315853 for ; Wed, 22 Jul 2020 08:59:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=CYGqnD2q; spf=pass (domain: nuviainc.com, ip: 209.85.221.66, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f66.google.com with SMTP id b6so2396574wrs.11 for ; Wed, 22 Jul 2020 08:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=X3f+xfkGE0jN7bdYYwXvGCKEkQIvvcd7MG/+fHVnodo=; b=CYGqnD2qVMGhgVraRQBSHhhV5O4X3NaQrILxPkc/sRmWrfMZnukByk6+NXsN7lKZet 0wjCrEWXeK/6K8xLXKlCtXDS7G4nvHJiHGtGEEwrp9zxMRKroBX8gsTJzHDG/WOEbHg6 IsLUzTduMz5EfYBcxrmetguDq7iOG2vC1yYxl8idpvhlmeuBF0rwi2IiuwWt/IeVR5Dh Rp6ixxx6g+eI5fSBVvHJKlo5fUphwwVdz/YI/7DL5tXoaNYjfsDJM2v0UNIe0eh3RYQp gF4r+uh9Zxf9RXIIt+0EG2mBUi67lJWnhkTUD3o30Iih8pDxDbmlpBiqbIXSmFENOT44 awyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=X3f+xfkGE0jN7bdYYwXvGCKEkQIvvcd7MG/+fHVnodo=; b=r4ipel1RLyCRJVT+rB/xIDO+9BsdPLQzA5WDsWSaNeFpyeR1sIjjZb3g2C9F8/ucCd KwfRr80kFiBfssSAGkz2JNxf3y36XfPhZaZVc8zxIQ3BqyqOIWRNTXVpW5PGw5UUCW4w zBQIyRoqX6a4Al+0s2bjrp+fT9uCE2XdFHKIuzujFDob4NqR1M7pMOH839ETR+bGy4mf JTTQDZOw8h/qJt87MhDONAm/vQ30yJR4vap5yo9jwmoTx1UQNvQWH6kjP3Gq/OrDOlvn 0JyG7TcPtC/kQkwLb8rKsh+WNllz+zqMTpOjFANGRxMoeEkVbq9IAzj67ynI+U5/eDgf Gq+g== X-Gm-Message-State: AOAM5305oe8RRJTBzF6zxV1q9lUYnjueSFd3LdoCPt7xO4+ip45pTlUx ctpmffEiYgPWv/wVopL9xtuRaw== X-Google-Smtp-Source: ABdhPJyhXVD8G2AsIttDGcPX+AFepHUisuAwYtVZsV6GJEneRabYZZZ6QZ08er0ivFyL1nPIzJI1xg== X-Received: by 2002:adf:82f6:: with SMTP id 109mr238841wrc.25.1595433592200; Wed, 22 Jul 2020 08:59:52 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id c25sm163597wml.18.2020.07.22.08.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 08:59:51 -0700 (PDT) Date: Wed, 22 Jul 2020 16:59:49 +0100 From: "Leif Lindholm" To: PierreGondois Cc: devel@edk2.groups.io, ard.biesheuvel@arm.com, nd@arm.com Subject: Re: [PATCH v1 1/2] EmbeddedPkg: Fix build error for MmcDxe Message-ID: <20200722155949.GF1337@vanye> References: <20200630104901.11648-1-pierre.gondois@arm.com> <20200630104901.11648-2-pierre.gondois@arm.com> MIME-Version: 1.0 In-Reply-To: <20200630104901.11648-2-pierre.gondois@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 30, 2020 at 11:49:00 +0100, PierreGondois wrote: > From: Pierre Gondois > > The following command line: > build -b NOOPT -a IA32 -t VS2017 -p edk2\EmbeddedPkg\EmbeddedPkg.dsc > > Generates the following error: > MmcDxe.lib(Diagnostics.obj) : error LNK2001: > unresolved external symbol __allshl > MmcDxe.lib(Diagnostics.obj) : error LNK2001: > unresolved external symbol __aullshr > MmcDxe.lib(MmcBlockIo.obj) : error LNK2001: > unresolved external symbol __allmul > > These erros are due to the use of shift/multiply operations > on UINT64 variable on a IA32 architecture. Apart from how Ia32 should just bite the bullet and implement a CompilerIntrinsicsLib for VS so the rest of us can go back to writing C: Reviewed-by: Leif Lindholm > Signed-off-by: Pierre Gondois > --- > > The changes can be seen at: https://github.com/PierreARM/edk2/commits/831_Fix_VS2017_build_error_v1 > > Notes: > v1: > - Fix VS2017 build errors. [Pierre] > > EmbeddedPkg/Universal/MmcDxe/Diagnostics.c | 10 +++++++--- > EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c | 6 +++--- > 2 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c > index 20defeb8745a2eb243f316ba9d4e0d03016e260b..49b069043093544a3cbadc46fda4de483803d638 100644 > --- a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c > +++ b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c > @@ -1,7 +1,7 @@ > /** @file > Diagnostics Protocol implementation for the MMC DXE driver > > - Copyright (c) 2011-2014, ARM Limited. All rights reserved. > + Copyright (c) 2011-2020, ARM Limited. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -56,7 +56,7 @@ GenerateRandomBuffer ( > UINT64* Buffer64 = (UINT64*)Buffer; > > for (i = 0; i < (BufferSize >> 3); i++) { > - *Buffer64 = i | (~i << 32); > + *Buffer64 = i | LShiftU64 (~i, 32); > Buffer64++; > } > } > @@ -227,7 +227,11 @@ MmcDriverDiagnosticsRunDiagnostics ( > > // LBA=10 Size=BlockSize > DiagnosticLog (L"MMC Driver Diagnostics - Test: Any Block\n"); > - Status = MmcReadWriteDataTest (MmcHostInstance, MmcHostInstance->BlockIo.Media->LastBlock >> 1, MmcHostInstance->BlockIo.Media->BlockSize); > + Status = MmcReadWriteDataTest ( > + MmcHostInstance, > + RShiftU64 (MmcHostInstance->BlockIo.Media->LastBlock, 1), > + MmcHostInstance->BlockIo.Media->BlockSize > + ); > > // LBA=LastBlock Size=BlockSize > DiagnosticLog (L"MMC Driver Diagnostics - Test: Last Block\n"); > diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c > index b508c466d9c5c52ffff7855ea32cbd427927e27b..2a5d72d4daf6045e691e51d5b82ed8e6fb721121 100644 > --- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c > +++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c > @@ -1,6 +1,6 @@ > /** @file > * > -* Copyright (c) 2011-2015, ARM Limited. All rights reserved. > +* Copyright (c) 2011-2020, ARM Limited. All rights reserved. > * > * SPDX-License-Identifier: BSD-2-Clause-Patent > * > @@ -149,7 +149,7 @@ MmcTransferBlock ( > if (MmcHostInstance->CardInfo.OCRData.AccessMode & SD_CARD_CAPACITY) { > CmdArg = Lba; > } else { > - CmdArg = Lba * This->Media->BlockSize; > + CmdArg = MultU64x32 (Lba, This->Media->BlockSize); > } > } else { > //Set command argument based on the card access mode (Byte mode or Block mode) > @@ -157,7 +157,7 @@ MmcTransferBlock ( > MMC_OCR_ACCESS_SECTOR) { > CmdArg = Lba; > } else { > - CmdArg = Lba * This->Media->BlockSize; > + CmdArg = MultU64x32 (Lba, This->Media->BlockSize); > } > } > > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >