[parisc-linux-cvs] linux tausq

Randolph Chung Randolph Chung <randolph@tausq.org>
Sat, 26 Oct 2002 14:14:24 -0700


> -pa24
> implement put_user for 64-bit quantities on 32-bit userspace
> get_user is a bit more tricky, and doesn't seem to be used, so we'll leave that for another day :)

willy also suggested taking a look at whether we can remove the extable
stuff for the _kernel asm routines.

Index: include/asm-parisc/uaccess.h
===================================================================
RCS file: /var/cvs/linux/include/asm-parisc/uaccess.h,v
retrieving revision 1.13
diff -u -p -r1.13 uaccess.h
--- include/asm-parisc/uaccess.h	21 Jan 2002 00:15:15 -0000	1.13
+++ include/asm-parisc/uaccess.h	26 Oct 2002 20:21:39 -0000
@@ -37,8 +37,8 @@
 #if BITS_PER_LONG == 32
 #define LDD_KERNEL(ptr)		BUG()
 #define LDD_USER(ptr)		BUG()
-#define STD_KERNEL(x, ptr)	BUG()
-#define STD_USER(x, ptr)	BUG()
+#define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr)
+#define STD_USER(x, ptr) __put_user_asm64(x,ptr)
 #else
 #define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr)
 #define LDD_USER(ptr) __get_user_asm("ldd",ptr)
@@ -210,6 +210,43 @@ extern const struct exception_table_entr
 		 "\t.previous"                              \
 		: "=r"(__pu_err)                            \
 		: "r"(ptr), "r"(x), "0"(__pu_err))
+
+static inline void __put_kernel_asm64(u64 x, void *ptr)
+{
+	u32 hi = x>>32;
+	u32 lo = x&0xffffffff;
+	__asm__ __volatile__ (
+		"\n1:\tstw %1,0(%0)\n"
+		"\n2:\tstw %2,4(%0)\n"
+		"3:\n"
+		"\t.section __ex_table,\"a\"\n"
+		 "\t.word\t1b\n"
+		 "\t.word\t(3b-1b)+1\n"
+		 "\t.word\t2b\n"
+		 "\t.word\t(3b-2b)+1\n"
+		 "\t.previous"
+		: : "r"(ptr), "r"(hi), "r"(lo));
+
+}
+
+static inline void __put_user_asm64(u64 x, void *ptr)
+{
+	u32 hi = x>>32;
+	u32 lo = x&0xffffffff;
+	__asm__ __volatile__ (
+		"\n1:\tstw %1,0(%%sr3,%0)\n"
+		"\n2:\tstw %2,4(%%sr3,%0)\n"
+		"3:\n"
+		"\t.section __ex_table,\"a\"\n"
+		 "\t.word\t1b\n"
+		 "\t.word\t(3b-1b)+1\n"
+		 "\t.word\t2b\n"
+		 "\t.word\t(3b-2b)+1\n"
+		 "\t.previous"
+		: : "r"(ptr), "r"(hi), "r"(lo));
+
+}
+
 #endif
 
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/