diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:17:08 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:17:08 -0400 |
commit | 185f3d38900f750a4566f87cde6a178f3595a115 (patch) | |
tree | d463f6da1af452b1bbdf476828ea88427087f255 /arch/x86/lib/clear_page_64.S | |
parent | 51b2833060f26258ea2da091c7b9c6a358ac9dd2 (diff) |
x86_64: move lib
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/lib/clear_page_64.S')
-rw-r--r-- | arch/x86/lib/clear_page_64.S | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/x86/lib/clear_page_64.S b/arch/x86/lib/clear_page_64.S new file mode 100644 index 000000000000..9a10a78bb4a4 --- /dev/null +++ b/arch/x86/lib/clear_page_64.S | |||
@@ -0,0 +1,59 @@ | |||
1 | #include <linux/linkage.h> | ||
2 | #include <asm/dwarf2.h> | ||
3 | |||
4 | /* | ||
5 | * Zero a page. | ||
6 | * rdi page | ||
7 | */ | ||
8 | ALIGN | ||
9 | clear_page_c: | ||
10 | CFI_STARTPROC | ||
11 | movl $4096/8,%ecx | ||
12 | xorl %eax,%eax | ||
13 | rep stosq | ||
14 | ret | ||
15 | CFI_ENDPROC | ||
16 | ENDPROC(clear_page) | ||
17 | |||
18 | ENTRY(clear_page) | ||
19 | CFI_STARTPROC | ||
20 | xorl %eax,%eax | ||
21 | movl $4096/64,%ecx | ||
22 | .p2align 4 | ||
23 | .Lloop: | ||
24 | decl %ecx | ||
25 | #define PUT(x) movq %rax,x*8(%rdi) | ||
26 | movq %rax,(%rdi) | ||
27 | PUT(1) | ||
28 | PUT(2) | ||
29 | PUT(3) | ||
30 | PUT(4) | ||
31 | PUT(5) | ||
32 | PUT(6) | ||
33 | PUT(7) | ||
34 | leaq 64(%rdi),%rdi | ||
35 | jnz .Lloop | ||
36 | nop | ||
37 | ret | ||
38 | CFI_ENDPROC | ||
39 | .Lclear_page_end: | ||
40 | ENDPROC(clear_page) | ||
41 | |||
42 | /* Some CPUs run faster using the string instructions. | ||
43 | It is also a lot simpler. Use this when possible */ | ||
44 | |||
45 | #include <asm/cpufeature.h> | ||
46 | |||
47 | .section .altinstr_replacement,"ax" | ||
48 | 1: .byte 0xeb /* jmp <disp8> */ | ||
49 | .byte (clear_page_c - clear_page) - (2f - 1b) /* offset */ | ||
50 | 2: | ||
51 | .previous | ||
52 | .section .altinstructions,"a" | ||
53 | .align 8 | ||
54 | .quad clear_page | ||
55 | .quad 1b | ||
56 | .byte X86_FEATURE_REP_GOOD | ||
57 | .byte .Lclear_page_end - clear_page | ||
58 | .byte 2b - 1b | ||
59 | .previous | ||