Преглед на файлове

fix insufficient synchronization in sh atomic asm

while other usage I've seen only has the synco instruction after the
atomic operation, I cannot find any documentation indicating that this
is correct. certainly all stores before the atomic need to have been
synchronized before the atomic operation takes place.
Rich Felker преди 10 години
родител
ревизия
c394763d35
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      arch/sh/src/atomic.c

+ 2 - 1
arch/sh/src/atomic.c

@@ -1,7 +1,7 @@
 #include "libc.h"
 
 #define LLSC_CLOBBERS   "r0", "t", "memory"
-#define LLSC_START(mem)            \
+#define LLSC_START(mem) "synco\n"  \
 	"0:	movli.l @" mem ", r0\n"
 #define LLSC_END(mem)              \
 	"1:	movco.l r0, @" mem "\n"    \
@@ -99,6 +99,7 @@ void __sh_store(volatile int *p, int x)
 {
 	if (__hwcap & CPU_HAS_LLSC) {
 		__asm__ __volatile__(
+			"	synco\n"
 			"	mov.l %1, @%0\n"
 			"	synco\n"
 			: : "r"(p), "r"(x) : "memory");