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

Next file: linux/include/asm-i386/ioctl.h
Previous file: linux/fs/msdos/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.40/linux/include/asm-alpha/system.h linux/include/asm-alpha/system.h
@@ -100,37 +100,39 @@
 /*
  * Give prototypes to shut up gcc.
  */
-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_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_u32(volatile int * m, unsigned long val)
 {
-	unsigned long old_val;
+	unsigned long dummy, dummy2;
 
-	__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;
+	__asm__ __volatile__(
+		"\n1:\t"
+		"ldl_l %0,0(%1)\n\t"
+		"bis %2,%2,%3\n\t"
+		"stl_c %3,0(%1)\n\t"
+		"beq %3,1b\n"
+		: "=r" (val), "=r" (m), "=r" (dummy), "=r" (dummy2)
+		: "1" (m), "2" (val)
+		: "memory");
+	return val;
 }
 
-extern inline unsigned long xchg_u64(volatile long * m, unsigned long new_val)
+extern inline unsigned long xchg_u64(volatile long * m, unsigned long val)
 {
-	unsigned long old_val;
+	unsigned long dummy, dummy2;
 
-	__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;
+	__asm__ __volatile__(
+		"\n1:\t"
+		"ldq_l %0,0(%1)\n\t"
+		"bis %2,%2,%3\n\t"
+		"stq_c %3,0(%1)\n\t"
+		"beq %3,1b\n"
+		: "=r" (val), "=r" (m), "=r" (dummy), "=r" (dummy2)
+		: "1" (m), "2" (val)
+		: "memory");
+	return 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