From 513f0446486318bc5118f719834c5960ee2a1f8e Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 19 Nov 2017 08:52:56 +0000 Subject: [PATCH] [PATCH 1/1] Porting OpenBSD internal changes. Porting to the 88k architecture the locking mechanism. --- src/backend/storage/lmgr/s_lock.c | 2 +- src/include/storage/s_lock.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/backend/storage/lmgr/s_lock.c b/src/backend/storage/lmgr/s_lock.c index 40d8156331..b3e2e34e7e 100644 --- a/src/backend/storage/lmgr/s_lock.c +++ b/src/backend/storage/lmgr/s_lock.c @@ -251,7 +251,7 @@ static void tas_dummy() { __asm__ __volatile__( -#if defined(__NetBSD__) && defined(__ELF__) +#if (defined(__NetBSD__) || defined(__OpenBSD__)) && defined(__ELF__) /* no underscore for label and % for registers */ "\ .global tas \n\ diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 99e109853f..c5ca66b9ec 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -693,6 +693,29 @@ typedef unsigned char slock_t; do { __asm__ __volatile__("" : : : "memory"); *(lock) = 0; } while (0) #endif +#if defined(__m88k__) /* Motorola 88k */ +#define HAS_TEST_AND_SET + +typedef unsigned int slock_t; + +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + register slock_t _res = 1; + + __asm__ __volatile__( + " xmem %0, %2, %%r0\n", + "=r"(_res) + "0" (_res), "r"(lock) + "memory"); + return (int) _res; +} + +#endif /* __m88k__ */ + + #endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ -- 2.15.0