Adjust the constraint for "src" in atomic_(f)cmpset_8.
"r" is not sufficient to prevent the use of invalid byte-width registers with at least gcc. Reported and reviewed by: bde X-MFC-With: r315718
This commit is contained in:
parent
d09b527f96
commit
5788c2bde1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316031
@ -182,7 +182,7 @@ struct __hack
|
||||
*
|
||||
* Returns 0 on failure, non-zero on success.
|
||||
*/
|
||||
#define ATOMIC_CMPSET(TYPE) \
|
||||
#define ATOMIC_CMPSET(TYPE, CONS) \
|
||||
static __inline int \
|
||||
atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \
|
||||
{ \
|
||||
@ -196,7 +196,7 @@ atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \
|
||||
: "=q" (res), /* 0 */ \
|
||||
"+m" (*dst), /* 1 */ \
|
||||
"+a" (expect) /* 2 */ \
|
||||
: "r" (src) /* 3 */ \
|
||||
: CONS (src) /* 3 */ \
|
||||
: "memory", "cc"); \
|
||||
return (res); \
|
||||
} \
|
||||
@ -214,14 +214,14 @@ atomic_fcmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE *expect, u_##TYPE src) \
|
||||
: "=q" (res), /* 0 */ \
|
||||
"+m" (*dst), /* 1 */ \
|
||||
"+a" (*expect) /* 2 */ \
|
||||
: "r" (src) /* 3 */ \
|
||||
: CONS (src) /* 3 */ \
|
||||
: "memory", "cc"); \
|
||||
return (res); \
|
||||
}
|
||||
|
||||
ATOMIC_CMPSET(char);
|
||||
ATOMIC_CMPSET(short);
|
||||
ATOMIC_CMPSET(int);
|
||||
ATOMIC_CMPSET(char, "q");
|
||||
ATOMIC_CMPSET(short, "r");
|
||||
ATOMIC_CMPSET(int, "r");
|
||||
|
||||
/*
|
||||
* Atomically add the value of v to the integer pointed to by p and return
|
||||
|
Loading…
Reference in New Issue
Block a user