2 * Copy from user space to user space
4 * Copyright (C) 2012 ARM Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include <linux/linkage.h>
21 #include <asm/alternative.h>
22 #include <asm/assembler.h>
23 #include <asm/cache.h>
24 #include <asm/cpufeature.h>
25 #include <asm/sysreg.h>
28 * Copy from user space to user space (alignment handled by the hardware)
35 * x0 - bytes not copied
37 .macro ldrb1 ptr, regB, val
38 uao_user_alternative 9998f, ldrb, ldtrb, \ptr, \regB, \val
41 .macro strb1 ptr, regB, val
42 uao_user_alternative 9998f, strb, sttrb, \ptr, \regB, \val
45 .macro ldrh1 ptr, regB, val
46 uao_user_alternative 9998f, ldrh, ldtrh, \ptr, \regB, \val
49 .macro strh1 ptr, regB, val
50 uao_user_alternative 9998f, strh, sttrh, \ptr, \regB, \val
53 .macro ldr1 ptr, regB, val
54 uao_user_alternative 9998f, ldr, ldtr, \ptr, \regB, \val
57 .macro str1 ptr, regB, val
58 uao_user_alternative 9998f, str, sttr, \ptr, \regB, \val
61 .macro ldp1 ptr, regB, regC, val
62 uao_ldp 9998f, \ptr, \regB, \regC, \val
65 .macro stp1 ptr, regB, regC, val
66 uao_stp 9998f, \ptr, \regB, \regC, \val
71 ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(0)), ARM64_ALT_PAN_NOT_UAO, \
74 #include "copy_template.S"
75 ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \
79 ENDPROC(__copy_in_user)
83 9998: sub x0, end, dst // bytes not copied