git: 486580c44ce2 - main - arm: fix atomic_testand{set, clear}_64 for ops on high bits

Ryan Libby rlibby at FreeBSD.org
Sun Jan 3 02:10:33 UTC 2021


The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=486580c44ce29c1e3b1d9b858a08d9df9428b699

commit 486580c44ce29c1e3b1d9b858a08d9df9428b699
Author:     Ryan Libby <rlibby at FreeBSD.org>
AuthorDate: 2021-01-03 02:09:37 +0000
Commit:     Ryan Libby <rlibby at FreeBSD.org>
CommitDate: 2021-01-03 02:09:37 +0000

    arm: fix atomic_testand{set,clear}_64 for ops on high bits
    
    The fix in bd03acedb804add1e22178d50eb2bfb703974ddf worked for 32-bit
    ops, and for 64-bit ops for bit arguments of 0 - 95, but then was broken
    for operations on the high 32 bits after that.
    
    Reviewed by:    markj, mmel
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D27897
---
 sys/arm/include/atomic-v6.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/arm/include/atomic-v6.h b/sys/arm/include/atomic-v6.h
index ede879cb9fa8..b81ad6447ef7 100644
--- a/sys/arm/include/atomic-v6.h
+++ b/sys/arm/include/atomic-v6.h
@@ -913,9 +913,8 @@ atomic_testandclear_64(volatile uint64_t *p, u_int v)
 	 * Assume little-endian,
 	 * atomic_testandclear_32() uses only last 5 bits of v
 	 */
-	if (v >= 32) {
+	if ((v & 0x20) != 0)
 		p32++;
-	}
 	return (atomic_testandclear_32(p32, v));
 }
 
@@ -973,9 +972,8 @@ atomic_testandset_64(volatile uint64_t *p, u_int v)
 	 * Assume little-endian,
 	 * atomic_testandset_32() uses only last 5 bits of v
 	 */
-	if (v >= 32) {
+	if ((v & 0x20) != 0)
 		p32++;
-	}
 	return (atomic_testandset_32(p32, v));
 }
 


More information about the dev-commits-src-main mailing list