From owner-freebsd-current Sun Jan 14 17:23:30 2001 Delivered-To: freebsd-current@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 6B60C37B400; Sun, 14 Jan 2001 17:23:00 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id MAA07003; Mon, 15 Jan 2001 12:22:57 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37645) with ESMTP id <01JYXPKH8OO0GKTW3J@cim.alcatel.com.au>; Mon, 15 Jan 2001 12:23:01 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.0/8.11.0) id f0F1Mou17166; Mon, 15 Jan 2001 12:22:50 +1100 (EST envelope-from jeremyp) Content-return: prohibited Date: Mon, 15 Jan 2001 12:22:50 +1100 From: Peter Jeremy Subject: Re: Atomic breakage? In-reply-to: <20010114170520.B30588@dragon.nuxi.com>; from TrimYourCc@NUXI.com on Sun, Jan 14, 2001 at 05:05:20PM -0800 To: freebsd-current@FreeBSD.ORG Cc: current@FreeBSD.ORG Mail-followup-to: freebsd-current@FreeBSD.ORG, current@FreeBSD.ORG Message-id: <20010115122250.Y91029@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <200101142102.f0EL2OI25280@gratis.grondar.za> <20010115092544.U91029@gsmx07.alcatel.com.au> <20010114170520.B30588@dragon.nuxi.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 2001-Jan-14 17:05:20 -0800, David O'Brien 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