For the atomic_{add|clear|set|subtract} family of inlines, return the

old or previous value instead of void. This is not as is documented
in atomic(9), but is API (and ABI) compatible and simply makes sense.
This feature will primarily be used for atomic PTE updates in PMAP/ng.
This commit is contained in:
Marcel Moolenaar 2004-09-22 19:58:43 +00:00
parent 5c48823c36
commit 08d3edb315
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135583

View file

@ -139,7 +139,7 @@ ATOMIC_STORE_LOAD(long, 64, "8")
#undef ATOMIC_STORE_LOAD
#define IA64_ATOMIC(sz, type, name, width, op) \
static __inline void \
static __inline type \
atomic_##name##_acq_##width(volatile type *p, type v) \
{ \
type old, ret; \
@ -147,9 +147,10 @@ ATOMIC_STORE_LOAD(long, 64, "8")
old = *p; \
IA64_CMPXCHG(sz, acq, p, old, old op v, ret); \
} while (ret != old); \
return (old); \
} \
\
static __inline void \
static __inline type \
atomic_##name##_rel_##width(volatile type *p, type v) \
{ \
type old, ret; \
@ -157,6 +158,7 @@ ATOMIC_STORE_LOAD(long, 64, "8")
old = *p; \
IA64_CMPXCHG(sz, rel, p, old, old op v, ret); \
} while (ret != old); \
return (old); \
}
IA64_ATOMIC(1, uint8_t, set, 8, |)