1#include <linux/linkage.h> 2#include <asm/cpufeatures.h> 3#include <asm/alternative-asm.h> 4#include <asm/export.h> 5 6/* 7 * Most CPUs support enhanced REP MOVSB/STOSB instructions. It is 8 * recommended to use this when possible and we do use them by default. 9 * If enhanced REP MOVSB/STOSB is not available, try to use fast string. 10 * Otherwise, use original. 11 */ 12 13/* 14 * Zero a page. 15 * %rdi - page 16 */ 17ENTRY(clear_page_rep) 18 movl $4096/8,%ecx 19 xorl %eax,%eax 20 rep stosq 21 ret 22ENDPROC(clear_page_rep) 23EXPORT_SYMBOL_GPL(clear_page_rep) 24 25ENTRY(clear_page_orig) 26 xorl %eax,%eax 27 movl $4096/64,%ecx 28 .p2align 4 29.Lloop: 30 decl %ecx 31#define PUT(x) movq %rax,x*8(%rdi) 32 movq %rax,(%rdi) 33 PUT(1) 34 PUT(2) 35 PUT(3) 36 PUT(4) 37 PUT(5) 38 PUT(6) 39 PUT(7) 40 leaq 64(%rdi),%rdi 41 jnz .Lloop 42 nop 43 ret 44ENDPROC(clear_page_orig) 45EXPORT_SYMBOL_GPL(clear_page_orig) 46 47ENTRY(clear_page_erms) 48 movl $4096,%ecx 49 xorl %eax,%eax 50 rep stosb 51 ret 52ENDPROC(clear_page_erms) 53EXPORT_SYMBOL_GPL(clear_page_erms) 54