Deleted Added
full compact
atomic.h (137623) atomic.h (137784)
1/*-
2 * Copyright (c) 1998 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/i386/include/atomic.h 137623 2004-11-12 19:18:46Z jhb $
26 * $FreeBSD: head/sys/i386/include/atomic.h 137784 2004-11-16 20:42:32Z jhb $
27 */
28#ifndef _MACHINE_ATOMIC_H_
29#define _MACHINE_ATOMIC_H_
30
31/*
32 * Various simple arithmetic on memory which is atomic in the presence
33 * of interrupts and multiple processors.
34 *

--- 78 unchanged lines hidden (view full) ---

113 *
114 * if (*dst == exp) *dst = src (all 32 bit words)
115 *
116 * Returns 0 on failure, non-zero on success
117 */
118
119#if defined(__GNUC__) || defined(__INTEL_COMPILER)
120
27 */
28#ifndef _MACHINE_ATOMIC_H_
29#define _MACHINE_ATOMIC_H_
30
31/*
32 * Various simple arithmetic on memory which is atomic in the presence
33 * of interrupts and multiple processors.
34 *

--- 78 unchanged lines hidden (view full) ---

113 *
114 * if (*dst == exp) *dst = src (all 32 bit words)
115 *
116 * Returns 0 on failure, non-zero on success
117 */
118
119#if defined(__GNUC__) || defined(__INTEL_COMPILER)
120
121#if defined(I386_CPU) || defined(CPU_DISABLE_CMPXCHG)
121#if defined(CPU_DISABLE_CMPXCHG)
122
123static __inline int
124atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
125{
126 int res = exp;
127
128 __asm __volatile(
129 " pushfl ; "

--- 9 unchanged lines hidden (view full) ---

139 : "+a" (res) /* 0 (result) */
140 : "r" (src), /* 1 */
141 "m" (*(dst)) /* 2 */
142 : "memory");
143
144 return (res);
145}
146
122
123static __inline int
124atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
125{
126 int res = exp;
127
128 __asm __volatile(
129 " pushfl ; "

--- 9 unchanged lines hidden (view full) ---

139 : "+a" (res) /* 0 (result) */
140 : "r" (src), /* 1 */
141 "m" (*(dst)) /* 2 */
142 : "memory");
143
144 return (res);
145}
146
147#else /* defined(I386_CPU) */
147#else /* defined(CPU_DISABLE_CMPXCHG) */
148
149static __inline int
150atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
151{
152 int res = exp;
153
154 __asm __volatile (
155 " " __XSTRING(MPLOCKED) " "

--- 5 unchanged lines hidden (view full) ---

161 : "+a" (res) /* 0 (result) */
162 : "r" (src), /* 1 */
163 "m" (*(dst)) /* 2 */
164 : "memory");
165
166 return (res);
167}
168
148
149static __inline int
150atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
151{
152 int res = exp;
153
154 __asm __volatile (
155 " " __XSTRING(MPLOCKED) " "

--- 5 unchanged lines hidden (view full) ---

161 : "+a" (res) /* 0 (result) */
162 : "r" (src), /* 1 */
163 "m" (*(dst)) /* 2 */
164 : "memory");
165
166 return (res);
167}
168
169#endif /* defined(I386_CPU) */
169#endif /* defined(CPU_DISABLE_CMPXCHG) */
170
171#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
172
173#if defined(__GNUC__) || defined(__INTEL_COMPILER)
174
175#if defined(_KERNEL) && !defined(SMP)
176
177/*

--- 276 unchanged lines hidden ---
170
171#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
172
173#if defined(__GNUC__) || defined(__INTEL_COMPILER)
174
175#if defined(_KERNEL) && !defined(SMP)
176
177/*

--- 276 unchanged lines hidden ---