atomic.h (177373) | atomic.h (185162) |
---|---|
1/*- 2 * Copyright (c) 1998 Doug Rabson. 3 * Copyright (c) 2001 Jake Burkholder. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * from: FreeBSD: src/sys/i386/include/atomic.h,v 1.20 2001/02/11 | 1/*- 2 * Copyright (c) 1998 Doug Rabson. 3 * Copyright (c) 2001 Jake Burkholder. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * from: FreeBSD: src/sys/i386/include/atomic.h,v 1.20 2001/02/11 |
28 * $FreeBSD: head/sys/sparc64/include/atomic.h 177373 2008-03-19 07:27:24Z pjd $ | 28 * $FreeBSD: head/sys/sparc64/include/atomic.h 185162 2008-11-22 05:55:56Z kmacy $ |
29 */ 30 31#ifndef _MACHINE_ATOMIC_H_ 32#define _MACHINE_ATOMIC_H_ 33 34#include <machine/cpufunc.h> 35 36/* Userland needs different ASI's. */ 37#ifdef _KERNEL 38#define __ASI_ATOMIC ASI_N 39#else 40#define __ASI_ATOMIC ASI_P 41#endif 42 | 29 */ 30 31#ifndef _MACHINE_ATOMIC_H_ 32#define _MACHINE_ATOMIC_H_ 33 34#include <machine/cpufunc.h> 35 36/* Userland needs different ASI's. */ 37#ifdef _KERNEL 38#define __ASI_ATOMIC ASI_N 39#else 40#define __ASI_ATOMIC ASI_P 41#endif 42 |
43#define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") 44#define wmb() mb() 45#define rmb() mb() 46 |
|
43/* 44 * Various simple arithmetic on memory which is atomic in the presence 45 * of interrupts and multiple processors. See atomic(9) for details. 46 * Note that efficient hardware support exists only for the 32 and 64 47 * bit variants; the 8 and 16 bit versions are not provided and should 48 * not be used in MI code. 49 * 50 * This implementation takes advantage of the fact that the sparc64 --- 245 unchanged lines hidden --- | 47/* 48 * Various simple arithmetic on memory which is atomic in the presence 49 * of interrupts and multiple processors. See atomic(9) for details. 50 * Note that efficient hardware support exists only for the 32 and 64 51 * bit variants; the 8 and 16 bit versions are not provided and should 52 * not be used in MI code. 53 * 54 * This implementation takes advantage of the fact that the sparc64 --- 245 unchanged lines hidden --- |