1 /* Copyright 2002 Andi Kleen */
3 #include <linux/linkage.h>
5 #include <asm/cpufeature.h>
6 #include <asm/dwarf2.h>
9 * memcpy - Copy a memory block.
17 * rax original destination
21 * memcpy_c() - fast string ops (REP MOVSQ) based variant.
23 * This gets patched over the unrolled variant (below) via the
24 * alternative instructions framework:
26 .section .altinstr_replacement, "ax", @progbits
45 * Put the number of full 64-byte blocks into %ecx.
46 * Tail portion is handled at the end:
56 * We decrement the loop index here - and the zero-flag is
57 * checked at the end of the loop (instructions inbetween do
58 * not change the zero flag):
63 * Move in blocks of 4x16 bytes:
126 * Some CPUs run faster using the string copy instructions.
127 * It is also a lot simpler. Use this when possible:
130 .section .altinstructions, "a"
134 .byte X86_FEATURE_REP_GOOD
137 * Replace only beginning, memcpy is used to apply alternatives,
138 * so it is silly to overwrite itself with nops - reboot is the
141 .byte .Lmemcpy_e - .Lmemcpy_c
142 .byte .Lmemcpy_e - .Lmemcpy_c