mirror of git://sourceware.org/git/glibc.git
* sysdeps/powerpc/pt-machine.h (MEMORY_BARRIER): Don't be __volatile__. (__compare_and_swap): Replace other 'sync' with MEMORY_BARRIER. Don't have the 'asm' __volatile__.
2000-04-11 Geoff Keating <geoffk@cygnus.com> * sysdeps/powerpc/pt-machine.h (MEMORY_BARRIER): Don't be __volatile__. (__compare_and_swap): Replace other 'sync' with MEMORY_BARRIER. Don't have the 'asm' __volatile__.
This commit is contained in:
parent
de26253715
commit
4a1a3c2158
|
|
@ -1,3 +1,10 @@
|
||||||
|
2000-04-11 Geoff Keating <geoffk@cygnus.com>
|
||||||
|
|
||||||
|
* sysdeps/powerpc/pt-machine.h (MEMORY_BARRIER): Don't be
|
||||||
|
__volatile__.
|
||||||
|
(__compare_and_swap): Replace other 'sync' with MEMORY_BARRIER.
|
||||||
|
Don't have the 'asm' __volatile__.
|
||||||
|
|
||||||
2000-04-11 Ulrich Drepper <drepper@redhat.com>
|
2000-04-11 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* internals.h: Define MEMORY_BARRIER as empty if not defined already.
|
* internals.h: Define MEMORY_BARRIER as empty if not defined already.
|
||||||
|
|
|
||||||
|
|
@ -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 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 1998, 2000 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
|
||||||
|
|
@ -26,8 +26,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For multiprocessor systems, we want to ensure all memory accesses
|
/* For multiprocessor systems, we want to ensure all memory accesses
|
||||||
are completed before we reset a lock. */
|
are completed before we reset a lock. On other systems, we still
|
||||||
#define MEMORY_BARRIER() __asm__ __volatile__ ("sync" : : : "memory")
|
need to make sure that the compiler has flushed everything to memory. */
|
||||||
|
#define MEMORY_BARRIER() __asm__ ("sync" : : : "memory")
|
||||||
|
|
||||||
/* Get some notion of the current stack. Need not be exactly the top
|
/* Get some notion of the current stack. Need not be exactly the top
|
||||||
of the stack, just something somewhere in the current frame. */
|
of the stack, just something somewhere in the current frame. */
|
||||||
|
|
@ -48,17 +49,17 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
sync();
|
MEMORY_BARRIER ();
|
||||||
__asm__ __volatile__(
|
__asm__ (
|
||||||
"0: lwarx %0,0,%1 ;"
|
"0: lwarx %0,0,%1 ;"
|
||||||
" xor. %0,%3,%0;"
|
" xor. %0,%3,%0;"
|
||||||
" bne 1f;"
|
" bne 1f;"
|
||||||
" stwcx. %2,0,%1;"
|
" stwcx. %2,0,%1;"
|
||||||
" bne- 0b;"
|
" bne- 0b;"
|
||||||
"1: "
|
"1: "
|
||||||
: "=&r"(ret)
|
: "=&r"(ret)
|
||||||
: "r"(p), "r"(newval), "r"(oldval)
|
: "r"(p), "r"(newval), "r"(oldval)
|
||||||
: "cr0", "memory");
|
: "cr0", "memory");
|
||||||
MEMORY_BARRIER();
|
MEMORY_BARRIER ();
|
||||||
return ret == 0;
|
return ret == 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue