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.web09.2797.1618276596467738202 for ; Mon, 12 Apr 2021 18:16:37 -0700 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 ; Tue, 13 Apr 2021 09:16:05 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Michael D Kinney'" , "'Zhiguang Liu'" References: <20210412150718.71002-1-naitaku@gmail.com> <20210412150718.71002-2-naitaku@gmail.com> In-Reply-To: <20210412150718.71002-2-naitaku@gmail.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYxIDEvMV0gRml4IEFzbVJlYWRNc3I2NCgpIGFuZCBBc21Xcml0ZU1zcjY0KCkgd2l0aCBHQ0MgdG9vbGNoYWlu?= Date: Tue, 13 Apr 2021 09:16:13 +0800 Message-ID: <00d401d73002$98a61cd0$c9f25670$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQF5N7DSd2H4VmHoFigR+Va7g11WMAMt5lC7q1QlqWA= Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Naito: The fix is correct. Reviewed-by: Liming Gao Thanks Liming=20 > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA= =B1=ED Takuto Naito > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA4=D4=C212=C8=D5 23:07 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Takuto Naito ; Michael D Kinney > ; Liming Gao ; > Zhiguang Liu > =D6=F7=CC=E2: [edk2-devel] [PATCH v1 1/1] Fix AsmReadMsr64() and AsmWrit= eMsr64() > with GCC toolchain >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3325 >=20 > 1. AsmReadMsr64() in X64/GccInlinePriv.c > AsmReadMsr64 can return uninitialized value if FilterBeforeMsrRead > returns False. This causes build error with the CLANG toolchain. >=20 > 2. AsmWriteMsr64() in X64/GccInlinePriv.c > In the case that FilterBeforeMsrWrite changes Value and returns True, > The original Value, not the changed Value, is written to the MSR. > This behavior is different from the one of AsmWriteMsr64() in > X64/WriteMsr64.c for the MSFT toolchain. >=20 > Signed-off-by: Takuto Naito > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Zhiguang Liu > --- > MdePkg/Library/BaseLib/X64/GccInlinePriv.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) >=20 > diff --git a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c > b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c > index e4920f2116..244bd62ee6 100644 > --- a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c > +++ b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c > @@ -80,7 +80,7 @@ AsmReadMsr64 ( > } > FilterAfterMsrRead (Index, &Value); >=20 > - return (((UINT64)HighData) << 32) | LowData; > + return Value; > } >=20 > /** > @@ -111,11 +111,10 @@ AsmWriteMsr64 ( > UINT32 HighData; > BOOLEAN Flag; >=20 > - LowData =3D (UINT32)(Value); > - HighData =3D (UINT32)(Value >> 32); > - > Flag =3D FilterBeforeMsrWrite (Index, &Value); > if (Flag) { > + LowData =3D (UINT32)(Value); > + HighData =3D (UINT32)(Value >> 32); > __asm__ __volatile__ ( > "wrmsr" > : > -- > 2.31.1 >=20 >=20 >=20 >=20 >=20