patch-2.4.20 linux-2.4.20/include/asm-parisc/uaccess.h
Next file: linux-2.4.20/include/asm-parisc/unaligned.h
Previous file: linux-2.4.20/include/asm-parisc/types.h
Back to the patch index
Back to the overall index
- Lines: 157
- Date:
Thu Nov 28 15:53:15 2002
- Orig file:
linux-2.4.19/include/asm-parisc/uaccess.h
- Orig date:
Wed Dec 6 11:46:39 2000
diff -urN linux-2.4.19/include/asm-parisc/uaccess.h linux-2.4.20/include/asm-parisc/uaccess.h
@@ -34,6 +34,18 @@
#define put_user __put_user
#define get_user __get_user
+#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()
+#else
+#define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr)
+#define LDD_USER(ptr) __get_user_asm("ldd",ptr)
+#define STD_KERNEL(x, ptr) __put_kernel_asm("std",x,ptr)
+#define STD_USER(x, ptr) __put_user_asm("std",x,ptr)
+#endif
+
/*
* The exception table contains two values: the first is an address
* for an instruction that is allowed to fault, and the second is
@@ -46,7 +58,7 @@
struct exception_table_entry {
unsigned long addr; /* address of insn that is allowed to fault. */
- int skip; /* pcoq skip | r9 clear flag | r8 -EFAULT flag */
+ long skip; /* pcoq skip | r9 clear flag | r8 -EFAULT flag */
};
extern const struct exception_table_entry
@@ -62,7 +74,7 @@
case 1: __get_kernel_asm("ldb",ptr); break; \
case 2: __get_kernel_asm("ldh",ptr); break; \
case 4: __get_kernel_asm("ldw",ptr); break; \
- case 8: __get_kernel_asm("ldd",ptr); break; \
+ case 8: LDD_KERNEL(ptr); break; \
default: BUG(); break; \
} \
} \
@@ -71,7 +83,7 @@
case 1: __get_user_asm("ldb",ptr); break; \
case 2: __get_user_asm("ldh",ptr); break; \
case 4: __get_user_asm("ldw",ptr); break; \
- case 8: __get_user_asm("ldd",ptr); break; \
+ case 8: LDD_USER(ptr); break; \
default: BUG(); break; \
} \
} \
@@ -80,6 +92,27 @@
__gu_err; \
})
+#ifdef __LP64__
+#define __get_kernel_asm(ldx,ptr) \
+ __asm__("\n1:\t" ldx "\t0(%2),%0\n" \
+ "2:\n" \
+ "\t.section __ex_table,\"a\"\n" \
+ "\t.dword\t1b\n" \
+ "\t.dword\t(2b-1b)+3\n" \
+ "\t.previous" \
+ : "=r"(__gu_val), "=r"(__gu_err) \
+ : "r"(ptr), "1"(__gu_err));
+
+#define __get_user_asm(ldx,ptr) \
+ __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n" \
+ "2:\n" \
+ "\t.section __ex_table,\"a\"\n" \
+ "\t.dword\t1b\n" \
+ "\t.dword\t(2b-1b)+3\n" \
+ "\t.previous" \
+ : "=r"(__gu_val), "=r"(__gu_err) \
+ : "r"(ptr), "1"(__gu_err));
+#else
#define __get_kernel_asm(ldx,ptr) \
__asm__("\n1:\t" ldx "\t0(%2),%0\n" \
"2:\n" \
@@ -99,7 +132,7 @@
"\t.previous" \
: "=r"(__gu_val), "=r"(__gu_err) \
: "r"(ptr), "1"(__gu_err));
-
+#endif
#define __put_user(x,ptr) \
({ \
@@ -110,7 +143,7 @@
case 1: __put_kernel_asm("stb",x,ptr); break; \
case 2: __put_kernel_asm("sth",x,ptr); break; \
case 4: __put_kernel_asm("stw",x,ptr); break; \
- case 8: __put_kernel_asm("std",x,ptr); break; \
+ case 8: STD_KERNEL(x,ptr); break; \
default: BUG(); break; \
} \
} \
@@ -119,7 +152,7 @@
case 1: __put_user_asm("stb",x,ptr); break; \
case 2: __put_user_asm("sth",x,ptr); break; \
case 4: __put_user_asm("stw",x,ptr); break; \
- case 8: __put_user_asm("std",x,ptr); break; \
+ case 8: STD_USER(x,ptr); break; \
default: BUG(); break; \
} \
} \
@@ -133,6 +166,29 @@
* gcc knows about, so there are no aliasing issues.
*/
+#ifdef __LP64__
+#define __put_kernel_asm(stx,x,ptr) \
+ __asm__ __volatile__ ( \
+ "\n1:\t" stx "\t%2,0(%1)\n" \
+ "2:\n" \
+ "\t.section __ex_table,\"a\"\n" \
+ "\t.dword\t1b\n" \
+ "\t.dword\t(2b-1b)+1\n" \
+ "\t.previous" \
+ : "=r"(__pu_err) \
+ : "r"(ptr), "r"(x), "0"(__pu_err))
+
+#define __put_user_asm(stx,x,ptr) \
+ __asm__ __volatile__ ( \
+ "\n1:\t" stx "\t%2,0(%%sr3,%1)\n" \
+ "2:\n" \
+ "\t.section __ex_table,\"a\"\n" \
+ "\t.dword\t1b\n" \
+ "\t.dword\t(2b-1b)+1\n" \
+ "\t.previous" \
+ : "=r"(__pu_err) \
+ : "r"(ptr), "r"(x), "0"(__pu_err))
+#else
#define __put_kernel_asm(stx,x,ptr) \
__asm__ __volatile__ ( \
"\n1:\t" stx "\t%2,0(%1)\n" \
@@ -154,6 +210,7 @@
"\t.previous" \
: "=r"(__pu_err) \
: "r"(ptr), "r"(x), "0"(__pu_err))
+#endif
/*
@@ -174,16 +231,11 @@
#define strnlen_user lstrnlen_user
#define strlen_user(str) lstrnlen_user(str, 0x7fffffffL)
#define clear_user lclear_user
+#define __clear_user lclear_user
#define copy_from_user lcopy_from_user
#define __copy_from_user lcopy_from_user
#define copy_to_user lcopy_to_user
#define __copy_to_user lcopy_to_user
-#define copy_to_user_ret(to,from,n,retval) \
- ({ if (lcopy_to_user(to,from,n)) return retval; })
-
-#define copy_from_user_ret(to,from,n,retval) \
- ({ if (lcopy_from_user(to,from,n)) return retval; })
-
#endif /* __PARISC_UACCESS_H */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)