Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 May 2020 19:03:45 +0000 (UTC)
From:      Brandon Bergren <bdragon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361535 - head/sys/powerpc/include
Message-ID:  <202005261903.04QJ3j6P094461@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdragon
Date: Tue May 26 19:03:45 2020
New Revision: 361535
URL: https://svnweb.freebsd.org/changeset/base/361535

Log:
  [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

Modified:
  head/sys/powerpc/include/atomic.h

Modified: head/sys/powerpc/include/atomic.h
==============================================================================
--- head/sys/powerpc/include/atomic.h	Tue May 26 17:54:11 2020	(r361534)
+++ head/sys/powerpc/include/atomic.h	Tue May 26 19:03:45 2020	(r361535)
@@ -621,7 +621,7 @@ atomic_cmpset_masked(uint32_t *p, uint32_t cmpval, uin
 	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 */



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