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 USER(9998f, ldrb \ptr, [\regB], \val)
41 .macro strb1 ptr, regB, val
42 USER(9998f, strb \ptr, [\regB], \val)
45 .macro ldrh1 ptr, regB, val
46 USER(9998f, ldrh \ptr, [\regB], \val)
49 .macro strh1 ptr, regB, val
50 USER(9998f, strh \ptr, [\regB], \val)
53 .macro ldr1 ptr, regB, val
54 USER(9998f, ldr \ptr, [\regB], \val)
57 .macro str1 ptr, regB, val
58 USER(9998f, str \ptr, [\regB], \val)
61 .macro ldp1 ptr, regB, regC, val
62 USER(9998f, ldp \ptr, \regB, [\regC], \val)
65 .macro stp1 ptr, regB, regC, val
66 USER(9998f, stp \ptr, \regB, [\regC], \val)
71 ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(0)), ARM64_HAS_PAN, \
74 #include "copy_template.S"
75 ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_HAS_PAN, \
79 ENDPROC(__copy_in_user)
83 9998: sub x0, end, dst // bytes not copied