1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Copyright (C) IBM Corporation, 2012
6 * Author: Anton Blanchard <anton@au.ibm.com>
9 #include <asm/ppc_asm.h>
10 #include <asm/linkage.h>
11 #include <asm/asm-offsets.h>
12 #include <asm/export.h>
16 .tc ppc64_caches[TC],ppc64_caches
20 * __arch_clear_user: - Zero a block of memory in user space, with less checking.
21 * @to: Destination address, in user space.
22 * @n: Number of bytes to zero.
24 * Zero a block of memory in user space. Caller must check
25 * the specified block with access_ok() before calling this function.
27 * Returns number of bytes that could not be cleared.
28 * On success, this will be zero.
33 EX_TABLE(100b,.Ldo_err1)
38 EX_TABLE(200b,.Ldo_err2)
43 EX_TABLE(300b,.Ldo_err3)
61 _GLOBAL_TOC(__arch_clear_user)
70 /* Get the destination 8 byte aligned */
94 /* Do 32 byte chunks */
105 /* up to 31 bytes to go */
113 /* Up to 15 bytes to go */
136 ld r5,PPC64_CACHES@toc(r2)
143 /* Destination is 16 byte aligned, need to get it cache block aligned */
144 11: lwz r7,DCACHEL1LOGBLOCKSIZE(r5)
145 lwz r9,DCACHEL1BLOCKSIZE(r5)
148 * With worst case alignment the long clear loop takes a minimum
149 * of 1 byte less than 2 cachelines.
184 EXPORT_SYMBOL(__arch_clear_user)