aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2011-02-17 07:13:58 -0500
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2011-02-17 07:13:59 -0500
commit7657e41a0bd16c9d8b3cefe8fd5d6ac3c25ae4bf (patch)
treebbc5ee1777320f332820c566a33e943c3d5b27e8 /arch/s390
parenta8c8d7c683419d059e302373afc6998244f5f60f (diff)
[S390] atomic: use inline asm
Use inline assemblies for atomic_read/set(). This way there shouldn't be any questions or subtle volatile semantics left. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/atomic.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
index 50cfb5ed601b..5c5ba10384c2 100644
--- a/arch/s390/include/asm/atomic.h
+++ b/arch/s390/include/asm/atomic.h
@@ -36,12 +36,19 @@
36 36
37static inline int atomic_read(const atomic_t *v) 37static inline int atomic_read(const atomic_t *v)
38{ 38{
39 return ACCESS_ONCE(v->counter); 39 int c;
40
41 asm volatile(
42 " l %0,%1\n"
43 : "=d" (c) : "Q" (v->counter));
44 return c;
40} 45}
41 46
42static inline void atomic_set(atomic_t *v, int i) 47static inline void atomic_set(atomic_t *v, int i)
43{ 48{
44 v->counter = i; 49 asm volatile(
50 " st %1,%0\n"
51 : "=Q" (v->counter) : "d" (i));
45} 52}
46 53
47static inline int atomic_add_return(int i, atomic_t *v) 54static inline int atomic_add_return(int i, atomic_t *v)
@@ -126,12 +133,19 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
126 133
127static inline long long atomic64_read(const atomic64_t *v) 134static inline long long atomic64_read(const atomic64_t *v)
128{ 135{
129 return ACCESS_ONCE(v->counter); 136 long long c;
137
138 asm volatile(
139 " lg %0,%1\n"
140 : "=d" (c) : "Q" (v->counter));
141 return c;
130} 142}
131 143
132static inline void atomic64_set(atomic64_t *v, long long i) 144static inline void atomic64_set(atomic64_t *v, long long i)
133{ 145{
134 v->counter = i; 146 asm volatile(
147 " stg %1,%0\n"
148 : "=Q" (v->counter) : "d" (i));
135} 149}
136 150
137static inline long long atomic64_add_return(long long i, atomic64_t *v) 151static inline long long atomic64_add_return(long long i, atomic64_t *v)