From 716baab384ded0d02bad67a4be52e9d2408ae636 Mon Sep 17 00:00:00 2001 From: Brandon Bergren Date: Tue, 26 May 2020 19:03:45 +0000 Subject: [PATCH] [PowerPC] Fix atomic_cmpset_masked(). A recent kernel change caused the previously unused atomic_cmpset_masked() to be used. It had a typo in it. Instead of reading the old value from an uninitialized variable, read it from the passed-in pointer as intended. This fixes crashes on 64 bit Book-E. Obtained from: jhibbits (cherry picked from commit 9941cb0657d63b4b1570dcf384196bb599bf9024) --- sys/powerpc/include/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h index 2510160a402..8da4607d71f 100644 --- a/sys/powerpc/include/atomic.h +++ b/sys/powerpc/include/atomic.h @@ -621,7 +621,7 @@ atomic_cmpset_masked(uint32_t *p, uint32_t cmpval, uint32_t newval, uint32_t tmp; __asm __volatile ( - "1:\tlwarx %2, 0, %2\n\t" /* load old value */ + "1:\tlwarx %2, 0, %3\n\t" /* load old value */ "and %0, %2, %7\n\t" "cmplw %4, %0\n\t" /* compare */ "bne- 2f\n\t" /* exit if not equal */ -- 2.45.0