mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Luca Barbieri <luca@luca-barbieri.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	luca@luca-barbieri.com, tglx@linutronix.de
Subject: [tip:x86/atomic] x86-32: Fix atomic64_add_unless return value convention
Date: Mon, 1 Mar 2010 19:58:22 GMT	[thread overview]
Message-ID: <tip-6e6104fe085026e6ef82cc5cc303d6c8ceb7e411@git.kernel.org> (raw)
In-Reply-To: <1267469749-11878-3-git-send-email-luca@luca-barbieri.com>

Commit-ID:  6e6104fe085026e6ef82cc5cc303d6c8ceb7e411
Gitweb:     http://git.kernel.org/tip/6e6104fe085026e6ef82cc5cc303d6c8ceb7e411
Author:     Luca Barbieri <luca@luca-barbieri.com>
AuthorDate: Mon, 1 Mar 2010 19:55:46 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 1 Mar 2010 11:38:46 -0800

x86-32: Fix atomic64_add_unless return value convention

atomic64_add_unless must return 1 if it perfomed the add and 0 otherwise.
The implementation did the opposite thing.

Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
LKML-Reference: <1267469749-11878-3-git-send-email-luca@luca-barbieri.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/lib/atomic64_386_32.S |    4 ++--
 arch/x86/lib/atomic64_cx8_32.S |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/lib/atomic64_386_32.S b/arch/x86/lib/atomic64_386_32.S
index 5db07fe..a2f847c 100644
--- a/arch/x86/lib/atomic64_386_32.S
+++ b/arch/x86/lib/atomic64_386_32.S
@@ -133,13 +133,13 @@ BEGIN add_unless %ecx
 1:
 	movl %eax,  ($v)
 	movl %edx, 4($v)
-	xorl %eax, %eax
+	movl $1, %eax
 2:
 RETURN
 3:
 	cmpl %edx, %edi
 	jne 1b
-	movl $1, %eax
+	xorl %eax, %eax
 	jmp 2b
 END_
 
diff --git a/arch/x86/lib/atomic64_cx8_32.S b/arch/x86/lib/atomic64_cx8_32.S
index e49c4eb..d0e37b1 100644
--- a/arch/x86/lib/atomic64_cx8_32.S
+++ b/arch/x86/lib/atomic64_cx8_32.S
@@ -180,7 +180,7 @@ ENTRY(atomic64_add_unless_cx8)
 	cmpxchg8b (%ebp)
 	jne 1b
 
-	xorl %eax, %eax
+	movl $1, %eax
 3:
 	addl $8, %esp
 	CFI_ADJUST_CFA_OFFSET -8
@@ -190,7 +190,7 @@ ENTRY(atomic64_add_unless_cx8)
 4:
 	cmpl %edx, 4(%esp)
 	jne 2b
-	movl $1, %eax
+	xorl %eax, %eax
 	jmp 3b
 	CFI_ENDPROC
 ENDPROC(atomic64_add_unless_cx8)

  reply	other threads:[~2010-03-01 19:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-01 18:55 [PATCH 0/5] Fix atomic64 return value conventions (v2) Luca Barbieri
2010-03-01 18:55 ` [PATCH 1/5] lib: fix atomic64_add_unless test Luca Barbieri
2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
2010-03-01 18:55 ` [PATCH 2/5] x86-32: fix atomic64_add_unless return value convention Luca Barbieri
2010-03-01 19:58   ` tip-bot for Luca Barbieri [this message]
2010-03-01 18:55 ` [PATCH 3/5] lib: " Luca Barbieri
2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
2010-03-01 18:55 ` [PATCH 4/5] lib: fix atomic64_inc_not_zero test Luca Barbieri
2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
2010-03-01 18:55 ` [PATCH 5/5] x86-32: fix atomic64_inc_not_zero return value convention Luca Barbieri
2010-03-01 19:59   ` [tip:x86/atomic] x86-32: Fix " tip-bot for Luca Barbieri

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-all 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=tip-6e6104fe085026e6ef82cc5cc303d6c8ceb7e411@git.kernel.org \
    --to=luca@luca-barbieri.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome