1 /* Copyright 2002 Andi Kleen, SuSE Labs.
2 * Subject to the GNU Public License v2.
4 * Functions to copy from and to user space.
7 #include <asm/current.h>
8 #include <asm/asm-offsets.h>
9 #include <asm/thread_info.h>
11 /* Standard copy_to_user with segment limit checking */
19 cmpq threadinfo_addr_limit(%rax),%rcx
23 /* Standard copy_from_user with segment limit checking */
31 cmpq threadinfo_addr_limit(%rax),%rcx
33 /* FALL THROUGH to copy_user_generic */
49 * copy_user_generic - memory copy with exception handling.
56 * Only 4GB of copy is supported. This shouldn't be a problem
57 * because the kernel normally only writes from/to page sized chunks
58 * even if user space passed a longer buffer.
59 * And more would be dangerous because both Intel and AMD have
60 * errata with rep movsq > 4GB. If someone feels the need to fix
61 * this please consider this.
64 * eax uncopied bytes or 0 if successful.
67 .globl copy_user_generic
86 3: lea (%rdx,%rcx,8),%rax
92 .section __ex_table,"a"