2 * Copy to/from userspace with optional address space checking.
4 * Copyright 2004-2006 Atmel Corporation
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <asm/thread_info.h>
16 * __copy_user(void *to, const void *from, __kernel_size_t n)
18 * Returns the number of bytes not copied. Might be off by
19 * max 3 bytes if we get a fault in the main loop.
21 * The address-space checking functions simply fall through to
22 * the non-checking version.
26 .global copy_from_user
27 .type copy_from_user, @function
29 branch_if_kernel r8, __copy_user
30 ret_if_privileged r8, r11, r10, r10
32 .size copy_from_user, . - copy_from_user
35 .type copy_to_user, @function
37 branch_if_kernel r8, __copy_user
38 ret_if_privileged r8, r12, r10, r10
39 .size copy_to_user, . - copy_to_user
42 .type __copy_user, @function
48 /* At this point, from is word-aligned */
62 * Handle unaligned count. Need to be careful with r10 here so
63 * that we return the correct value even if we get a fault
78 /* Handle unaligned from-pointer */
97 .size __copy_user, . - __copy_user
104 .section __ex_table,"a"