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

Next file: linux/include/asm-alpha/unistd.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.11/linux/include/asm-alpha/system.h linux/include/asm-alpha/system.h
@@ -118,6 +118,16 @@
 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
 #define tas(ptr) (xchg((ptr),1))
 
+/*
+ * This function doesn't exist, so you'll get a linker error
+ * if something tries to do an invalid xchg().
+ *
+ * This only works if the compiler isn't horribly bad at optimizing.
+ * gcc-2.5.8 reportedly can't handle this, but as that doesn't work
+ * too well on the alpha anyway..
+ */
+extern void __xchg_called_with_bad_pointer(void);
+
 static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
 {
 	switch (size) {
@@ -126,7 +136,7 @@
 		case 8:
 			return xchg_u64(ptr, x);
 	}
-	printk("Argh.. xchg() with unsupported size\n");
+	__xchg_called_with_bad_pointer();
 	return x;
 }
 

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