All of lore.kernel.org
 help / color / mirror / Atom feed
From: michael <trimarchimichael@yahoo.it>
To: linux-sh@vger.kernel.org
Subject: Mutex fast-path implementation sh4a
Date: Wed, 19 Nov 2008 13:23:04 +0000	[thread overview]
Message-ID: <49241338.1010405@yahoo.it> (raw)

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



             reply	other threads:[~2008-11-19 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-19 13:23 michael [this message]
2008-11-20  4:43 ` Mutex fast-path implementation sh4a Paul Mundt
2008-11-20 17:18 ` Michael Trimarchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49241338.1010405@yahoo.it \
    --to=trimarchimichael@yahoo.it \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.