Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120095
b: refs/heads/master
c: 77ba93a
h: refs/heads/master
i:
  120093: c1fe577
  120091: cedd6af
  120087: 2f31426
  120079: bc093e2
  120063: e1b490c
v: v3
  • Loading branch information
Paul Mundt committed Dec 22, 2008
1 parent 7d67b6d commit 64bc050
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 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: c6f17cb2272121475c87592560534b157b17544e
refs/heads/master: 77ba93a7ac5fb0d9338bffbf97c787b8efe00806
37 changes: 21 additions & 16 deletions trunk/arch/sh/include/asm/mutex-llsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,37 @@
static inline void
__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
{
int __res;
int __ex_flag, __res;

__asm__ __volatile__ (
"movli.l @%1, %0 \n"
"dt %0 \n"
"movco.l %0, @%1 \n"
: "=&z" (__res)
"movli.l @%2, %0 \n"
"add #-1, %0 \n"
"movco.l %0, @%2 \n"
"movt %1 \n"
: "=&z" (__res), "=&r" (__ex_flag)
: "r" (&(count)->counter)
: "t");

__res |= !__ex_flag;
if (unlikely(__res != 0))
fail_fn(count);
}

static inline int
__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
{
int __res;
int __ex_flag, __res;

__asm__ __volatile__ (
"movli.l @%1, %0 \n"
"dt %0 \n"
"movco.l %0, @%1 \n"
: "=&z" (__res)
"movli.l @%2, %0 \n"
"add #-1, %0 \n"
"movco.l %0, @%2 \n"
"movt %1 \n"
: "=&z" (__res), "=&r" (__ex_flag)
: "r" (&(count)->counter)
: "t");

__res |= !__ex_flag;
if (unlikely(__res != 0))
__res = fail_fn(count);

Expand All @@ -57,18 +61,19 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
static inline void
__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
{
int __res;
int __ex_flag, __res;

__asm__ __volatile__ (
"1: movli.l @%1, %0 \n\t"
"movli.l @%2, %0 \n\t"
"add #1, %0 \n\t"
"movco.l %0, @%1 \n\t"
"bf 1b\n\t"
: "=&z" (__res)
"movco.l %0, @%2 \n\t"
"movt %1 \n\t"
: "=&z" (__res), "=&r" (__ex_flag)
: "r" (&(count)->counter)
: "t");

if (unlikely(__res <= 0))
__res |= !__ex_flag;
if (unlikely(__res != 0))
fail_fn(count);
}

Expand Down

0 comments on commit 64bc050

Please sign in to comment.