Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2012 ARM Ltd.
0004  */
0005 
0006 #include <linux/linkage.h>
0007 #include <linux/const.h>
0008 #include <asm/assembler.h>
0009 #include <asm/page.h>
0010 
0011 /*
0012  * Clear page @dest
0013  *
0014  * Parameters:
0015  *  x0 - dest
0016  */
0017 SYM_FUNC_START(__pi_clear_page)
0018     mrs x1, dczid_el0
0019     tbnz    x1, #4, 2f  /* Branch if DC ZVA is prohibited */
0020     and w1, w1, #0xf
0021     mov x2, #4
0022     lsl x1, x2, x1
0023 
0024 1:  dc  zva, x0
0025     add x0, x0, x1
0026     tst x0, #(PAGE_SIZE - 1)
0027     b.ne    1b
0028     ret
0029 
0030 2:  stnp    xzr, xzr, [x0]
0031     stnp    xzr, xzr, [x0, #16]
0032     stnp    xzr, xzr, [x0, #32]
0033     stnp    xzr, xzr, [x0, #48]
0034     add x0, x0, #64
0035     tst x0, #(PAGE_SIZE - 1)
0036     b.ne    2b
0037     ret
0038 SYM_FUNC_END(__pi_clear_page)
0039 SYM_FUNC_ALIAS(clear_page, __pi_clear_page)
0040 EXPORT_SYMBOL(clear_page)