summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-colinux-2.4.28/gcc-registerparanoia.patch
blob: a4e9271313d1947a120f99a83e2515538a83b6a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

#
# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
#

--- linux-2.4.27/include/asm-arm/system.h~gcc-registerparanoia	2003-08-25 07:44:43.000000000 -0400
+++ linux-2.4.27/include/asm-arm/system.h	2004-11-27 15:32:23.613933592 -0500
@@ -3,6 +3,15 @@
 
 #ifdef __KERNEL__
 
+/*
+ * This is used to ensure the compiler did actually allocate the register we
+ * asked it for some inline assembly sequences.  Apparently we can't trust
+ * the compiler from one version to another so a bit of paranoia won't hurt.
+ * This string is meant to be concatenated with the inline asm string and
+ * will cause compilation to stop on mismatch.
+ */
+#define __asmeq(x, y)  ".ifnc " x "," y " ; .err ; .endif\n\t"
+
 #include <linux/config.h>
 #include <linux/kernel.h>
 
--- linux-2.4.27/include/asm-arm/uaccess.h~gcc-registerparanoia	2001-10-25 16:53:55.000000000 -0400
+++ linux-2.4.27/include/asm-arm/uaccess.h	2004-11-27 15:32:23.613933592 -0500
@@ -6,6 +6,7 @@
  */
 #include <linux/sched.h>
 #include <asm/errno.h>
+#include <asm/system.h>
 
 #define VERIFY_READ 0
 #define VERIFY_WRITE 1
@@ -71,7 +72,9 @@
 extern int __get_user_bad(void);
 
 #define __get_user_x(__r1,__p,__e,__s,__i...)				\
-	   __asm__ __volatile__ ("bl	__get_user_" #__s		\
+	   __asm__ __volatile__ (					\
+		__asmeq("%0", "r0") __asmeq("%1", "r1")			\
+		"bl	__get_user_" #__s				\
 		: "=&r" (__e), "=r" (__r1)				\
 		: "0" (__p)						\
 		: __i)
@@ -110,7 +113,9 @@
 extern int __put_user_bad(void);
 
 #define __put_user_x(__r1,__p,__e,__s,__i...)				\
-	   __asm__ __volatile__ ("bl	__put_user_" #__s		\
+	   __asm__ __volatile__ (					\
+		__asmeq("%0", "r0") __asmeq("%2", "r1")			\
+		"bl	__put_user_" #__s				\
 		: "=&r" (__e)						\
 		: "0" (__p), "r" (__r1)					\
 		: __i)