patch-2.3.9 linux/include/asm-mips/uaccess.h

Next file: linux/include/asm-mips/umap.h
Previous file: linux/include/asm-mips/timex.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/uaccess.h linux/include/asm-mips/uaccess.h
@@ -265,6 +265,21 @@
 
 extern void __put_user_unknown(void);
 
+/*
+ * We're generating jump to subroutines which will be outside the range of
+ * jump instructions
+ */
+#ifdef MODULE
+#define __MODULE_JAL(destination) \
+	".set\tnoat\n\t" \
+	"la\t$1, " #destination "\n\t" \
+	"jalr\t$1\n\t" \
+	".set\tat\n\t"
+#else
+#define __MODULE_JAL(destination) \
+	"jal\t" #destination "\n\t"
+#endif
+
 #define copy_to_user_ret(to,from,n,retval) ({ \
 if (copy_to_user(to,from,n)) \
         return retval; \
@@ -289,7 +304,7 @@
 		"move\t$4, %1\n\t" \
 		"move\t$5, %2\n\t" \
 		"move\t$6, %3\n\t" \
-		"jal\t__copy_user\n\t" \
+		__MODULE_JAL(__copy_user) \
 		"move\t%0, $6" \
 		: "=r" (__cu_len) \
 		: "r" (__cu_to), "r" (__cu_from), "r" (__cu_len) \
@@ -313,7 +328,7 @@
 		".set\tnoat\n\t" \
 		"addu\t$1, %2, %3\n\t" \
 		".set\tat\n\t" \
-		"jal\t__copy_user\n\t" \
+		__MODULE_JAL(__copy_user) \
 		"move\t%0, $6" \
 		: "=r" (__cu_len) \
 		: "r" (__cu_to), "r" (__cu_from), "r" (__cu_len) \
@@ -335,7 +350,7 @@
 			"move\t$4, %1\n\t" \
 			"move\t$5, %2\n\t" \
 			"move\t$6, %3\n\t" \
-			"jal\t__copy_user\n\t" \
+			__MODULE_JAL(__copy_user) \
 			"move\t%0, $6" \
 			: "=r" (__cu_len) \
 			: "r" (__cu_to), "r" (__cu_from), "r" (__cu_len) \
@@ -360,7 +375,7 @@
 			".set\tnoat\n\t" \
 			"addu\t$1, %2, %3\n\t" \
 			".set\tat\n\t" \
-			"jal\t__copy_user\n\t" \
+			__MODULE_JAL(__copy_user) \
 			"move\t%0, $6" \
 			: "=r" (__cu_len) \
 			: "r" (__cu_to), "r" (__cu_from), "r" (__cu_len) \
@@ -378,7 +393,7 @@
 		"move\t$4, %1\n\t"
 		"move\t$5, $0\n\t"
 		"move\t$6, %2\n\t"
-		"jal\t__bzero\n\t"
+		__MODULE_JAL(__bzero)
 		"move\t%0, $6"
 		: "=r" (res)
 		: "r" (addr), "r" (size)
@@ -407,7 +422,7 @@
 		"move\t$4, %1\n\t"
 		"move\t$5, %2\n\t"
 		"move\t$6, %3\n\t"
-		"jal\t__strncpy_from_user_nocheck_asm\n\t"
+		__MODULE_JAL(__strncpy_from_user_nocheck_asm)
 		"move\t%0, $2"
 		: "=r" (res)
 		: "r" (__to), "r" (__from), "r" (__len)
@@ -425,7 +440,7 @@
 		"move\t$4, %1\n\t"
 		"move\t$5, %2\n\t"
 		"move\t$6, %3\n\t"
-		"jal\t__strncpy_from_user_asm\n\t"
+		__MODULE_JAL(__strncpy_from_user_asm)
 		"move\t%0, $2"
 		: "=r" (res)
 		: "r" (__to), "r" (__from), "r" (__len)
@@ -442,7 +457,7 @@
 
 	__asm__ __volatile__(
 		"move\t$4, %1\n\t"
-		"jal\t__strlen_user_nocheck_asm\n\t"
+		__MODULE_JAL(__strlen_user_nocheck_asm)
 		"move\t%0, $2"
 		: "=r" (res)
 		: "r" (s)
@@ -457,7 +472,7 @@
 
 	__asm__ __volatile__(
 		"move\t$4, %1\n\t"
-		"jal\t__strlen_user_asm\n\t"
+		__MODULE_JAL(__strlen_user_asm)
 		"move\t%0, $2"
 		: "=r" (res)
 		: "r" (s)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)