1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Copyright (C) IBM Corporation, 2012
9 #include <linux/export.h>
10 #include <asm/ppc_asm.h>
11 #include <asm/linkage.h>
12 #include <asm/asm-offsets.h>
15 * __arch_clear_user: - Zero a block of memory in user space, with less checking.
16 * @to: Destination address, in user space.
17 * @n: Number of bytes to zero.
19 * Zero a block of memory in user space. Caller must check
20 * the specified block with access_ok() before calling this function.
22 * Returns number of bytes that could not be cleared.
23 * On success, this will be zero.
28 EX_TABLE(100b,.Ldo_err1)
33 EX_TABLE(200b,.Ldo_err2)
38 EX_TABLE(300b,.Ldo_err3)
56 _GLOBAL_TOC(__arch_clear_user)
65 /* Get the destination 8 byte aligned */
89 /* Do 32 byte chunks */
100 /* up to 31 bytes to go */
108 /* Up to 15 bytes to go */
131 LOAD_REG_ADDR(r5, ppc64_caches)
138 /* Destination is 16 byte aligned, need to get it cache block aligned */
139 11: lwz r7,DCACHEL1LOGBLOCKSIZE(r5)
140 lwz r9,DCACHEL1BLOCKSIZE(r5)
143 * With worst case alignment the long clear loop takes a minimum
144 * of 1 byte less than 2 cachelines.
179 EXPORT_SYMBOL(__arch_clear_user)