Skip to content

Commit 08a5901

Browse files
committed
Various patches not commited, plus a linux/sparc patch from
Satoshi Ishikawa <power@sekine.densi.gifu-u.ac.jp>
1 parent 7a7a9b1 commit 08a5901

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

src/backend/storage/ipc/s_lock.c

Lines changed: 34 additions & 1 deletion
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.12 1997/03/12 21:06:48 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.13 1997/04/24 02:35:35 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -453,4 +453,37 @@ S_INIT_LOCK(slock_t *lock)
453453

454454
#endif
455455

456+
#if defined(linux) && defined(sparc)
457+
458+
int
459+
tas(slock_t *m)
460+
{
461+
slock_t res;
462+
__asm__("ldstub [%1], %0"
463+
: "=&r" (res)
464+
: "r" (m));
465+
return (res != 0);
466+
}
467+
468+
void
469+
S_LOCK(slock_t *lock)
470+
{
471+
while (tas(lock))
472+
;
473+
}
474+
475+
void
476+
S_UNLOCK(slock_t *lock)
477+
{
478+
*lock = 0;
479+
}
480+
481+
void
482+
S_INIT_LOCK(slock_t *lock)
483+
{
484+
S_UNLOCK(lock);
485+
}
486+
487+
#endif /* defined(linux) && defined(sparc) */
488+
456489
#endif /* HAS_TEST_AND_SET */

src/include/port/linux.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
# define HAS_TEST_AND_SET
1313
typedef unsigned char slock_t;
1414
# endif
15+
# if defined(sparc)
16+
# undef NEED_I386_TAS_ASM
17+
# endif

0 commit comments

Comments
 (0)