Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 15da185

Browse files
committed
From: Phil Nelson <phil@cs.wwu.edu>
Subject: [PATCHES] Added support for NetBSD/pc532.
1 parent 355d6a2 commit 15da185

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

src/backend/storage/ipc/s_lock.c

+37-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.13 1997/04/24 02:35:35 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.14 1997/06/06 01:37:14 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -486,4 +486,40 @@ S_INIT_LOCK(slock_t *lock)
486486

487487
#endif /* defined(linux) && defined(sparc) */
488488

489+
#if defined(NEED_NS32K_TAS_ASM)
490+
491+
int
492+
tas(slock_t *m)
493+
{
494+
slock_t res = 0;
495+
__asm__("movd 8(fp), r1");
496+
__asm__("movqd 0, r0");
497+
__asm__("sbitd r0, 0(r1)");
498+
__asm__("sprb us, %0" : "=r" (res));
499+
res = (res >> 5) & 1;
500+
return res;
501+
}
502+
503+
void
504+
S_LOCK(slock_t *lock)
505+
{
506+
while (tas(lock))
507+
;
508+
}
509+
510+
void
511+
S_UNLOCK(slock_t *lock)
512+
{
513+
*lock = 0;
514+
}
515+
516+
void
517+
S_INIT_LOCK(slock_t *lock)
518+
{
519+
S_UNLOCK(lock);
520+
}
521+
522+
#endif /* NEED_NS32K_TAS_ASM */
523+
524+
489525
#endif /* HAS_TEST_AND_SET */

src/include/port/BSD44_derived.h

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# if defined(sparc)
66
# define NEED_SPARC_TAS_ASM
77
# endif
8+
# if defined(ns32k)
9+
# define NEED_NS32k_TAS_ASM
10+
# endif
811
# define HAS_TEST_AND_SET
912
# if defined(__mips__)
1013
/* # undef HAS_TEST_AND_SET */

0 commit comments

Comments
 (0)