public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "gaoliming" <gaoliming@byosoft.com.cn>
To: <devel@edk2.groups.io>, <naitaku@gmail.com>
Cc: "'Michael D Kinney'" <michael.d.kinney@intel.com>,
	"'Zhiguang Liu'" <zhiguang.liu@intel.com>
Subject: 回复: [edk2-devel] [PATCH v1 1/1] Fix AsmReadMsr64() and AsmWriteMsr64() with GCC toolchain
Date: Tue, 13 Apr 2021 09:16:13 +0800	[thread overview]
Message-ID: <00d401d73002$98a61cd0$c9f25670$@byosoft.com.cn> (raw)
In-Reply-To: <20210412150718.71002-2-naitaku@gmail.com>

Naito:
  The fix is correct. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

Thanks
Liming 
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Takuto Naito
> 发送时间: 2021年4月12日 23:07
> 收件人: devel@edk2.groups.io
> 抄送: Takuto Naito <naitaku@gmail.com>; Michael D Kinney
> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Zhiguang Liu <zhiguang.liu@intel.com>
> 主题: [edk2-devel] [PATCH v1 1/1] Fix AsmReadMsr64() and AsmWriteMsr64()
> with GCC toolchain
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3325
> 
> 1. AsmReadMsr64() in X64/GccInlinePriv.c
> AsmReadMsr64 can return uninitialized value if FilterBeforeMsrRead
> returns False. This causes build error with the CLANG toolchain.
> 
> 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.
> 
> Signed-off-by: Takuto Naito <naitaku@gmail.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> ---
>  MdePkg/Library/BaseLib/X64/GccInlinePriv.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> 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);
> 
> -  return (((UINT64)HighData) << 32) | LowData;
> +  return Value;
>  }
> 
>  /**
> @@ -111,11 +111,10 @@ AsmWriteMsr64 (
>    UINT32 HighData;
>    BOOLEAN Flag;
> 
> -  LowData  = (UINT32)(Value);
> -  HighData = (UINT32)(Value >> 32);
> -
>    Flag = FilterBeforeMsrWrite (Index, &Value);
>    if (Flag) {
> +    LowData  = (UINT32)(Value);
> +    HighData = (UINT32)(Value >> 32);
>      __asm__ __volatile__ (
>        "wrmsr"
>        :
> --
> 2.31.1
> 
> 
> 
> 
> 




  reply	other threads:[~2021-04-13  1:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 15:07 [PATCH v1 0/1] Fix AsmReadMsr64() and AsmWriteMsr64() with GCC toolchain Takuto Naito
2021-04-12 15:07 ` [PATCH v1 1/1] " Takuto Naito
2021-04-13  1:16   ` gaoliming [this message]
     [not found]   ` <167545FDCFB469C8.2444@groups.io>
2021-04-14  1:28     ` 回复: [edk2-devel] " gaoliming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00d401d73002$98a61cd0$c9f25670$@byosoft.com.cn' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox