Subject: tas.s

From: Michael Graff <[email-masked]>
Date: Tue, 6 Dec 1994 01:51:30 -0600

I'm working on a quick port to NetBSD/i386-current and need to
have an example i386 tas.s.  Could someone mail this to me if
possible, or tell me where to find it (other than downloading lots
of megs over a 14.4k line.  ;)

Thanks,
--Michael

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]".
   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/

---

From: [email-masked] (Kai Petzke)
Date: Thu, 8 Dec 1994 13:06:44 +0100 (MET)

> have an example i386 tas.s.

There is no such thing as a quick port of Postgres.

> Could someone mail this to me if

The following works fine under Linux.  Insert into the file:

	~postgres/src/backend/storage/ipc

slock_t should be defined as char.

Kai
------------- snip here ---------------
#if defined(__i386__) && defined(__GNUC__)

static inline tas(lock)
    slock_t *lock;
{
    slock_t res;
    __asm__("xchgb %0,%1":"=q" (res),"=m" (*lock):"0" (0x1));
    return(res);
}

S_LOCK(lock)
    slock_t *lock;
{
    while (tas(lock))
        ;
}

S_UNLOCK(lock)
    slock_t *lock;
{
    *lock = 0;
}

S_INIT_LOCK(lock)
    slock_t *lock;
{
    S_UNLOCK(lock);
}

#endif /* __i386__ && __GNUC__ */

#endif /* HAS_TEST_AND_SET */