[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#198158: architecture i386 isn't i386 anymore



On Mon, Jun 23, 2003 at 07:00:21PM -0500, Adam Heath wrote:
> On Tue, 24 Jun 2003, "Martin v. Löwis" wrote:
> >
> > static inline _Atomic_word
> > __attribute__ ((__unused__))
> > __exchange_and_add (volatile _Atomic_word *__mem, int __val)
> > {
> >    register _Atomic_word __result;
> >    __asm__ __volatile__ ("lock; xaddl %0,%2"
> >                          : "=r" (__result)
> >                          : "0" (__val), "m" (*__mem)
> >                          : "memory");
> >    return __result;
> > }
> >
> Er, if this function is inlined, then how can it be part of some published
> api?  If it's not part of some published api, then how can using an i386
> variation cause problems with other distributions?

It's pretty clear by comparing the implementations.  The i386 version
aquires a global spinlock, and once aquired, increments the variable.
The i486 version increments the variable using an atomic instruction.

Code compiled against the i386 header and code compiled against the
i486 header will have problems using __exchange_and_add() on the
same memory location.  It appears that this inlined function is
used by other inline functions, which are actually exported by the
API, and thus could appear in the application.



dave...



Reply to: