From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web12.504.1606870364400817074 for ; Tue, 01 Dec 2020 16:52:45 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Wed, 02 Dec 2020 08:52:34 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , Cc: "'Jian J Wang'" , "'Hao A Wu'" , "'Jordan Justen'" , "'Ard Biesheuvel'" References: <20201201182651.32218-1-cheptsov@ispras.ru> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIXSBNZGVNb2R1bGVQa2c6IEZpeCB1bmRlZmluZWQgcmVmZXJlbmNlIHRvIG1lbWNweSB3aXRoIFhDT0RFNQ==?= Date: Wed, 2 Dec 2020 08:52:39 +0800 Message-ID: <011401d6c845$6f06e5f0$4d14b1d0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQGeSAkaSgvbZ1L+IJn8XDdnuX1rzAEygXFuqkpmZeA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn I agree this fix. We should use the pointer to structure as the function pa= rameter.=20 Reviewed-by: Liming Gao Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: bounce+27952+68148+4905953+8761045@groups.i= o > =E4=BB=A3=E8=A1=A8 Laszlo= Ersek > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B412=E6=9C=882=E6=97=A5= 4:39 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; cheptsov@ispras.ru > =E6=8A=84=E9=80=81: Jian J Wang ; Hao A Wu > ; Jordan Justen ; Ard > Biesheuvel > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH] MdeModulePkg: Fix undefined= reference to > memcpy with XCODE5 >=20 > On 12/01/20 19:26, Vitaly Cheptsov wrote: > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3098 > > > > XCODE5 toolchain in NOOPT mode generates memcpy when trying > > to copy PEI_CORE_FV_HANDLE structure. This breaks OVMF > > compilation with XCODE5. > > > > CC: Jian J Wang > > CC: Hao A Wu > > CC: Jordan Justen > > CC: Laszlo Ersek > > CC: Ard Biesheuvel > > Signed-off-by: Vitaly Cheptsov > > --- > > MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 4 ++-- > > MdeModulePkg/Core/Pei/PeiMain.h | 2 +- > > MdeModulePkg/Core/Pei/Ppi/Ppi.c | 10 +++++----- > > 3 files changed, 8 insertions(+), 8 deletions(-) > > > > diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c > b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c > > index b9a279e..3369585 100644 > > --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c > > +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c > > @@ -1256,13 +1256,13 @@ EvacuateTempRam ( > > } > > for (FvIndex =3D 0; FvIndex < Private->FvCount; FvIndex++) { > > if (Private->Fv[FvIndex].FvHandle =3D=3D PeiCoreFvHandle.FvHandle= ) { > > - PeiCoreFvHandle =3D Private->Fv[FvIndex]; > > + CopyMem (&PeiCoreFvHandle, &Private->Fv[FvIndex], sizeof > (PEI_CORE_FV_HANDLE)); > > break; > > } > > } > > Status =3D EFI_SUCCESS; >=20 > I'm too tired to review this patch now (hello MdeModulePkg reviewers), > but the idea is correct -- "PeiCoreFvHandle" has type > PEI_CORE_FV_HANDLE, from "MdeModulePkg/Core/Pei/PeiMain.h", and it is > a > structure type. Structure assignment is indeed not allowed in edk2. >=20 > Thanks > Laszlo >=20 > > > > - ConvertPeiCorePpiPointers (Private, PeiCoreFvHandle); > > + ConvertPeiCorePpiPointers (Private, &PeiCoreFvHandle); > > > > for (FvIndex =3D 0; FvIndex < Private->FvCount; FvIndex++) { > > FvHeader =3D Private->Fv[FvIndex].FvHeader; > > diff --git a/MdeModulePkg/Core/Pei/PeiMain.h > b/MdeModulePkg/Core/Pei/PeiMain.h > > index c27e8fc..daa48b4 100644 > > --- a/MdeModulePkg/Core/Pei/PeiMain.h > > +++ b/MdeModulePkg/Core/Pei/PeiMain.h > > @@ -542,7 +542,7 @@ ConvertPpiPointersFv ( > > VOID > > ConvertPeiCorePpiPointers ( > > IN PEI_CORE_INSTANCE *PrivateData, > > - PEI_CORE_FV_HANDLE CoreFvHandle > > + IN PEI_CORE_FV_HANDLE *CoreFvHandle > > ); > > > > /** > > diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c > b/MdeModulePkg/Core/Pei/Ppi/Ppi.c > > index 541047d..0ad71d1 100644 > > --- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c > > +++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c > > @@ -1062,7 +1062,7 @@ ProcessPpiListFromSec ( > > VOID > > ConvertPeiCorePpiPointers ( > > IN PEI_CORE_INSTANCE *PrivateData, > > - PEI_CORE_FV_HANDLE CoreFvHandle > > + IN PEI_CORE_FV_HANDLE *CoreFvHandle > > ) > > { > > EFI_FV_FILE_INFO FileInfo; > > @@ -1079,16 +1079,16 @@ ConvertPeiCorePpiPointers ( > > // > > // Find the PEI Core in the BFV in temporary memory. > > // > > - Status =3D CoreFvHandle.FvPpi->FindFileByType ( > > - CoreFvHandle.FvPpi, > > + Status =3D CoreFvHandle->FvPpi->FindFileByType ( > > + CoreFvHandle->FvPpi, > > EFI_FV_FILETYPE_PEI_CORE, > > - CoreFvHandle.FvHandle, > > + CoreFvHandle->FvHandle, > > &PeiCoreFileHandle > > ); > > ASSERT_EFI_ERROR (Status); > > > > if (!EFI_ERROR (Status)) { > > - Status =3D CoreFvHandle.FvPpi->GetFileInfo (CoreFvHandle.FvPpi, > PeiCoreFileHandle, &FileInfo); > > + Status =3D CoreFvHandle->FvPpi->GetFileInfo (CoreFvHandle->FvPpi, > PeiCoreFileHandle, &FileInfo); > > ASSERT_EFI_ERROR (Status); > > > > Status =3D PeiGetPe32Data (PeiCoreFileHandle, &PeiCoreImageBase); > > >=20 >=20 >=20 >=20 >=20