Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131002
b: refs/heads/master
c: c20f326
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Yoshii authored and Paul Mundt committed Jan 29, 2009
1 parent 44826a5 commit 827ba1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 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: 03f07876df2565321871a2dbf33c5c737df185df
refs/heads/master: c20f326a62c046ee958c3aa584f183201adb229f
21 changes: 9 additions & 12 deletions trunk/arch/sh/include/asm/mutex-llsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,36 @@
static inline void
__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
{
int __ex_flag, __res;
int __done, __res;

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

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

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

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

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

return __res;
Expand All @@ -61,19 +59,18 @@ __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 __ex_flag, __res;
int __done, __res;

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

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

Expand Down

0 comments on commit 827ba1b

Please sign in to comment.