Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jan 2021 02:10:33 GMT
From:      Ryan Libby <rlibby@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 486580c44ce2 - main - arm: fix atomic_testand{set, clear}_64 for ops on high bits
Message-ID:  <202101030210.1032AXpB049058@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rlibby:

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

commit 486580c44ce29c1e3b1d9b858a08d9df9428b699
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2021-01-03 02:09:37 +0000
Commit:     Ryan Libby <rlibby@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));
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101030210.1032AXpB049058>