]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/x86/lib/clear_page_64.S
x86/cpufeature: Carve out X86_FEATURE_*
[mirror_ubuntu-artful-kernel.git] / arch / x86 / lib / clear_page_64.S
CommitLineData
8d379dad 1#include <linux/linkage.h>
cd4d09ec 2#include <asm/cpufeatures.h>
e365c9df 3#include <asm/alternative-asm.h>
8d379dad 4
1da177e4 5/*
6620ef28
BP
6 * Most CPUs support enhanced REP MOVSB/STOSB instructions. It is
7 * recommended to use this when possible and we do use them by default.
8 * If enhanced REP MOVSB/STOSB is not available, try to use fast string.
9 * Otherwise, use original.
10 */
11
12/*
13 * Zero a page.
14 * %rdi - page
15 */
16ENTRY(clear_page)
6620ef28
BP
17
18 ALTERNATIVE_2 "jmp clear_page_orig", "", X86_FEATURE_REP_GOOD, \
19 "jmp clear_page_c_e", X86_FEATURE_ERMS
20
8d379dad
JB
21 movl $4096/8,%ecx
22 xorl %eax,%eax
23 rep stosq
24 ret
6620ef28 25ENDPROC(clear_page)
8d379dad 26
6620ef28 27ENTRY(clear_page_orig)
e365c9df 28
7bcd3f34
AK
29 xorl %eax,%eax
30 movl $4096/64,%ecx
31 .p2align 4
32.Lloop:
33 decl %ecx
34#define PUT(x) movq %rax,x*8(%rdi)
35 movq %rax,(%rdi)
36 PUT(1)
37 PUT(2)
38 PUT(3)
39 PUT(4)
40 PUT(5)
41 PUT(6)
42 PUT(7)
43 leaq 64(%rdi),%rdi
44 jnz .Lloop
45 nop
46 ret
6620ef28 47ENDPROC(clear_page_orig)
7bcd3f34 48
6620ef28 49ENTRY(clear_page_c_e)
6620ef28
BP
50 movl $4096,%ecx
51 xorl %eax,%eax
52 rep stosb
53 ret
6620ef28 54ENDPROC(clear_page_c_e)