mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 03:10:05 +00:00
* sysdeps/powerpc/pt-machine.h
(HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS): Define. (__compare_and_swap): Remove memory barriers. (__compare_and_swap_with_release_semantics): New function. 2001-05-09 Geoff Keating <geoffk@redhat.com> * sysdeps/powerpc/pt-machine.h (HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS): Define. (__compare_and_swap): Remove memory barriers. (__compare_and_swap_with_release_semantics): New function.
This commit is contained in:
parent
33bdaa2c05
commit
0e47171f2f
@ -1,3 +1,10 @@
|
|||||||
|
2001-05-09 Geoff Keating <geoffk@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/powerpc/pt-machine.h
|
||||||
|
(HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS): Define.
|
||||||
|
(__compare_and_swap): Remove memory barriers.
|
||||||
|
(__compare_and_swap_with_release_semantics): New function.
|
||||||
|
|
||||||
2001-04-24 Andreas Jaeger <aj@suse.de>
|
2001-04-24 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
* wrapsyscall.c: send* and recv* return ssize_t.
|
* wrapsyscall.c: send* and recv* return ssize_t.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* Machine-dependent pthreads configuration and inline functions.
|
/* Machine-dependent pthreads configuration and inline functions.
|
||||||
powerpc version.
|
powerpc version.
|
||||||
Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -38,19 +38,38 @@ register char * stack_pointer __asm__ ("r1");
|
|||||||
/* Compare-and-swap for semaphores. */
|
/* Compare-and-swap for semaphores. */
|
||||||
/* note that test-and-set(x) is the same as !compare-and-swap(x, 0, 1) */
|
/* note that test-and-set(x) is the same as !compare-and-swap(x, 0, 1) */
|
||||||
|
|
||||||
#define HAS_COMPARE_AND_SWAP
|
#define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
|
||||||
#define IMPLEMENT_TAS_WITH_CAS
|
#define IMPLEMENT_TAS_WITH_CAS
|
||||||
|
|
||||||
#if BROKEN_PPC_ASM_CR0
|
PT_EI int
|
||||||
static
|
|
||||||
#else
|
|
||||||
PT_EI
|
|
||||||
#endif
|
|
||||||
int
|
|
||||||
__compare_and_swap (long int *p, long int oldval, long int newval)
|
__compare_and_swap (long int *p, long int oldval, long int newval)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
"0: lwarx %0,0,%1 ;"
|
||||||
|
" xor. %0,%3,%0;"
|
||||||
|
" bne 1f;"
|
||||||
|
" stwcx. %2,0,%1;"
|
||||||
|
" bne- 0b;"
|
||||||
|
"1: "
|
||||||
|
: "=&r"(ret)
|
||||||
|
: "r"(p), "r"(newval), "r"(oldval)
|
||||||
|
: "cr0", "memory");
|
||||||
|
/* This version of __compare_and_swap is to be used when acquiring
|
||||||
|
a lock, so we don't need to worry about whether other memory
|
||||||
|
operations have completed, but we do need to be sure that any loads
|
||||||
|
after this point really occur after we have acquired the lock. */
|
||||||
|
__asm__ __volatile__ ("isync" : : : "memory");
|
||||||
|
return ret == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PT_EI int
|
||||||
|
__compare_and_swap_with_release_semantics (long int *p,
|
||||||
|
long int oldval, long int newval)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
MEMORY_BARRIER ();
|
MEMORY_BARRIER ();
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"0: lwarx %0,0,%1 ;"
|
"0: lwarx %0,0,%1 ;"
|
||||||
@ -62,6 +81,5 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
|
|||||||
: "=&r"(ret)
|
: "=&r"(ret)
|
||||||
: "r"(p), "r"(newval), "r"(oldval)
|
: "r"(p), "r"(newval), "r"(oldval)
|
||||||
: "cr0", "memory");
|
: "cr0", "memory");
|
||||||
MEMORY_BARRIER ();
|
|
||||||
return ret == 0;
|
return ret == 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user