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