1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00
Subject: [HACKERS] linux/alpha patches

These patches lay the groundwork for a Linux/Alpha port.  The port doesn't
actually work unless you tweak the linker to put all the pointers in the
first 32 bits of the address space, but it's at least a start.  It
implements the test-and-set instruction in Alpha assembly, and also fixes
a lot of pointer-to-integer conversions, which is probably good anyway.
This commit is contained in:
Marc G. Fournier
1997-03-12 21:13:19 +00:00
parent b66569e41f
commit 5dde558ce6
13 changed files with 123 additions and 43 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.11 1997/02/14 04:16:43 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.12 1997/03/12 21:06:48 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -126,7 +126,7 @@ S_LOCK_FREE(slock_t *lock)
* (see storage/ipc.h).
*/
#if defined(alpha)
#if defined(alpha) && !defined(linuxalpha)
void
S_LOCK(slock_t *lock)
@@ -409,4 +409,48 @@ S_INIT_LOCK(slock_t *lock)
#endif /* NEED_I386_TAS_ASM */
#if defined(linuxalpha)
int
tas(slock_t *m)
{
slock_t res;
__asm__(" ldq $0, %0 \n\
bne $0, already_set \n\
ldq_l $0, %0 \n\
bne $0, already_set \n\
or $31, 1, $0 \n\
stq_c $0, %0 \n\
beq $0, stqc_fail \n\
success: bis $31, $31, %1 \n\
mb \n\
jmp $31, end \n\
stqc_fail: or $31, 1, $0 \n\
already_set: bis $0, $0, %1 \n\
end: nop " : "=m" (*m), "=r" (res) :: "0" );
return(res);
}
void
S_LOCK(slock_t *lock)
{
while (tas(lock))
;
}
void
S_UNLOCK(slock_t *lock)
{
__asm__("mb");
*lock = 0;
}
void
S_INIT_LOCK(slock_t *lock)
{
S_UNLOCK(lock);
}
#endif
#endif /* HAS_TEST_AND_SET */