2 * Copyright 2008 Vitaly Mayatskikh <vmayatsk@redhat.com>
3 * Copyright 2002 Andi Kleen, SuSE Labs.
4 * Subject to the GNU Public License v2.
6 * Functions to copy from and to user space.
9 #include <linux/linkage.h>
10 #include <asm/dwarf2.h>
12 #define FIX_ALIGNMENT 1
14 #include <asm/current.h>
15 #include <asm/asm-offsets.h>
16 #include <asm/thread_info.h>
19 .macro ALIGN_DESTINATION
21 /* check for bad alignment of destination */
24 jz 102f /* already aligned */
36 103: addl %ecx,%edx /* ecx is zerorest also */
37 jmp copy_user_handle_tail
40 _ASM_EXTABLE(100b,103b)
41 _ASM_EXTABLE(101b,103b)
46 * copy_user_nocache - Uncached memory copy with exception handling
47 * This will force destination/source out of cache for more performance.
49 ENTRY(__copy_user_nocache)
52 jb 20f /* less then 8 bytes, go to byte copy loop */
60 3: movq 2*8(%rsi),%r10
61 4: movq 3*8(%rsi),%r11
63 6: movnti %r9,1*8(%rdi)
64 7: movnti %r10,2*8(%rdi)
65 8: movnti %r11,3*8(%rdi)
67 10: movq 5*8(%rsi),%r9
68 11: movq 6*8(%rsi),%r10
69 12: movq 7*8(%rsi),%r11
70 13: movnti %r8,4*8(%rdi)
71 14: movnti %r9,5*8(%rdi)
72 15: movnti %r10,6*8(%rdi)
73 16: movnti %r11,7*8(%rdi)
105 40: lea (%rdx,%rcx,8),%rdx
109 jmp copy_user_handle_tail
121 _ASM_EXTABLE(10b,30b)
122 _ASM_EXTABLE(11b,30b)
123 _ASM_EXTABLE(12b,30b)
124 _ASM_EXTABLE(13b,30b)
125 _ASM_EXTABLE(14b,30b)
126 _ASM_EXTABLE(15b,30b)
127 _ASM_EXTABLE(16b,30b)
128 _ASM_EXTABLE(18b,40b)
129 _ASM_EXTABLE(19b,40b)
130 _ASM_EXTABLE(21b,50b)
131 _ASM_EXTABLE(22b,50b)
133 ENDPROC(__copy_user_nocache)