2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright (C) IBM Corporation, 2012
18 * Author: Anton Blanchard <anton@au.ibm.com>
21 #include <asm/ppc_asm.h>
22 #include <asm/linkage.h>
23 #include <asm/asm-offsets.h>
24 #include <asm/export.h>
28 .tc ppc64_caches[TC],ppc64_caches
32 * __clear_user: - Zero a block of memory in user space, with less checking.
33 * @to: Destination address, in user space.
34 * @n: Number of bytes to zero.
36 * Zero a block of memory in user space. Caller must check
37 * the specified block with access_ok() before calling this function.
39 * Returns number of bytes that could not be cleared.
40 * On success, this will be zero.
45 EX_TABLE(100b,.Ldo_err1)
50 EX_TABLE(200b,.Ldo_err2)
55 EX_TABLE(300b,.Ldo_err3)
73 _GLOBAL_TOC(__clear_user)
82 /* Get the destination 8 byte aligned */
106 /* Do 32 byte chunks */
117 /* up to 31 bytes to go */
125 /* Up to 15 bytes to go */
148 ld r5,PPC64_CACHES@toc(r2)
155 /* Destination is 16 byte aligned, need to get it cache block aligned */
156 11: lwz r7,DCACHEL1LOGBLOCKSIZE(r5)
157 lwz r9,DCACHEL1BLOCKSIZE(r5)
160 * With worst case alignment the long clear loop takes a minimum
161 * of 1 byte less than 2 cachelines.
196 EXPORT_SYMBOL(__clear_user)