1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copy from user space to user space
5 * Copyright (C) 2012 ARM Ltd.
8 #include <linux/linkage.h>
10 #include <asm/asm-uaccess.h>
11 #include <asm/assembler.h>
12 #include <asm/cache.h>
15 * Copy from user space to user space (alignment handled by the hardware)
22 * x0 - bytes not copied
24 .macro ldrb1 reg, ptr, val
25 user_ldst 9998f, ldtrb, \reg, \ptr, \val
28 .macro strb1 reg, ptr, val
29 user_ldst 9998f, sttrb, \reg, \ptr, \val
32 .macro ldrh1 reg, ptr, val
33 user_ldst 9997f, ldtrh, \reg, \ptr, \val
36 .macro strh1 reg, ptr, val
37 user_ldst 9997f, sttrh, \reg, \ptr, \val
40 .macro ldr1 reg, ptr, val
41 user_ldst 9997f, ldtr, \reg, \ptr, \val
44 .macro str1 reg, ptr, val
45 user_ldst 9997f, sttr, \reg, \ptr, \val
48 .macro ldp1 reg1, reg2, ptr, val
49 user_ldp 9997f, \reg1, \reg2, \ptr, \val
52 .macro stp1 reg1, reg2, ptr, val
53 user_stp 9997f, \reg1, \reg2, \ptr, \val
58 SYM_FUNC_START(__arch_copy_in_user)
61 #include "copy_template.S"
64 SYM_FUNC_END(__arch_copy_in_user)
65 EXPORT_SYMBOL(__arch_copy_in_user)
71 // Before being absolutely sure we couldn't copy anything, try harder
72 USER(9998f, ldtrb tmp1w, [srcin])
73 USER(9998f, sttrb tmp1w, [dst])
75 9998: sub x0, end, dst // bytes not copied