mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
Back-port recent MIPS and M68K spinlock improvements to 8.0 branch.
This commit is contained in:
parent
08e12b89d5
commit
8c3cf25225
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/s_lock.c,v 1.35 2004/12/31 22:01:05 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/s_lock.c,v 1.35.4.1 2005/08/26 14:48:13 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -135,7 +135,12 @@ s_lock(volatile slock_t *lock, const char *file, int line)
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__m68k__)
|
||||
/*
|
||||
* Note: all the if-tests here probably ought to be testing gcc version
|
||||
* rather than platform, but I don't have adequate info to know what to
|
||||
* write. Ideally we'd flush all this in favor of the inline version.
|
||||
*/
|
||||
#if defined(__m68k__) && !defined(__linux__)
|
||||
/* really means: extern int tas(slock_t* **lock); */
|
||||
static void
|
||||
tas_dummy()
|
||||
@ -169,35 +174,7 @@ _success: \n\
|
||||
#endif /* __NetBSD__ && __ELF__ */
|
||||
);
|
||||
}
|
||||
#endif /* __m68k__ */
|
||||
|
||||
|
||||
#if defined(__mips__) && !defined(__sgi)
|
||||
static void
|
||||
tas_dummy()
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"\
|
||||
.global tas \n\
|
||||
tas: \n\
|
||||
.frame $sp, 0, $31 \n\
|
||||
.set push \n\
|
||||
.set mips2 \n\
|
||||
ll $14, 0($4) \n\
|
||||
or $15, $14, 1 \n\
|
||||
sc $15, 0($4) \n\
|
||||
.set pop \n\
|
||||
beq $15, 0, fail\n\
|
||||
bne $14, 0, fail\n\
|
||||
li $2, 0 \n\
|
||||
.livereg 0x2000FF0E,0x00000FFF \n\
|
||||
j $31 \n\
|
||||
fail: \n\
|
||||
li $2, 1 \n\
|
||||
j $31 \n\
|
||||
");
|
||||
}
|
||||
#endif /* __mips__ && !__sgi */
|
||||
#endif /* __m68k__ && !__linux__ */
|
||||
|
||||
|
||||
#else /* not __GNUC__ */
|
||||
|
@ -66,7 +66,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.133 2004/12/31 22:03:42 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.133.4.1 2005/08/26 14:48:13 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -313,7 +313,7 @@ do \
|
||||
#endif /* powerpc */
|
||||
|
||||
|
||||
#if defined(__mc68000__) && defined(__linux__)
|
||||
#if (defined(__mc68000__) || defined(__m68k__)) && defined(__linux__)
|
||||
#define HAS_TEST_AND_SET
|
||||
|
||||
typedef unsigned char slock_t;
|
||||
@ -335,7 +335,7 @@ tas(volatile slock_t *lock)
|
||||
return rv;
|
||||
}
|
||||
|
||||
#endif /* defined(__mc68000__) && defined(__linux__) */
|
||||
#endif /* (__mc68000__ || __m68k__) && __linux__ */
|
||||
|
||||
|
||||
#if defined(__vax__)
|
||||
@ -438,20 +438,48 @@ do \
|
||||
#endif /* __alpha || __alpha__ */
|
||||
|
||||
|
||||
/* These live in s_lock.c, but only for gcc */
|
||||
|
||||
|
||||
#if defined(__m68k__)
|
||||
#define HAS_TEST_AND_SET
|
||||
|
||||
typedef unsigned char slock_t;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__mips__) && !defined(__sgi)
|
||||
/* Note: on SGI we use the OS' mutex ABI, see below */
|
||||
#define HAS_TEST_AND_SET
|
||||
|
||||
typedef unsigned int slock_t;
|
||||
|
||||
#define TAS(lock) tas(lock)
|
||||
|
||||
static __inline__ int
|
||||
tas(volatile slock_t *lock)
|
||||
{
|
||||
register volatile slock_t *__l = lock;
|
||||
register int __r;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set push \n"
|
||||
" .set mips2 \n"
|
||||
" .set noreorder \n"
|
||||
" .set nomacro \n"
|
||||
"1: ll %0, %1 \n"
|
||||
" bne %0, $0, 1f \n"
|
||||
" xori %0, 1 \n"
|
||||
" sc %0, %1 \n"
|
||||
" beq %0, $0, 1b \n"
|
||||
" sync \n"
|
||||
"1: .set pop "
|
||||
: "=&r" (__r), "+R" (*__l)
|
||||
:
|
||||
: "memory", "cc");
|
||||
return __r;
|
||||
}
|
||||
|
||||
#endif /* __mips__ && !__sgi */
|
||||
|
||||
|
||||
/* These live in s_lock.c, but only for gcc */
|
||||
|
||||
|
||||
#if defined(__m68k__) && !defined(__linux__)
|
||||
#define HAS_TEST_AND_SET
|
||||
|
||||
typedef unsigned char slock_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user