1 /* Written 2003 by Andi Kleen, based on a kernel by Evandro Menezes */
3 #include <linux/linkage.h>
4 #include <asm/dwarf2.h>
5 #include <asm/alternative-asm.h>
14 ENDPROC(copy_page_rep)
17 * Don't use streaming copy unless the CPU indicates X86_FEATURE_REP_GOOD.
18 * Could vary the prefetch distance based on SMP/UP.
24 CFI_ADJUST_CFA_OFFSET 2*8
28 CFI_REL_OFFSET r12, 1*8
30 movl $(4096/64)-5, %ecx
34 movq 0x8*0(%rsi), %rax
35 movq 0x8*1(%rsi), %rbx
36 movq 0x8*2(%rsi), %rdx
39 movq 0x8*5(%rsi), %r10
40 movq 0x8*6(%rsi), %r11
41 movq 0x8*7(%rsi), %r12
45 movq %rax, 0x8*0(%rdi)
46 movq %rbx, 0x8*1(%rdi)
47 movq %rdx, 0x8*2(%rdi)
50 movq %r10, 0x8*5(%rdi)
51 movq %r11, 0x8*6(%rdi)
52 movq %r12, 0x8*7(%rdi)
64 movq 0x8*0(%rsi), %rax
65 movq 0x8*1(%rsi), %rbx
66 movq 0x8*2(%rsi), %rdx
69 movq 0x8*5(%rsi), %r10
70 movq 0x8*6(%rsi), %r11
71 movq 0x8*7(%rsi), %r12
73 movq %rax, 0x8*0(%rdi)
74 movq %rbx, 0x8*1(%rdi)
75 movq %rdx, 0x8*2(%rdi)
78 movq %r10, 0x8*5(%rdi)
79 movq %r11, 0x8*6(%rdi)
80 movq %r12, 0x8*7(%rdi)
91 CFI_ADJUST_CFA_OFFSET -2*8
97 /* Some CPUs run faster using the string copy instructions.
98 It is also a lot simpler. Use this when possible */
100 #include <asm/cpufeature.h>
102 .section .altinstr_replacement,"ax"
103 1: .byte 0xeb /* jmp <disp8> */
104 .byte (copy_page_rep - copy_page) - (2f - 1b) /* offset */
107 .section .altinstructions,"a"
108 altinstruction_entry copy_page, 1b, X86_FEATURE_REP_GOOD, \
109 .Lcopy_page_end-copy_page, 2b-1b