summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/atomic.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-07-15 18:17:59 +0000
committerjhb <jhb@FreeBSD.org>2005-07-15 18:17:59 +0000
commitc7383aebd6c8822e4076cb0bff21a9b60bfaf2f1 (patch)
tree9ea05f8294a9d7928ffaf2ba504cd7a6498d78e8 /sys/i386/include/atomic.h
parent78ae67348bdfe1ef3d92615df852da303d06b847 (diff)
downloadFreeBSD-src-c7383aebd6c8822e4076cb0bff21a9b60bfaf2f1.zip
FreeBSD-src-c7383aebd6c8822e4076cb0bff21a9b60bfaf2f1.tar.gz
Convert the atomic_ptr() operations over to operating on uintptr_t
variables rather than void * variables. This makes it easier and simpler to get asm constraints and volatile keywords correct. MFC after: 3 days Tested on: i386, alpha, sparc64 Compiled on: ia64, powerpc, amd64 Kernel toolchain busted on: arm
Diffstat (limited to 'sys/i386/include/atomic.h')
-rw-r--r--sys/i386/include/atomic.h70
1 files changed, 18 insertions, 52 deletions
diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h
index 4515ffb..6f0c2b7 100644
--- a/sys/i386/include/atomic.h
+++ b/sys/i386/include/atomic.h
@@ -336,9 +336,6 @@ u_long atomic_readandclear_long(volatile u_long *);
#define atomic_cmpset_acq_long atomic_cmpset_long
#define atomic_cmpset_rel_long atomic_cmpset_long
-#define atomic_cmpset_acq_ptr atomic_cmpset_ptr
-#define atomic_cmpset_rel_ptr atomic_cmpset_ptr
-
/* Operations on 8-bit bytes. */
#define atomic_set_8 atomic_set_char
#define atomic_set_acq_8 atomic_set_acq_char
@@ -392,55 +389,24 @@ u_long atomic_readandclear_long(volatile u_long *);
#define atomic_readandclear_32 atomic_readandclear_int
/* Operations on pointers. */
-static __inline int
-atomic_cmpset_ptr(volatile void *dst, void *exp, void *src)
-{
-
- return (atomic_cmpset_int((volatile u_int *)dst, (u_int)exp,
- (u_int)src));
-}
-
-static __inline void *
-atomic_load_acq_ptr(volatile void *p)
-{
- /*
- * The apparently-bogus cast to intptr_t in the following is to
- * avoid a warning from "gcc -Wbad-function-cast".
- */
- return ((void *)(intptr_t)atomic_load_acq_int((volatile u_int *)p));
-}
-
-static __inline void
-atomic_store_rel_ptr(volatile void *p, void *v)
-{
- atomic_store_rel_int((volatile u_int *)p, (u_int)v);
-}
-
-#define ATOMIC_PTR(NAME) \
-static __inline void \
-atomic_##NAME##_ptr(volatile void *p, uintptr_t v) \
-{ \
- atomic_##NAME##_int((volatile u_int *)p, v); \
-} \
- \
-static __inline void \
-atomic_##NAME##_acq_ptr(volatile void *p, uintptr_t v) \
-{ \
- atomic_##NAME##_acq_int((volatile u_int *)p, v);\
-} \
- \
-static __inline void \
-atomic_##NAME##_rel_ptr(volatile void *p, uintptr_t v) \
-{ \
- atomic_##NAME##_rel_int((volatile u_int *)p, v);\
-}
-
-ATOMIC_PTR(set)
-ATOMIC_PTR(clear)
-ATOMIC_PTR(add)
-ATOMIC_PTR(subtract)
-
-#undef ATOMIC_PTR
+#define atomic_set_ptr atomic_set_int
+#define atomic_set_acq_ptr atomic_set_acq_int
+#define atomic_set_rel_ptr atomic_set_rel_int
+#define atomic_clear_ptr atomic_clear_int
+#define atomic_clear_acq_ptr atomic_clear_acq_int
+#define atomic_clear_rel_ptr atomic_clear_rel_int
+#define atomic_add_ptr atomic_add_int
+#define atomic_add_acq_ptr atomic_add_acq_int
+#define atomic_add_rel_ptr atomic_add_rel_int
+#define atomic_subtract_ptr atomic_subtract_int
+#define atomic_subtract_acq_ptr atomic_subtract_acq_int
+#define atomic_subtract_rel_ptr atomic_subtract_rel_int
+#define atomic_load_acq_ptr atomic_load_acq_int
+#define atomic_store_rel_ptr atomic_store_rel_int
+#define atomic_cmpset_ptr atomic_cmpset_int
+#define atomic_cmpset_acq_ptr atomic_cmpset_acq_int
+#define atomic_cmpset_rel_ptr atomic_cmpset_rel_int
+#define atomic_readandclear_ptr atomic_readandclear_int
#endif /* !defined(WANT_FUNCTIONS) */
#endif /* ! _MACHINE_ATOMIC_H_ */
OpenPOWER on IntegriCloud