patch-2.4.25 linux-2.4.25/include/asm-x86_64/uaccess.h

Next file: linux-2.4.25/include/asm-x86_64/unistd.h
Previous file: linux-2.4.25/include/asm-x86_64/desc.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.24/include/asm-x86_64/uaccess.h linux-2.4.25/include/asm-x86_64/uaccess.h
@@ -297,6 +297,46 @@
 	}
 }	
 
+static inline int __copy_in_user(void *dst, const void *src, unsigned size) 
+{ 
+       int ret = 0;
+       if (!__builtin_constant_p(size))
+		return copy_user_generic(dst,src,size);
+       switch (size) { 
+       case 1: { 
+	       u8 tmp;
+	       __get_user_asm(tmp,(u8 *)src,ret,"b","b","=q",1); 
+	       if (likely(!ret))
+		       __put_user_asm(tmp,(u8 *)dst,ret,"b","b","iq",1); 
+	       return ret;
+       }
+       case 2: { 
+	       u16 tmp;
+	       __get_user_asm(tmp,(u16 *)src,ret,"w","w","=r",2); 
+	       if (likely(!ret))
+		       __put_user_asm(tmp,(u16 *)dst,ret,"w","w","ir",2); 
+	       return ret;
+       }
+	       
+       case 4: { 
+	       u32 tmp;
+	       __get_user_asm(tmp,(u32 *)src,ret,"l","k","=r",4); 
+	       if (likely(!ret))
+		       __put_user_asm(tmp,(u32 *)dst,ret,"l","k","ir",4); 
+	       return ret;
+       }
+       case 8: { 
+	       u64 tmp;
+	       __get_user_asm(tmp,(u64 *)src,ret,"q","","=r",8); 
+	       if (likely(!ret))
+		       __put_user_asm(tmp,(u64 *)dst,ret,"q","","ir",8); 
+	       return ret;
+       }
+       default:
+	       return copy_user_generic(dst,src,size); 
+       }
+}	
+
 long strncpy_from_user(char *dst, const char *src, long count);
 long __strncpy_from_user(char *dst, const char *src, long count);
 long strnlen_user(const char *str, long n);

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