| 
					
				 | 
			
			
				@@ -111,3 +111,105 @@ static inline __kernel_size_t __copy_from_user(void *to, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #define put_user(x,ptr)	\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	__put_user_check((x),(ptr),sizeof(*(ptr))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * get_user: - Get a simple variable from user space. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @x:   Variable to store result. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @ptr: Source address, in user space. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Context: User context only.  This function may sleep. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * This macro copies a single simple variable from user space to kernel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * space.  It supports simple types like char and int, but not larger 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * data types like structures or arrays. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @ptr must have pointer-to-simple-variable type, and the result of 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * dereferencing @ptr must be assignable to @x without a cast. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Returns zero on success, or -EFAULT on error. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * On error, the variable @x is set to zero. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define get_user(x,ptr) \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	__get_user_check((x),(ptr),sizeof(*(ptr))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * __put_user: - Write a simple value into user space, with less checking. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @x:   Value to copy to user space. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @ptr: Destination address, in user space. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Context: User context only.  This function may sleep. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * This macro copies a single simple value from kernel space to user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * space.  It supports simple types like char and int, but not larger 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * data types like structures or arrays. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @ptr must have pointer-to-simple-variable type, and @x must be assignable 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * to the result of dereferencing @ptr. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Caller must check the pointer with access_ok() before calling this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * function. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Returns zero on success, or -EFAULT on error. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define __put_user(x,ptr) \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	__put_user_nocheck((x),(ptr),sizeof(*(ptr))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * __get_user: - Get a simple variable from user space, with less checking. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @x:   Variable to store result. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @ptr: Source address, in user space. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Context: User context only.  This function may sleep. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * This macro copies a single simple variable from user space to kernel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * space.  It supports simple types like char and int, but not larger 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * data types like structures or arrays. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @ptr must have pointer-to-simple-variable type, and the result of 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * dereferencing @ptr must be assignable to @x without a cast. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Caller must check the pointer with access_ok() before calling this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * function. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Returns zero on success, or -EFAULT on error. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * On error, the variable @x is set to zero. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define __get_user(x,ptr) \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	__get_user_nocheck((x),(ptr),sizeof(*(ptr))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+extern int __get_user_bad(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+extern int __put_user_bad(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define __get_user_nocheck(x, ptr, size)				\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+({									\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	unsigned long __gu_val = 0;					\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	int __gu_err = 0;						\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+									\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	switch (size) {							\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break;	\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break;	\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break;	\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	default: __gu_err = __get_user_bad(); break;			\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}								\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+									\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	x = (typeof(*(ptr)))__gu_val;					\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	__gu_err;							\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define __get_user_check(x, ptr, size)					\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+({									\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	unsigned long __gu_val = 0;					\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	const typeof(*(ptr)) __user * __gu_addr = (ptr);		\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	int __gu_err = 0;						\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+									\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if (access_ok(VERIFY_READ, __gu_addr, size)) {			\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		switch (size) {						\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		case 1:							\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			__get_user_asm("ub", __gu_val, __gu_addr,	\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				       __gu_err);			\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			break;						\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		case 2:							\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			__get_user_asm("uh", __gu_val, __gu_addr,	\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				       __gu_err);			\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			break;						\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		case 4:							\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			__get_user_asm("w", __gu_val, __gu_addr,	\ 
			 |