2 * Copyright (C) 2012 ARM Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include <linux/linkage.h>
19 #include <asm/cache.h>
20 #include <asm/asm-uaccess.h>
23 * Copy to user space from a kernel buffer (alignment handled by the hardware)
30 * x0 - bytes not copied
32 .macro ldrb1 ptr, regB, val
33 ldrb \ptr, [\regB], \val
36 .macro strb1 ptr, regB, val
37 uao_user_alternative 9998f, strb, sttrb, \ptr, \regB, \val
40 .macro ldrh1 ptr, regB, val
41 ldrh \ptr, [\regB], \val
44 .macro strh1 ptr, regB, val
45 uao_user_alternative 9998f, strh, sttrh, \ptr, \regB, \val
48 .macro ldr1 ptr, regB, val
49 ldr \ptr, [\regB], \val
52 .macro str1 ptr, regB, val
53 uao_user_alternative 9998f, str, sttr, \ptr, \regB, \val
56 .macro ldp1 ptr, regB, regC, val
57 ldp \ptr, \regB, [\regC], \val
60 .macro stp1 ptr, regB, regC, val
61 uao_stp 9998f, \ptr, \regB, \regC, \val
65 ENTRY(__arch_copy_to_user)
66 uaccess_enable_not_uao x3, x4, x5
68 #include "copy_template.S"
69 uaccess_disable_not_uao x3, x4
72 ENDPROC(__arch_copy_to_user)
76 9998: sub x0, end, dst // bytes not copied