xref: /openbmc/linux/arch/x86/lib/clear_page_64.S (revision f79e4d5f)
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 */
15ENTRY(clear_page_rep)
16	movl $4096/8,%ecx
17	xorl %eax,%eax
18	rep stosq
19	ret
20ENDPROC(clear_page_rep)
21EXPORT_SYMBOL_GPL(clear_page_rep)
22
23ENTRY(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
42ENDPROC(clear_page_orig)
43EXPORT_SYMBOL_GPL(clear_page_orig)
44
45ENTRY(clear_page_erms)
46	movl $4096,%ecx
47	xorl %eax,%eax
48	rep stosb
49	ret
50ENDPROC(clear_page_erms)
51EXPORT_SYMBOL_GPL(clear_page_erms)
52