From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: [patch] s390: futex atomic operations part 2.
Date: Tue, 25 Apr 2006 17:10:29 +0200 [thread overview]
Message-ID: <20060425151029.GA16531@skybase> (raw)
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
[patch] s390: futex atomic operations part 2.
Add missing primitive futex_atomic_cmpxchg_inatomic. Remove incorrect
type cast of uaddr memory constraint from __futex_atomic_op.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
include/asm-s390/futex.h | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff -urpN linux-2.6/include/asm-s390/futex.h linux-2.6-patched/include/asm-s390/futex.h
--- linux-2.6/include/asm-s390/futex.h 2006-04-25 13:41:36.000000000 +0200
+++ linux-2.6-patched/include/asm-s390/futex.h 2006-04-25 15:24:01.000000000 +0200
@@ -30,9 +30,9 @@
"2:\n" \
__futex_atomic_fixup \
: "=d" (ret), "=&d" (oldval), "=&d" (newval), \
- "=m" (*(unsigned long __user *) uaddr) \
+ "=m" (*uaddr) \
: "0" (-EFAULT), "d" (oparg), "a" (uaddr), \
- "m" (*(unsigned long __user *) uaddr) : "cc" );
+ "m" (*uaddr) : "cc" );
static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
{
@@ -90,5 +90,32 @@ static inline int futex_atomic_op_inuser
return ret;
}
+static inline int
+futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
+{
+ int ret;
+
+ if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
+ return -EFAULT;
+ asm volatile(" cs %1,%4,0(%5)\n"
+ "0: lr %0,%1\n"
+ "1:\n"
+#ifndef __s390x__
+ ".section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 0b,1b\n"
+ ".previous"
+#else /* __s390x__ */
+ ".section __ex_table,\"a\"\n"
+ " .align 8\n"
+ " .quad 0b,1b\n"
+ ".previous"
+#endif /* __s390x__ */
+ : "=d" (ret), "+d" (oldval), "=m" (*uaddr)
+ : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr)
+ : "cc", "memory" );
+ return oldval;
+}
+
#endif /* __KERNEL__ */
#endif /* _ASM_S390_FUTEX_H */
reply other threads:[~2006-04-25 15:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20060425151029.GA16531@skybase \
--to=schwidefsky@de.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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