forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/arm64/lib/clear_page.S
....@@ -1,17 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2012 ARM Ltd.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 as
6
- * published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- *
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
154 */
165
176 #include <linux/linkage.h>
....@@ -25,8 +14,9 @@
2514 * Parameters:
2615 * x0 - dest
2716 */
28
-ENTRY(clear_page)
17
+SYM_FUNC_START_PI(clear_page)
2918 mrs x1, dczid_el0
19
+ tbnz x1, #4, 2f /* Branch if DC ZVA is prohibited */
3020 and w1, w1, #0xf
3121 mov x2, #4
3222 lsl x1, x2, x1
....@@ -36,4 +26,14 @@
3626 tst x0, #(PAGE_SIZE - 1)
3727 b.ne 1b
3828 ret
39
-ENDPROC(clear_page)
29
+
30
+2: stnp xzr, xzr, [x0]
31
+ stnp xzr, xzr, [x0, #16]
32
+ stnp xzr, xzr, [x0, #32]
33
+ stnp xzr, xzr, [x0, #48]
34
+ add x0, x0, #64
35
+ tst x0, #(PAGE_SIZE - 1)
36
+ b.ne 2b
37
+ ret
38
+SYM_FUNC_END_PI(clear_page)
39
+EXPORT_SYMBOL(clear_page)