[vxworks] Fix ppc lock

Nathan Sidwell nathan@codesourcery.com
Wed Apr 22 10:59:00 GMT 2009


I've applied this patch to fix a latent bug in the vxworks powerpc locking.  The 
locking primitive vxworks provides on powerpc requires an aligned 4 byte object 
(this doesn't appear to be documented).  We were just using a single byte, and 
most of the time we got lucky because the object being locked was a static 
object that was optimized to have 4 byte alignment and ended up with 3 bytes of 
trailing padding.

Unfortunately that sometimes fails.  this is the least intrusive fix I could 
think of.  For ppc we force the locking object to have 4 byte alignment and add 
2 bytes of padding.  Fortunately the locking operation only looks at one bit of 
the word, so it is ok to overlay the 'done' field onto the word that the ppc 
lock uses.

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vx.patch
Type: text/x-patch
Size: 2128 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090422/4ca14e02/attachment.bin>


More information about the Gcc-patches mailing list