From owner-freebsd-current Sat Nov 10 13:57:36 2001 Delivered-To: freebsd-current@freebsd.org Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by hub.freebsd.org (Postfix) with ESMTP id EB66D37B416 for ; Sat, 10 Nov 2001 13:57:31 -0800 (PST) Received: (qmail 26491 invoked from network); 10 Nov 2001 21:57:30 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 10 Nov 2001 21:57:30 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20011109000347.J2336-100000@delplex.bde.org> Date: Sat, 10 Nov 2001 13:57:09 -0800 (PST) From: John Baldwin To: Bruce Evans Subject: Re: kernel won't build - atomic.c/atomic.h errors... Cc: current@FreeBSD.ORG, Jim Bryant Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 08-Nov-01 Bruce Evans wrote: > On Fri, 2 Nov 2001, Jim Bryant wrote: > >> Is anyone else seeing this problem? I posted a message the other day to >> this list, and have yet to see a single response. >> >> This is from a completely fresh cvsup of everything. >> >> buildworld succeeds, but the kernel build fails on atomic.c with the >> following message about the ATOMIC_ASM macros in atomic.h. >> >> The archetecture is 5.0-really-current on an SMP P2-333 machine. >> >> the message seems to be: "inconsistent operand constraints in an `asm'" > > Only people who have clobbered -O in CFLAGS in /etc/make.conf should see > this problem :-). > > The i386 still uses archaic constraints for some > input-output operands ("0" for the first operand). These never worked > right and if fact don't actually work for compiling this file without > optimization. Hmm, would you prefer this diff then, I've had it floating around for a while now but wasn't sure it was right: --- //depot/vendor/freebsd/sys/i386/include/atomic.h 2001/10/08 14:41:47 +++ //depot/projects/smpng/sys/i386/include/atomic.h 2001/10/08 22:37:17 @@ -99,8 +99,8 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ __asm __volatile(MPLOCKED OP \ - : "=m" (*p) \ - : "0" (*p), "ir" (V)); \ + : "+m" (*p) \ + : "ir" (V)); \ } /* @@ -211,25 +211,25 @@ #endif /* KLD_MODULE */ #if !defined(LOCORE) -ATOMIC_ASM(set, char, "orb %b2,%0", v) -ATOMIC_ASM(clear, char, "andb %b2,%0", ~v) -ATOMIC_ASM(add, char, "addb %b2,%0", v) -ATOMIC_ASM(subtract, char, "subb %b2,%0", v) +ATOMIC_ASM(set, char, "orb %b1,%0", v) +ATOMIC_ASM(clear, char, "andb %b1,%0", ~v) +ATOMIC_ASM(add, char, "addb %b1,%0", v) +ATOMIC_ASM(subtract, char, "subb %b1,%0", v) -ATOMIC_ASM(set, short, "orw %w2,%0", v) -ATOMIC_ASM(clear, short, "andw %w2,%0", ~v) -ATOMIC_ASM(add, short, "addw %w2,%0", v) -ATOMIC_ASM(subtract, short, "subw %w2,%0", v) +ATOMIC_ASM(set, short, "orw %w1,%0", v) +ATOMIC_ASM(clear, short, "andw %w1,%0", ~v) +ATOMIC_ASM(add, short, "addw %w1,%0", v) +ATOMIC_ASM(subtract, short, "subw %w1,%0", v) -ATOMIC_ASM(set, int, "orl %2,%0", v) -ATOMIC_ASM(clear, int, "andl %2,%0", ~v) -ATOMIC_ASM(add, int, "addl %2,%0", v) -ATOMIC_ASM(subtract, int, "subl %2,%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 %2,%0", v) -ATOMIC_ASM(clear, long, "andl %2,%0", ~v) -ATOMIC_ASM(add, long, "addl %2,%0", v) -ATOMIC_ASM(subtract, long, "subl %2,%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) ATOMIC_STORE_LOAD(char, "cmpxchgb %b0,%1", "xchgb %b1,%0") ATOMIC_STORE_LOAD(short,"cmpxchgw %w0,%1", "xchgw %w1,%0") -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message