Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233477
b: refs/heads/master
c: 7657e41
h: refs/heads/master
i:
  233475: a5af1b0
v: v3
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Feb 17, 2011
1 parent 225e8cc commit 0cd0d76
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a8c8d7c683419d059e302373afc6998244f5f60f
refs/heads/master: 7657e41a0bd16c9d8b3cefe8fd5d6ac3c25ae4bf
22 changes: 18 additions & 4 deletions trunk/arch/s390/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,19 @@

static inline int atomic_read(const atomic_t *v)
{
return ACCESS_ONCE(v->counter);
int c;

asm volatile(
" l %0,%1\n"
: "=d" (c) : "Q" (v->counter));
return c;
}

static inline void atomic_set(atomic_t *v, int i)
{
v->counter = i;
asm volatile(
" st %1,%0\n"
: "=Q" (v->counter) : "d" (i));
}

static inline int atomic_add_return(int i, atomic_t *v)
Expand Down Expand Up @@ -126,12 +133,19 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)

static inline long long atomic64_read(const atomic64_t *v)
{
return ACCESS_ONCE(v->counter);
long long c;

asm volatile(
" lg %0,%1\n"
: "=d" (c) : "Q" (v->counter));
return c;
}

static inline void atomic64_set(atomic64_t *v, long long i)
{
v->counter = i;
asm volatile(
" stg %1,%0\n"
: "=Q" (v->counter) : "d" (i));
}

static inline long long atomic64_add_return(long long i, atomic64_t *v)
Expand Down

0 comments on commit 0cd0d76

Please sign in to comment.