lkml.org 
[lkml]   [2007]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 7/10] local_t : powerpc
* Paul Mackerras (paulus@samba.org) wrote:
> Mathieu Desnoyers writes:
>
> > +static __inline__ int local_dec_if_positive(local_t *l)
> > +{
> > + int t;
> > +
> > + __asm__ __volatile__(
> > +"1: lwarx %0,0,%1 # local_dec_if_positive\n\
> > + addic. %0,%0,-1\n\
> > + blt- 2f\n"
> > + PPC405_ERR77(0,%1)
> > +" stwcx. %0,0,%1\n\
> > + bne- 1b"
>
> This has the same bugs that we fixed recently in atomic_dec_if_positive;
> first, on 64-bit machines, the lwarx will zero-extend the word loaded
> from memory, and so the result of the addic will be negative only if
> the word was originally 0. Secondly, even on 32-bit machines,
> 0x80000000 will be considered positive since decrementing it gives
> 0x7fffffff, which is positive.
>
Hi Paul,

Thanks, will fix.

Mathieu

--
OpenPGP public key: http://krystal.dyndns.org:8080/key/compudj.gpg
Key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-01-24 18:45    [W:0.101 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site