Date: Mon, 28 Mar 2005 18:05:23 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 73981 for review Message-ID: <200503281805.j2SI5Nn7061211@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=73981 Change 73981 by jhb@jhb_twclab on 2005/03/28 18:04:56 Rework yet again to fix atomic.c build. Affected files ... .. //depot/projects/smpng/sys/i386/include/atomic.h#25 edit Differences ... ==== //depot/projects/smpng/sys/i386/include/atomic.h#25 (text+ko) ==== @@ -69,8 +69,7 @@ */ #if defined(KLD_MODULE) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ -ATOMIC_ACQ(NAME, TYPE) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); @@ -104,14 +103,12 @@ : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ -ATOMIC_ACQ(NAME, TYPE); \ struct __hack #else /* !__GNUCLIKE_ASM */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ -ATOMIC_ACQ(NAME, TYPE) +extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) #endif /* __GNUCLIKE_ASM */ @@ -242,15 +239,6 @@ #endif /* KLD_MODULE */ -#define ATOMIC_ACQ(NAME, TYPE) \ -static __inline void \ -atomic_##NAME##_acq_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - atomic_##NAME##_##TYPE(p, v); \ - __asm __volatile("" ::: "memory"); \ -} \ -struct __hack - ATOMIC_ASM(set, char, "orb %b1,%0", "iq", v); ATOMIC_ASM(clear, char, "andb %b1,%0", "iq", ~v); ATOMIC_ASM(add, char, "addb %b1,%0", "iq", v); @@ -279,6 +267,7 @@ #undef ATOMIC_ASM #undef ATOMIC_STORE_LOAD +#if !defined(WANT_FUNCTIONS) #define atomic_set_rel_char atomic_set_char #define atomic_clear_rel_char atomic_clear_char #define atomic_add_rel_char atomic_add_char @@ -354,7 +343,35 @@ #define atomic_cmpset_rel_32 atomic_cmpset_rel_int #define atomic_readandclear_32 atomic_readandclear_int -#if !defined(WANT_FUNCTIONS) +#define ATOMIC_ACQ(NAME, TYPE) \ +static __inline void \ +atomic_##NAME##_acq_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + atomic_##NAME##_##TYPE(p, v); \ + __asm __volatile("" ::: "memory"); \ +} \ +struct __hack + +ATOMIC_ACQ(set, char); +ATOMIC_ACQ(clear, char); +ATOMIC_ACQ(add, char); +ATOMIC_ACQ(subtract, char); + +ATOMIC_ACQ(set, short); +ATOMIC_ACQ(clear, short); +ATOMIC_ACQ(add, short); +ATOMIC_ACQ(subtract, short); + +ATOMIC_ACQ(set, int); +ATOMIC_ACQ(clear, int); +ATOMIC_ACQ(add, int); +ATOMIC_ACQ(subtract, int); + +ATOMIC_ACQ(set, long); +ATOMIC_ACQ(clear, long); +ATOMIC_ACQ(add, long); +ATOMIC_ACQ(subtract, long); + static __inline int atomic_cmpset_acq_int(volatile u_int *dst, u_int exp, u_int src) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503281805.j2SI5Nn7061211>