From owner-freebsd-current Mon Jun 24 14:56:27 2002 Delivered-To: freebsd-current@freebsd.org Received: from h132-197-179-27.gte.com (h132-197-179-27.gte.com [132.197.179.27]) by hub.freebsd.org (Postfix) with ESMTP id AC57337B407; Mon, 24 Jun 2002 14:56:14 -0700 (PDT) Received: from kanpc.gte.com (localhost [IPv6:::1]) by h132-197-179-27.gte.com (8.12.4/8.12.4) with ESMTP id g5OLuCbP064879; Mon, 24 Jun 2002 17:56:12 -0400 (EDT) (envelope-from ak03@kanpc.gte.com) Received: (from ak03@localhost) by kanpc.gte.com (8.12.4/8.12.4/Submit) id g5OLuCbE064878; Mon, 24 Jun 2002 17:56:12 -0400 (EDT) Date: Mon, 24 Jun 2002 17:56:12 -0400 From: Alexander Kabaev To: obrien@FreeBSD.ORG Cc: jdp@polstra.com, current@FreeBSD.ORG, rwatson@FreeBSD.ORG Subject: Re: Bootstrap problems for asm Message-Id: <20020624175612.7abe6e52.ak03@gte.com> In-Reply-To: <20020624112151.A55057@dragon.nuxi.com> References: <200206241524.g5OFO6p30824@vashon.polstra.com> <20020624112151.A55057@dragon.nuxi.com> Organization: Verizon Data Services X-Mailer: Sylpheed version 0.7.8claws6 (GTK+ 1.2.10; i386-portbld-freebsd5.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 I am not an inline assembler guru, but here is the patch I think get the job done. If I understannd things correcly, GCC accepts matching constraints only for parameters for which registers are allowed. Any constructive critique is appreciated. > Don't supose you are bored enough to tweak the asm statements to make > things happy? :-) -- Alexander Kabaev Index: i386/lockdflt.c =================================================================== RCS file: /usr/ncvs/src/libexec/rtld-elf/i386/lockdflt.c,v retrieving revision 1.6 diff -u -r1.6 lockdflt.c --- i386/lockdflt.c 17 Jul 2000 17:18:13 -0000 1.6 +++ i386/lockdflt.c 24 Jun 2002 21:35:35 -0000 @@ -81,7 +81,7 @@ __asm __volatile ("lock; cmpxchgl %2, %0" : "=m"(*m), "=a"(result) - : "r"(new), "0"(*m), "1"(old) + : "r"(new), "m"(*m), "1"(old) : "cc"); return result; @@ -94,7 +94,7 @@ __asm __volatile ("xchgl %0, %1" : "=r"(result), "=m"(*m) - : "0"(v), "1"(*m)); + : "0"(v), "m"(*m)); return result; } Index: i386/rtld_machdep.h =================================================================== RCS file: /usr/ncvs/src/libexec/rtld-elf/i386/rtld_machdep.h,v retrieving revision 1.6 diff -u -r1.6 rtld_machdep.h --- i386/rtld_machdep.h 29 Oct 2001 10:10:10 -0000 1.6 +++ i386/rtld_machdep.h 24 Jun 2002 19:24:04 -0000 @@ -55,13 +55,13 @@ static inline void atomic_decr_int(volatile int *p) { - __asm __volatile ("lock; decl %0" : "=m"(*p) : "0"(*p) : "cc"); + __asm __volatile ("lock; decl %0" : "=m"(*p) : "m"(*p) : "cc"); } static inline void atomic_incr_int(volatile int *p) { - __asm __volatile ("lock; incl %0" : "=m"(*p) : "0"(*p) : "cc"); + __asm __volatile ("lock; incl %0" : "=m"(*p) : "m"(*p) : "cc"); } static inline void @@ -69,7 +69,7 @@ { __asm __volatile ("lock; addl %1, %0" : "=m"(*p) - : "ri"(val), "0"(*p) + : "ri"(val), "m"(*p) : "cc"); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message