This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
libstdc++ atomicity.h and ppc405 problem (was: RE: Regression test for thread safety?)
- From: Dan Kegel <dkegel at ixiacom dot com>
- To: 'Loren James Rittle ' <rittle at latour dot rsch dot comm dot mot dot com>, Dan Kegel --foward <dank at kegel dot com>
- Cc: "'libstdc++ at gcc dot gnu dot org '" <libstdc++ at gcc dot gnu dot org>, Jan Olderdissen <jolderdissen at ixiacom dot com>, Dan Kegel <dkegel at ixiacom dot com>, Bryan Rittmeyer <brittmeyer at ixiacom dot com>, Doug Schafer <doug at ixiacom dot com>
- Date: Thu, 18 Jul 2002 11:08:56 -0700
- Subject: libstdc++ atomicity.h and ppc405 problem (was: RE: Regression test for thread safety?)
Loren James Rittle wrote:
> It would be *very* helpful to the GCC project if you could report
> whether GCC 3.1 fixes your problem.
It probably doesn't. A coworker, Jan Olderdissen, found a
possible cause; according to ppc405 erratum #77 in
http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF8725
6A8000491BA2/$file/405CR_C_errata_1_2.pdf
the STWCX instruction is buggy in the ppc405; since it is used by
libstdc++-v3/config/cpu/powerpc/bits/atomicity.h,
and that file hasn't changed in two years, the bug is
probably still there.
That document says:
For stwcx. instructions that are executed in user mode,
perform the following sequence to mask asynchronous interrupts
(MSR[CE,EE,ME,DE]) before executing the stwcx....:
sc (with parameter to mask asynchronous interrupts)
stwcx
sc (with parameter to unmask asynchronous interrupts)
Note that the system call handler may have to be updated
to support parameters to mask and unmask asynchronous interrupts.
I'm not familiar enough with the ppc405 to know whether there's
a generic way of doing what they suggest, or whether it's board dependent.
Does anyone happen to have an atomicity.h that works around this
problem on the ppc405?
Thanks,
Dan