/* This should get optimized out since it's never called. ** Or get a link error if xchg is used "wrong".
*/ externvoid __xchg_called_with_bad_pointer(void);
/* optimizer better get rid of switch since size is a constant */ staticinlineunsignedlong
__arch_xchg(unsignedlong x, volatilevoid *ptr, int size)
{ switch (size) { #ifdef CONFIG_64BIT case 8: return __xchg64(x, (volatileunsignedlong *) ptr); #endif case 4: return __xchg32((int) x, (volatileint *) ptr); case 1: return __xchg8((char) x, (volatilechar *) ptr);
}
__xchg_called_with_bad_pointer(); return x;
}
/* ** REVISIT - Abandoned use of LDCW in xchg() for now: ** o need to test sizeof(*ptr) to avoid clearing adjacent bytes ** o and while we are at it, could CONFIG_64BIT code use LDCD too? ** ** if (__builtin_constant_p(x) && (x == NULL)) ** if (((unsigned long)p & 0xf) == 0) ** return __ldcw(p);
*/ #define arch_xchg(ptr, x) \
({ \
__typeof__(*(ptr)) __ret; \
__typeof__(*(ptr)) _x_ = (x); \
__ret = (__typeof__(*(ptr))) \
__arch_xchg((unsignedlong)_x_, (ptr), sizeof(*(ptr))); \
__ret; \
})
/* bug catcher for when unsupported size is used - won't link */ externvoid __cmpxchg_called_with_bad_pointer(void);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.