mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-19 06:44:31 +00:00
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:
parent
5c48823c36
commit
08d3edb315
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135583
|
@ -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, |)
|
||||
|
|
Loading…
Reference in a new issue