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/asm-offsets.h>
23 #include <asm/export.h>
27 .tc ppc64_caches[TC],ppc64_caches
31 * __clear_user: - Zero a block of memory in user space, with less checking.
32 * @to: Destination address, in user space.
33 * @n: Number of bytes to zero.
35 * Zero a block of memory in user space. Caller must check
36 * the specified block with access_ok() before calling this function.
38 * Returns number of bytes that could not be cleared.
39 * On success, this will be zero.
44 .section __ex_table,"a"
52 .section __ex_table,"a"
60 .section __ex_table,"a"
81 _GLOBAL_TOC(__clear_user)
90 /* Get the destination 8 byte aligned */
114 /* Do 32 byte chunks */
125 /* up to 31 bytes to go */
133 /* Up to 15 bytes to go */
156 ld r5,PPC64_CACHES@toc(r2)
163 /* Destination is 16 byte aligned, need to get it cacheline aligned */
164 11: lwz r7,DCACHEL1LOGLINESIZE(r5)
165 lwz r9,DCACHEL1LINESIZE(r5)
168 * With worst case alignment the long clear loop takes a minimum
169 * of 1 byte less than 2 cachelines.
204 EXPORT_SYMBOL(__clear_user)