This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]