Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Aug 2003 16:21:20 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        alpha@freebsd.org
Subject:   Re: Atomic swap
Message-ID:  <Pine.GSO.4.10.10308071617070.14420-100000@pcnet5.pcnet.com>
In-Reply-To: <20030807195504.GA837@athlon.pn.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 7 Aug 2003, Marcel Moolenaar wrote:

> On Thu, Aug 07, 2003 at 03:31:55PM -0400, Daniel Eischen wrote:
> > > > > 		"   stq     t0,%3\n"
> > > 		^^^^^^^^^^^^^^^^^^^^
> > > 
> > > Whoops, typo: %3 should be %2.
> > 
> > Yup, I caught that but didn't want to complain when something
> > is handed to me on a silver platter ;-)
> 
> As long as you saw it :-)

BTW, this is the only way I got it to compile.  The compiler
(or assembler) didn't seem to like having t0 and t1 hardcoded.

Grr, I just remembered.  t0, t1, etc are our names for
them.  They should probably be $1 and $2.

static __inline void
atomic_swap_long(volatile long *dst, long val, long *res)
{
        long temp1, temp2;

        __asm ( "1: ldq_l   %3, %1\n"
                "   mov     %2, %4\n"
                "   stq_c   %4, %1\n"
                "   beq     %4, 1b\n"
                "   stq     %3, %0\n"
            : "=m"(*res) : "m"(*dst), "r"(val), "r"(temp1), "r"(temp2) : "memory");    
}

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10308071617070.14420-100000>