1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Written 2003 by Andi Kleen, based on a kernel by Evandro Menezes */
4 #include <linux/linkage.h>
5 #include <asm/cpufeatures.h>
6 #include <asm/alternative-asm.h>
7 #include <asm/export.h>
10 * Some CPUs run faster using the string copy instructions (sane microcode).
11 * It is also a lot simpler. Use this when possible. But, don't use streaming
12 * copy unless the CPU indicates X86_FEATURE_REP_GOOD. Could vary the
13 * prefetch distance based on SMP/UP.
17 ALTERNATIVE "jmp copy_page_regs", "", X86_FEATURE_REP_GOOD
22 EXPORT_SYMBOL(copy_page)
29 movl $(4096/64)-5, %ecx
33 movq 0x8*0(%rsi), %rax
34 movq 0x8*1(%rsi), %rbx
35 movq 0x8*2(%rsi), %rdx
38 movq 0x8*5(%rsi), %r10
39 movq 0x8*6(%rsi), %r11
40 movq 0x8*7(%rsi), %r12
44 movq %rax, 0x8*0(%rdi)
45 movq %rbx, 0x8*1(%rdi)
46 movq %rdx, 0x8*2(%rdi)
49 movq %r10, 0x8*5(%rdi)
50 movq %r11, 0x8*6(%rdi)
51 movq %r12, 0x8*7(%rdi)
63 movq 0x8*0(%rsi), %rax
64 movq 0x8*1(%rsi), %rbx
65 movq 0x8*2(%rsi), %rdx
68 movq 0x8*5(%rsi), %r10
69 movq 0x8*6(%rsi), %r11
70 movq 0x8*7(%rsi), %r12
72 movq %rax, 0x8*0(%rdi)
73 movq %rbx, 0x8*1(%rdi)
74 movq %rdx, 0x8*2(%rdi)
77 movq %r10, 0x8*5(%rdi)
78 movq %r11, 0x8*6(%rdi)
79 movq %r12, 0x8*7(%rdi)
89 ENDPROC(copy_page_regs)