1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2012 ARM Ltd.
6 #include <linux/linkage.h>
8 #include <asm/asm-uaccess.h>
9 #include <asm/assembler.h>
10 #include <asm/cache.h>
13 * Copy from user space to a kernel buffer (alignment handled by the hardware)
20 * x0 - bytes not copied
23 .macro ldrb1 reg, ptr, val
24 user_ldst 9998f, ldtrb, \reg, \ptr, \val
27 .macro strb1 reg, ptr, val
28 strb \reg, [\ptr], \val
31 .macro ldrh1 reg, ptr, val
32 user_ldst 9998f, ldtrh, \reg, \ptr, \val
35 .macro strh1 reg, ptr, val
36 strh \reg, [\ptr], \val
39 .macro ldr1 reg, ptr, val
40 user_ldst 9998f, ldtr, \reg, \ptr, \val
43 .macro str1 reg, ptr, val
44 str \reg, [\ptr], \val
47 .macro ldp1 reg1, reg2, ptr, val
48 user_ldp 9998f, \reg1, \reg2, \ptr, \val
51 .macro stp1 reg1, reg2, ptr, val
52 stp \reg1, \reg2, [\ptr], \val
56 SYM_FUNC_START(__arch_copy_from_user)
58 #include "copy_template.S"
59 mov x0, #0 // Nothing to copy
61 SYM_FUNC_END(__arch_copy_from_user)
62 EXPORT_SYMBOL(__arch_copy_from_user)
66 9998: sub x0, end, dst // bytes not copied