public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* Mutex fast-path implementation sh4a
@ 2008-11-19 13:23 michael
  2008-11-20  4:43 ` Paul Mundt
  2008-11-20 17:18 ` Michael Trimarchi
  0 siblings, 2 replies; 3+ messages in thread
From: michael @ 2008-11-19 13:23 UTC (permalink / raw)
  To: linux-sh

Hi,

I'm not an expert of sh4 assembler instruction on gcc, but I figure out 
how to implement
the fastpath_lock and trylock, and I obtain this code:

static inline void
__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
{
        int __res;

        __asm__ __volatile__ (

                "movli.l        @%1, %0 \n\t"
                "dt             %0      \n\t"
                "movco.l        %0, @%1 \n\t"
                : "=&z" (__res)
                : "r" (&(count)->counter)
                : "t" );

        if (unlikely(__res != count->counter))
                fail_fn(count);
}

The retval function is very quite similar to this one. I don't find 
documentation about sh assembler,
can someone point me out to documentation?
The start point was the arm implementation and the 
arch/sh/include/asm/atomic-llsc.h file.

Can be a correct implementation?

Regards Michael



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-20 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-19 13:23 Mutex fast-path implementation sh4a michael
2008-11-20  4:43 ` Paul Mundt
2008-11-20 17:18 ` Michael Trimarchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox