Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Nov 2001 16:22:32 -0600
From:      Jim Bryant <kc5vdj@yahoo.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        Bruce Evans <bde@zeta.org.au>, current@FreeBSD.ORG
Subject:   Re: kernel won't build - atomic.c/atomic.h errors...
Message-ID:  <3BEDA8A8.7060500@yahoo.com>
References:  <XFMail.011110135709.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I'll give it a try next time I build a kernel.  Thanks for the info on the optimization option info, adding -O was successful in 
compiling atomic.c.

John Baldwin wrote:

> 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 <machine/atomic.h> 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")
> 
> 

jim
-- 
          ET has one helluva sense of humor!
     He's always anal-probing right-wing schizos!
-----------------------------------------------------
                POWER TO THE PEOPLE!
-----------------------------------------------------
"Religious fundamentalism is the biggest threat to
     international security that exists today."
  United Nations Secretary General B.B.Ghali, 1995


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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?3BEDA8A8.7060500>