Date: Mon, 15 Jan 2001 12:22:50 +1100 From: Peter Jeremy <peter.jeremy@alcatel.com.au> To: freebsd-current@FreeBSD.ORG Cc: current@FreeBSD.ORG Subject: Re: Atomic breakage? Message-ID: <20010115122250.Y91029@gsmx07.alcatel.com.au> In-Reply-To: <20010114170520.B30588@dragon.nuxi.com>; from TrimYourCc@NUXI.com on Sun, Jan 14, 2001 at 05:05:20PM -0800 References: <200101142102.f0EL2OI25280@gratis.grondar.za> <20010115092544.U91029@gsmx07.alcatel.com.au> <20010114170520.B30588@dragon.nuxi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2001-Jan-14 17:05:20 -0800, David O'Brien <TrimYourCc@NUXI.com> wrote: >On Mon, Jan 15, 2001 at 09:25:45AM +1100, Peter Jeremy wrote: >> Due to incompatibilities between __asm in different versions of gcc, >> several different versions of various macros (and expansions) are >> necessary. > >Why is that?? The base, and *only* supported compiler for building >kernels is GCC 2.95.x, period. GCC 2.8 and 2.7 support should be garbage >collected. Feel free to delete it. It was added during the transition period (when we were migrating away from 2.7), but was never cleaned out. The (untested) patch is: Index: atomic.h =================================================================== RCS file: /home/CVSROOT/src/sys/i386/include/atomic.h,v retrieving revision 1.16 diff -u -r1.16 atomic.h --- atomic.h 2000/10/28 00:28:15 1.16 +++ atomic.h 2001/01/15 01:15:39 @@ -84,8 +84,6 @@ * The assembly is volatilized to demark potential before-and-after side * effects if an interrupt or SMP collision were to occur. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 9) -/* egcs 1.1.2+ version */ #define ATOMIC_ASM(NAME, TYPE, OP, V) \ static __inline void \ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ @@ -157,24 +155,8 @@ #define atomic_cmpset_acq_long atomic_cmpset_acq_int #define atomic_cmpset_rel_long atomic_cmpset_rel_int -#else -/* gcc <= 2.8 version */ -#define ATOMIC_ASM(NAME, TYPE, OP, V) \ -static __inline void \ -atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - __asm __volatile(MPLOCKED OP \ - : "=m" (*p) \ - : "ir" (V)); \ -} \ - \ - -#endif #endif /* KLD_MODULE */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 9) - -/* egcs 1.1.2+ version */ ATOMIC_ASM(set, char, "orb %b2,%0", v) ATOMIC_ASM(clear, char, "andb %b2,%0", ~v) ATOMIC_ASM(add, char, "addb %b2,%0", v) @@ -194,31 +176,6 @@ ATOMIC_ASM(clear, long, "andl %2,%0", ~v) ATOMIC_ASM(add, long, "addl %2,%0", v) ATOMIC_ASM(subtract, long, "subl %2,%0", v) - -#else - -/* gcc <= 2.8 version */ -ATOMIC_ASM(set, char, "orb %1,%0", v) -ATOMIC_ASM(clear, char, "andb %1,%0", ~v) -ATOMIC_ASM(add, char, "addb %1,%0", v) -ATOMIC_ASM(subtract, char, "subb %1,%0", v) - -ATOMIC_ASM(set, short, "orw %1,%0", v) -ATOMIC_ASM(clear, short, "andw %1,%0", ~v) -ATOMIC_ASM(add, short, "addw %1,%0", v) -ATOMIC_ASM(subtract, short, "subw %1,%0", v) - -ATOMIC_ASM(set, int, "orl %1,%0", v) -ATOMIC_ASM(clear, int, "andl %1,%0", ~v) -ATOMIC_ASM(add, int, "addl %1,%0", v) -ATOMIC_ASM(subtract, int, "subl %1,%0", v) - -ATOMIC_ASM(set, long, "orl %1,%0", v) -ATOMIC_ASM(clear, long, "andl %1,%0", ~v) -ATOMIC_ASM(add, long, "addl %1,%0", v) -ATOMIC_ASM(subtract, long, "subl %1,%0", v) - -#endif #undef ATOMIC_ASM Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010115122250.Y91029>