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.9822.1584021792767348894 for ; Thu, 12 Mar 2020 07:03:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=UrCLilf7; spf=pass (domain: nuviainc.com, ip: 209.85.221.66, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f66.google.com with SMTP id s14so7635515wrt.8 for ; Thu, 12 Mar 2020 07:03:12 -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=8vITw0SWjDRzRb+Kmq+vz7FO3vLIbqmclLL3i3P3VyU=; b=UrCLilf7wS2qkUyiQR/s/+nK+2zYm7TFlHwZruH4ZKVh+Abe0GgdaVr7sNGRjUf1LV MQhyo3W9+xwpDd9ECqyvPsQduQNJ1M4o43wvTIlICp2BzcKTSTdPAtzL4c3mE37O/1B1 idS829WKD4ATFEO9jP6IqM1nil3+Pn9l4C8BUgJM8nb7bwWO1ggsRChdvV2XjzEBV6Eh IOwsNrwbBBG8T0lvGmrFVMPJ4A53uVENarVJFZdtyAbWc95nbG8wRagEbiC4yJsdFFKd ZlsWKp63wX6rI2RyyvoxWSseEUziTMtD7PrpQRBs40INqDLTWZ9Vqu6+yYdaRnUZMoPF XDeQ== 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=8vITw0SWjDRzRb+Kmq+vz7FO3vLIbqmclLL3i3P3VyU=; b=h7XfK6Gz+EuzD8ii1f0hlqUW8i2zOa95ZKvOm3l1O4hxRzVSZV2dyjw9MTpVSUelmX /bq50VkWdtudug2kSCSq0CfQuF4X2Yl1wLN404NuXsXSSJH9BmlcaLTIAq5kL+cULjIR qk+oVCd0My22cvObC2Vqev/hpcuHk5MlZ6OVr/hhB9Rs6T0ZcseZIJULIfKrZudpZNmW 9wq0n0yB7rT/GcfT7TI3DMXVWSkRgs5jL68wjyp2cMXxFZdSPDMiA8caii8xWYMm+lQo 5AgHWynU2XgUik4HBlUaFQjjjv1QChFBpJJbr3JLEzSRFRJqeu6vIT8jexnCIwqz/iXf HK2g== X-Gm-Message-State: ANhLgQ0iy0IIcEwerxGa3wosgBcE86A6rHLXbLtn5ctZ4fTg59Aeba81 9qbvnh2u1hTYf5bFK1dkZ7cfrw== X-Google-Smtp-Source: ADFU+vtVwOGS8ugJz2kdvjF+E7KkCN5pyPClalSIVTCC/WT8goKDybbwlXS+ZMU/XeeAs4ARih6l3g== X-Received: by 2002:a5d:674a:: with SMTP id l10mr11506379wrw.148.1584021791217; Thu, 12 Mar 2020 07:03:11 -0700 (PDT) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id u20sm12775916wmj.14.2020.03.12.07.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 07:03:09 -0700 (PDT) Date: Thu, 12 Mar 2020 14:03:06 +0000 From: "Leif Lindholm" To: "Schaefer, Daniel (DualStudy)" Cc: "devel@edk2.groups.io" , "Chang, Abner (HPS SW/FW Technologist)" , "Chen, Gilbert" , "afish@apple.com" , "michael.d.kinney@intel.com" , "pete@akeo.ie" , Ard Biesheuvel , Laszlo Ersek Subject: Re: [edk2-devel] [PATCH v2 3/3] MdeModulePkg: Use CopyMem instead of GUID assignment Message-ID: <20200312140304.GF23627@bivouac.eciton.net> References: <20200302103238.25726-1-daniel.schaefer@hpe.com> <20200302103238.25726-4-daniel.schaefer@hpe.com> <20200312105528.GC23627@bivouac.eciton.net> <539c8673-786c-9c58-98cc-ab470b345740@hpe.com> MIME-Version: 1.0 In-Reply-To: <539c8673-786c-9c58-98cc-ab470b345740@hpe.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline +Ard, Laszlo. I think it would make sense to move it to MdeModulePkg (or MdePkg) and rename it BaseCompilerIntrinsicsLib (it *is* a BASE library). As I alluded in my reply to Ray - x86 also have this problem, but to a lesser extent, and ended up creating library functions to call instead of using plain C for certain operations. Which was probably the right decision when it was restricted to a very few corner cases. / Leif On Thu, Mar 12, 2020 at 13:24:30 +0000, Schaefer, Daniel (DualStudy) wrote: > Hi Leif, > > you're right. If I revert my commit and include > NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf > without making any changes to it, the build succeeds. > > What do others think? (cc Michael, Pete, Andrew, Ard, who have made changes to this module) > Is this a big hack or should we use it in RISC-V, too and move the module to MdeModulePkg? > Why isn't this a problem on x86? Was it fine on Itanium? > > - Daniel > > ________________________________ > From: devel@edk2.groups.io on behalf of Leif Lindholm > Sent: Thursday, March 12, 2020 11:55 > To: devel@edk2.groups.io ; Schaefer, Daniel (DualStudy) > Cc: Chang, Abner (HPS SW/FW Technologist) ; Chen, Gilbert ; Dandan Bi ; Eric Dong > Subject: Re: [edk2-devel] [PATCH v2 3/3] MdeModulePkg: Use CopyMem instead of GUID assignment > > Hi Daniel, > > There is nothing wrong with this patch that just went in (and I should > have called out sooner if I wanted to stop it), but I think a better > solution is to implement a RISC-V variant of > ArmPkg/Library/CompilerIntrinsicsLib/. > > It is perfectly valid for the compiler to generate memcpy calls in > response to struct operations that are perfectly valid C. > > In fact, we could consider moving the ArmPkg one over into > MdeModulePkg. I have a feeling that including a > NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf > in your current build would be an alternative solution to your > compilation error. > > / > Leif > > On Mon, Mar 02, 2020 at 11:32:38 +0100, Daniel Schaefer wrote: > > GCC translates a simple assignment to memcpy, which EDKII doesn't provide. > > See: https://www.mail-archive.com/edk2-devel@lists.01.org/msg11928.html > > > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2547 > > > > Signed-off-by: Daniel Schaefer > > Cc: Abner Chang > > Cc: Gilbert Chen > > Cc: Leif Lindholm > > Cc: Dandan Bi > > Cc: Eric Dong > > --- > > > > Notes: > > v2: > > - Use CopyMem instead of CopyGuid [Dandan] > > > > MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c > > index 5cc527679a78..0540e6fa8a44 100644 > > --- a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c > > +++ b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c > > @@ -619,7 +619,7 @@ CreateDeviceManagerForm( > > TokenHelp = HiiSetString (HiiHandle, 0, String, NULL); > > FreePool (String); > > > > - FormSetGuid = ((EFI_IFR_FORM_SET *)Ptr)->Guid; > > + CopyMem (&FormSetGuid, &((EFI_IFR_FORM_SET *) Ptr)->Guid, sizeof (EFI_GUID)); > > > > // > > // Network device process > > -- > > 2.25.0 > > > > > > > > > > >