Skip to content

Commit

Permalink
arm64: fix mask in atomic_testand{set,clear}_64
Browse files Browse the repository at this point in the history
These macros generate both the 32- and 64-bit ops, but the mask was hard
coded for 32-bit ops, causing the 64-bit ops always to affect only the
low 32 bits.

PR:		252324
Reported by:	gbe, mmel
Reviewed by:	markj, mmel
Tested by:	mmel, rwatson
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27886
  • Loading branch information
rlibby committed Jan 2, 2021
1 parent 3630506 commit 8266122
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sys/arm64/include/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ _ATOMIC_TEST_OP_PROTO(t, op, _llsc) \
uint##t##_t mask, old, tmp; \
int res; \
\
mask = 1u << (val & 0x1f); \
mask = ((uint##t##_t)1) << (val & (t - 1)); \
__asm __volatile( \
"1: ldxr %"#w"2, [%3]\n" \
" "#llsc_asm_op" %"#w"0, %"#w"2, %"#w"4\n" \
Expand All @@ -427,7 +427,7 @@ _ATOMIC_TEST_OP_PROTO(t, op, _lse) \
{ \
uint##t##_t mask, old; \
\
mask = 1u << (val & 0x1f); \
mask = ((uint##t##_t)1) << (val & (t - 1)); \
__asm __volatile( \
".arch_extension lse\n" \
"ld"#lse_asm_op" %"#w"2, %"#w"0, [%1]\n" \
Expand Down

0 comments on commit 8266122

Please sign in to comment.