浏览代码

fix missing barrier instructions in powerpc atomic asm

Rich Felker 10 年之前
父节点
当前提交
1456b7ae6b
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      arch/powerpc/atomic.h

+ 4 - 1
arch/powerpc/atomic.h

@@ -25,11 +25,14 @@ static inline int a_ctz_64(uint64_t x)
 
 static inline int a_cas(volatile int *p, int t, int s)
 {
-	__asm__("1:	lwarx %0, 0, %4\n"
+	__asm__("\n"
+		"	sync\n"
+		"1:	lwarx %0, 0, %4\n"
 		"	cmpw %0, %2\n"
 		"	bne 1f\n"
 		"	stwcx. %3, 0, %4\n"
 		"	bne- 1b\n"
+		"	isync\n"
 		"1:	\n"
 		: "=&r"(t), "+m"(*p) : "r"(t), "r"(s), "r"(p) : "cc", "memory" );
         return t;