From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>,
edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <liming.gao@intel.com>
Subject: Re: [PATCH 4/5] MdePkg/BaseSynchronizationLib GCC: fix X64 InternalSyncCompareExchange64()
Date: Mon, 1 Oct 2018 12:27:59 +0200 [thread overview]
Message-ID: <b2c31db1-1659-6e66-4fc6-b9e874c87549@redhat.com> (raw)
In-Reply-To: <20180929222312.32150-5-lersek@redhat.com>
On 30/09/2018 00:23, Laszlo Ersek wrote:
> (This patch is identical to the X64 half of the last one, except for the
> InternalSyncCompareExchange32() -> InternalSyncCompareExchange64() and
> "cmpxchgl" -> "cmpxchgq" replacements.)
>
> The CMPXCHG instruction has the following operands:
> - AX (implicit, CompareValue): input and output
> - destination operand (*Value): input and output
> - source operand (ExchangeValue): input
>
> The X64 version of InternalSyncCompareExchange64() attempts to mark both
> CompareValue and (*Value) as input/output, but it doesn't use the
> appropriate constraints for either operand.
>
> Fix these issues. Furthermore, prefer the short "+" constraint for I/O
> operands over the <output-operand-number> constraint that can be applied
> to the input instances of I/O operands.
>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1208
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
> index a85cf0265c8b..edb904c00704 100644
> --- a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
> +++ b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
> @@ -194,12 +194,10 @@ InternalSyncCompareExchange64 (
> {
> __asm__ __volatile__ (
> "lock \n\t"
> - "cmpxchgq %3, %1 \n\t"
> - : "=a" (CompareValue), // %0
> - "=m" (*Value) // %1
> - : "a" (CompareValue), // %2
> - "r" (ExchangeValue), // %3
> - "m" (*Value) // %4
> + "cmpxchgq %2, %1 \n\t"
> + : "+a" (CompareValue), // %0
> + "+m" (*Value) // %1
> + : "r" (ExchangeValue) // %2
> : "memory",
> "cc"
> );
>
next prev parent reply other threads:[~2018-10-01 10:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-29 22:23 [PATCH 0/5] MdePkg/BaseSynchronizationLib GCC: fixes, cleanups Laszlo Ersek
2018-09-29 22:23 ` [PATCH 1/5] MdePkg/BaseSynchronizationLib GCC: fix whitespace and comments Laszlo Ersek
2018-10-01 10:17 ` Philippe Mathieu-Daudé
2018-10-18 2:00 ` Ni, Ruiyu
2018-09-29 22:23 ` [PATCH 2/5] MdePkg/BaseSynchronizationLib GCC: fix InternalSyncCompareExchange16() Laszlo Ersek
2018-10-01 10:26 ` Philippe Mathieu-Daudé
2018-09-29 22:23 ` [PATCH 3/5] MdePkg/BaseSynchronizationLib GCC: fix InternalSyncCompareExchange32() Laszlo Ersek
2018-10-01 10:26 ` Philippe Mathieu-Daudé
2018-09-29 22:23 ` [PATCH 4/5] MdePkg/BaseSynchronizationLib GCC: fix X64 InternalSyncCompareExchange64() Laszlo Ersek
2018-10-01 10:27 ` Philippe Mathieu-Daudé [this message]
2018-09-29 22:23 ` [PATCH 5/5] MdePkg/BaseSynchronizationLib GCC: simplify IA32 InternalSyncCompareExchange64() Laszlo Ersek
2018-10-01 18:27 ` Philippe Mathieu-Daudé
2018-10-01 18:45 ` Laszlo Ersek
2018-09-29 22:35 ` [PATCH 0/5] MdePkg/BaseSynchronizationLib GCC: fixes, cleanups Laszlo Ersek
2018-10-08 13:44 ` Laszlo Ersek
2018-10-15 18:04 ` Laszlo Ersek
2018-10-15 19:29 ` Kinney, Michael D
2018-10-16 1:32 ` Gao, Liming
2018-10-17 17:16 ` Laszlo Ersek
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=b2c31db1-1659-6e66-4fc6-b9e874c87549@redhat.com \
--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