Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Apr 2012 12:41:20 +0400
From:      Slawa Olhovchenkov <slw@zxy.spb.ru>
To:        Fengwei yin <yfw.bsd@gmail.com>
Cc:        jack.ren@intel.com, freebsd-threads@freebsd.org
Subject:   Re: About the memory barrier in BSD libc
Message-ID:  <20120423084120.GD76983@zxy.spb.ru>
In-Reply-To: <CAPHpMu=DOGQ=TuFeYH7bH8hVwteT4Q3k67-mvoOFob6P3Y506w@mail.gmail.com>
References:  <CAPHpMu=DOGQ=TuFeYH7bH8hVwteT4Q3k67-mvoOFob6P3Y506w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 23, 2012 at 02:56:03PM +0800, Fengwei yin wrote:

> Hi list,
> If this is not correct question on the list, please let me know and
> sorry for noise.
> 
> I have a question regarding the BSD libc for SMP arch. I didn't see
> memory barrier used in libc.
> How can we make sure it's safe on SMP arch?

/usr/include/machine/atomic.h:

#define mb()    __asm __volatile("lock; addl $0,(%%esp)" : : : "memory")
#define wmb()   __asm __volatile("lock; addl $0,(%%esp)" : : : "memory")
#define rmb()   __asm __volatile("lock; addl $0,(%%esp)" : : : "memory")




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120423084120.GD76983>