patch-1.3.39 linux/include/asm-alpha/system.h

Next file: linux/include/asm-i386/bitops.h
Previous file: linux/include/asm-alpha/string.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.38/linux/include/asm-alpha/system.h linux/include/asm-alpha/system.h
@@ -100,37 +100,37 @@
 /*
  * Give prototypes to shut up gcc.
  */
-extern inline unsigned long xchg_u32 (volatile int * m, unsigned long val);
-extern inline unsigned long xchg_u64 (volatile long * m, unsigned long val);
+extern inline unsigned long xchg_u32 (volatile int * m, unsigned long new_val);
+extern inline unsigned long xchg_u64 (volatile long * m, unsigned long new_val);
 
-extern inline unsigned long xchg_u32(volatile int * m, unsigned long val)
+extern inline unsigned long xchg_u32(volatile int * m, unsigned long new_val)
 {
-	unsigned long dummy, dummy2;
+	unsigned long old_val;
 
-	__asm__ __volatile__(
-		"\n1:\t"
-		"ldl_l %0,%1\n\t"
-		"bis %2,%2,%3\n\t"
-		"stl_c %3,%1\n\t"
-		"beq %3,1b\n"
-		: "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
-		: "1" (*m), "2" (val));
-	return val;
+	__asm__ __volatile__("\n1:\t"
+			     "ldl_l %0,%2\n\t"
+			     "bis %3,%3,$25\n\t"
+			     "stl_c $25,%1\n\t"
+			     "beq $25,1b\n"
+			     : "=r"(old_val), "=m"(*m)
+			     : "m"(*m), "r"(new_val)
+			     : "$25");
+	return old_val;
 }
 
-extern inline unsigned long xchg_u64(volatile long * m, unsigned long val)
+extern inline unsigned long xchg_u64(volatile long * m, unsigned long new_val)
 {
-	unsigned long dummy, dummy2;
+	unsigned long old_val;
 
-	__asm__ __volatile__(
-		"\n1:\t"
-		"ldq_l %0,%1\n\t"
-		"bis %2,%2,%3\n\t"
-		"stq_c %3,%1\n\t"
-		"beq %3,1b\n"
-		: "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
-		: "1" (*m), "2" (val));
-	return val;
+	__asm__ __volatile__("\n1:\t"
+			     "ldq_l %0,%2\n\t"
+			     "bis %3,%3,$25\n\t"
+			     "stq_c $25,%1\n\t"
+			     "beq $25,1b\n"
+			     : "=r"(old_val), "=m"(*m)
+			     : "m"(*m), "r"(new_val)
+			     : "$25");
+	return old_val;
 }
 
 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this