Subject: Re: postgresql pkg & TAS
To: None <port-arm32@netbsd.org>
From: Andrew McMurry <a.mcmurry1@physics.oxford.ac.uk>
List: port-arm32
Date: 03/29/1999 13:14:00
On Mon, Mar 29, 1999 at 01:01:37PM +0100, Brian Brunswick wrote:
> >On Mon, 29 Mar 1999 proff@suburbia.net wrote:
> >> trivial. Please feed the new locking code back to the postgresql team if you do.
> >
> >Um, this locking code was exactly what I'm asking for - I don't neither
> >know postgresql nor arm32 machine language, sorry.
> >
> > - Hubert
> 
> I've had success with the following:
> Sorry for not returning it sooner!

I have also had a fix for a while, but I was away last week. Here is a
bit to include within the src/include/storage/s_lock.h file. Sorry
that it isn't a proper patch. I don't have the original file to hand
at the moment (which was already patched by the pkg system).

I'll submit this to the PostgreSQL people.

	Andrew

-------

#if defined(__arm32__)
#define TAS(lock) tas(lock)

static __inline__ int
tas(volatile slock_t *lock)
{
        register slock_t _res = 1;

__asm__("swpb %0, %0, [%3]": "=r"(_res), "=m"(*lock):"0"(_res), "r" (lock));
        return (int) _res;
}

#endif   /* __arm32__ */