new alpha linux locking from Travis Melhiser <melhiser@viper.co.union.nc.us>
This commit is contained in:
parent
06a7001350
commit
6016148c61
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.11 1997/10/30 05:24:19 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.12 1997/11/07 21:35:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -24,10 +24,6 @@
|
|||||||
* ;
|
* ;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* In addition to modifying this file you will need to modify
|
|
||||||
* the appropriate ...src/include/port/...h file to define
|
|
||||||
* HAS_TEST_AND_SET for the appropriate circumstances.
|
|
||||||
*
|
|
||||||
* If this is not done, POSTGRES will default to using System V
|
* If this is not done, POSTGRES will default to using System V
|
||||||
* semaphores (and take a large performance hit -- around 40% of
|
* semaphores (and take a large performance hit -- around 40% of
|
||||||
* its time on a DS5000/240 is spent in semop(3)...).
|
* its time on a DS5000/240 is spent in semop(3)...).
|
||||||
@ -232,31 +228,6 @@ tas_dummy()
|
|||||||
|
|
||||||
#endif /* sun3 */
|
#endif /* sun3 */
|
||||||
|
|
||||||
/*
|
|
||||||
* M68000 ports under NetBSD.
|
|
||||||
*
|
|
||||||
* This version should also work on a sun3, but I can't test it.
|
|
||||||
* Conversely the sun3 version should work under NetBSD/m68k, but
|
|
||||||
* it doesn't.
|
|
||||||
*/
|
|
||||||
#if defined(__NetBSD__) && defined(__m68k__)
|
|
||||||
|
|
||||||
static void S_LOCK(char *lock)
|
|
||||||
{
|
|
||||||
asm("
|
|
||||||
movel a6@(8),a0
|
|
||||||
LOOP:
|
|
||||||
tas a0@
|
|
||||||
bmi LOOP
|
|
||||||
");
|
|
||||||
}
|
|
||||||
|
|
||||||
#define S_UNLOCK(lock) (*(lock) = 0)
|
|
||||||
|
|
||||||
#define S_INIT_LOCK(lock) S_UNLOCK(lock)
|
|
||||||
|
|
||||||
#endif /* M68000 && NetBSD */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sparc machines
|
* sparc machines
|
||||||
*/
|
*/
|
||||||
@ -342,29 +313,28 @@ tas_dummy()
|
|||||||
|
|
||||||
#if defined(__alpha__) && defined(linux)
|
#if defined(__alpha__) && defined(linux)
|
||||||
|
|
||||||
#define S_LOCK(lock) do \
|
#define S_LOCK(lock) do { \
|
||||||
{ \
|
|
||||||
slock_t _res; \
|
slock_t _res; \
|
||||||
do \
|
do { \
|
||||||
{ \
|
|
||||||
__asm__(" ldq $0, %0 \n\
|
__asm__(" ldq $0, %0 \n\
|
||||||
bne $0, already_set \n\
|
bne $0, already_set%= \n\
|
||||||
ldq_l $0, %0 \n\
|
ldq_l $0, %0 \n\
|
||||||
bne $0, already_set \n\
|
bne $0, already_set%= \n\
|
||||||
or $31, 1, $0 \n\
|
or $31, 1, $0 \n\
|
||||||
stq_c $0, %0 \n\
|
stq_c $0, %0 \n\
|
||||||
beq $0, stqc_fail \n\
|
beq $0, stqc_fail%= \n\
|
||||||
success: bis $31, $31, %1 \n\
|
success%=: \n\
|
||||||
|
bis $31, $31, %1 \n\
|
||||||
mb \n\
|
mb \n\
|
||||||
jmp $31, end \n\
|
jmp $31, end%= \n\
|
||||||
stqc_fail: or $31, 1, $0 \n\
|
stqc_fail%=: or $31, 1, $0 \n\
|
||||||
already_set: bis $0, $0, %1 \n\
|
already_set%=: bis $0, $0, %1 \n\
|
||||||
end: nop ": "=m"(*lock), "=r"(_res): :"0"); \
|
end%=: nop ": "=m"(*lock), "=r"(_res): :"0"); \
|
||||||
} while (_res != 0); \
|
} while (_res != 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define S_UNLOCK(lock) (__asm__("mb"), *(lock) = 0)
|
#define S_UNLOCK(lock) ({ __asm__("mb \n"); *(lock) = 0; })
|
||||||
|
|
||||||
#define S_INIT_LOCK(lock) S_UNLOCK(lock)
|
#define S_INIT_LOCK(lock) S_UNLOCK(lock)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user