libstdc++ atomicity.h and ppc405 problem (was: RE: Regression tes t for thread safety?)
Dan Kegel
dkegel@ixiacom.com
Thu Jul 18 11:10:00 GMT 2002
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
More information about the Libstdc++
mailing list