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>
26 .tc ppc64_caches[TC],ppc64_caches
30 * __clear_user: - Zero a block of memory in user space, with less checking.
31 * @to: Destination address, in user space.
32 * @n: Number of bytes to zero.
34 * Zero a block of memory in user space. Caller must check
35 * the specified block with access_ok() before calling this function.
37 * Returns number of bytes that could not be cleared.
38 * On success, this will be zero.
43 .section __ex_table,"a"
51 .section __ex_table,"a"
59 .section __ex_table,"a"
80 _GLOBAL_TOC(__clear_user)
89 /* Get the destination 8 byte aligned */
113 /* Do 32 byte chunks */
124 /* up to 31 bytes to go */
132 /* Up to 15 bytes to go */
155 ld r5,PPC64_CACHES@toc(r2)
162 /* Destination is 16 byte aligned, need to get it cacheline aligned */
163 11: lwz r7,DCACHEL1LOGLINESIZE(r5)
164 lwz r9,DCACHEL1LINESIZE(r5)
167 * With worst case alignment the long clear loop takes a minimum
168 * of 1 byte less than 2 cachelines.