Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 #include <linux/linkage.h>
0003 #include <asm/export.h>
0004 
0005 /*
0006  * Most CPUs support enhanced REP MOVSB/STOSB instructions. It is
0007  * recommended to use this when possible and we do use them by default.
0008  * If enhanced REP MOVSB/STOSB is not available, try to use fast string.
0009  * Otherwise, use original.
0010  */
0011 
0012 /*
0013  * Zero a page.
0014  * %rdi - page
0015  */
0016 SYM_FUNC_START(clear_page_rep)
0017     movl $4096/8,%ecx
0018     xorl %eax,%eax
0019     rep stosq
0020     RET
0021 SYM_FUNC_END(clear_page_rep)
0022 EXPORT_SYMBOL_GPL(clear_page_rep)
0023 
0024 SYM_FUNC_START(clear_page_orig)
0025     xorl   %eax,%eax
0026     movl   $4096/64,%ecx
0027     .p2align 4
0028 .Lloop:
0029     decl    %ecx
0030 #define PUT(x) movq %rax,x*8(%rdi)
0031     movq %rax,(%rdi)
0032     PUT(1)
0033     PUT(2)
0034     PUT(3)
0035     PUT(4)
0036     PUT(5)
0037     PUT(6)
0038     PUT(7)
0039     leaq    64(%rdi),%rdi
0040     jnz .Lloop
0041     nop
0042     RET
0043 SYM_FUNC_END(clear_page_orig)
0044 EXPORT_SYMBOL_GPL(clear_page_orig)
0045 
0046 SYM_FUNC_START(clear_page_erms)
0047     movl $4096,%ecx
0048     xorl %eax,%eax
0049     rep stosb
0050     RET
0051 SYM_FUNC_END(clear_page_erms)
0052 EXPORT_SYMBOL_GPL(clear_page_erms)