Path: blob/master/arch/x86/lib/copy_user_nocache_64.S
10818 views
/*1* Copyright 2008 Vitaly Mayatskikh <[email protected]>2* Copyright 2002 Andi Kleen, SuSE Labs.3* Subject to the GNU Public License v2.4*5* Functions to copy from and to user space.6*/78#include <linux/linkage.h>9#include <asm/dwarf2.h>1011#define FIX_ALIGNMENT 11213#include <asm/current.h>14#include <asm/asm-offsets.h>15#include <asm/thread_info.h>1617.macro ALIGN_DESTINATION18#ifdef FIX_ALIGNMENT19/* check for bad alignment of destination */20movl %edi,%ecx21andl $7,%ecx22jz 102f /* already aligned */23subl $8,%ecx24negl %ecx25subl %ecx,%edx26100: movb (%rsi),%al27101: movb %al,(%rdi)28incq %rsi29incq %rdi30decl %ecx31jnz 100b32102:33.section .fixup,"ax"34103: addl %ecx,%edx /* ecx is zerorest also */35jmp copy_user_handle_tail36.previous3738.section __ex_table,"a"39.align 840.quad 100b,103b41.quad 101b,103b42.previous43#endif44.endm4546/*47* copy_user_nocache - Uncached memory copy with exception handling48* This will force destination/source out of cache for more performance.49*/50ENTRY(__copy_user_nocache)51CFI_STARTPROC52cmpl $8,%edx53jb 20f /* less then 8 bytes, go to byte copy loop */54ALIGN_DESTINATION55movl %edx,%ecx56andl $63,%edx57shrl $6,%ecx58jz 17f591: movq (%rsi),%r8602: movq 1*8(%rsi),%r9613: movq 2*8(%rsi),%r10624: movq 3*8(%rsi),%r11635: movnti %r8,(%rdi)646: movnti %r9,1*8(%rdi)657: movnti %r10,2*8(%rdi)668: movnti %r11,3*8(%rdi)679: movq 4*8(%rsi),%r86810: movq 5*8(%rsi),%r96911: movq 6*8(%rsi),%r107012: movq 7*8(%rsi),%r117113: movnti %r8,4*8(%rdi)7214: movnti %r9,5*8(%rdi)7315: movnti %r10,6*8(%rdi)7416: movnti %r11,7*8(%rdi)75leaq 64(%rsi),%rsi76leaq 64(%rdi),%rdi77decl %ecx78jnz 1b7917: movl %edx,%ecx80andl $7,%edx81shrl $3,%ecx82jz 20f8318: movq (%rsi),%r88419: movnti %r8,(%rdi)85leaq 8(%rsi),%rsi86leaq 8(%rdi),%rdi87decl %ecx88jnz 18b8920: andl %edx,%edx90jz 23f91movl %edx,%ecx9221: movb (%rsi),%al9322: movb %al,(%rdi)94incq %rsi95incq %rdi96decl %ecx97jnz 21b9823: xorl %eax,%eax99sfence100ret101102.section .fixup,"ax"10330: shll $6,%ecx104addl %ecx,%edx105jmp 60f10640: lea (%rdx,%rcx,8),%rdx107jmp 60f10850: movl %ecx,%edx10960: sfence110jmp copy_user_handle_tail111.previous112113.section __ex_table,"a"114.quad 1b,30b115.quad 2b,30b116.quad 3b,30b117.quad 4b,30b118.quad 5b,30b119.quad 6b,30b120.quad 7b,30b121.quad 8b,30b122.quad 9b,30b123.quad 10b,30b124.quad 11b,30b125.quad 12b,30b126.quad 13b,30b127.quad 14b,30b128.quad 15b,30b129.quad 16b,30b130.quad 18b,40b131.quad 19b,40b132.quad 21b,50b133.quad 22b,50b134.previous135CFI_ENDPROC136ENDPROC(__copy_user_nocache)137138139