atomicity.h (__Atomicity_lock<__inst>::_S_atomicity_lock): Correct alignment.

* hppa/atomicity.h (__Atomicity_lock<__inst>::_S_atomicity_lock):
	Correct alignment.
	(__exchange_and_add, __atomic_add): Use PA 2.0 ordered store to reset
	lock.

From-SVN: r62593
This commit is contained in:
John David Anglin 2003-02-09 03:23:13 +00:00 committed by John David Anglin
parent cefadf78ae
commit 5053bdf834
2 changed files with 16 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2003-02-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* hppa/atomicity.h (__Atomicity_lock<__inst>::_S_atomicity_lock):
Correct alignment.
(__exchange_and_add, __atomic_add): Use PA 2.0 ordered store to reset
lock.
2003-02-07 Paolo Carlini <pcarlini@unitus.it>
* testsuite/27_io/filebuf_virtuals.cc (test08): Fix for

View File

@ -25,11 +25,12 @@ typedef int _Atomic_word;
template <int __inst>
struct __Atomicity_lock
{
static volatile int __attribute__ ((aligned (16))) _S_atomicity_lock;
static volatile int _S_atomicity_lock;
};
template <int __inst>
volatile int __Atomicity_lock<__inst>::_S_atomicity_lock = 1;
volatile int
__Atomicity_lock<__inst>::_S_atomicity_lock __attribute__ ((aligned (16))) = 1;
/* Because of the lack of weak support when using the hpux
som linker, we explicitly instantiate the atomicity lock
@ -58,8 +59,9 @@ __exchange_and_add (volatile _Atomic_word* __mem, int __val)
result = *__mem;
*__mem = result + __val;
__asm__ __volatile__("");
lock = tmp;
/* Reset lock with PA 2.0 "ordered" store. */
__asm__ __volatile__ ("stw,ma %1,0(%0)"
: : "r" (&lock), "r" (tmp) : "memory");
return result;
}
@ -80,8 +82,9 @@ __atomic_add (_Atomic_word* __mem, int __val)
: "r" (&lock));
*__mem += __val;
__asm__ __volatile__("");
lock = tmp;
/* Reset lock with PA 2.0 "ordered" store. */
__asm__ __volatile__ ("stw,ma %1,0(%0)"
: : "r" (&lock), "r" (tmp) : "memory");
}
#endif