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 to user space from a kernel buffer (alignment handled by the hardware)
20 * x0 - bytes not copied
22 .macro ldrb1 ptr, regB, val
23 ldrb \ptr, [\regB], \val
26 .macro strb1 ptr, regB, val
27 uao_user_alternative 9998f, strb, sttrb, \ptr, \regB, \val
30 .macro ldrh1 ptr, regB, val
31 ldrh \ptr, [\regB], \val
34 .macro strh1 ptr, regB, val
35 uao_user_alternative 9998f, strh, sttrh, \ptr, \regB, \val
38 .macro ldr1 ptr, regB, val
39 ldr \ptr, [\regB], \val
42 .macro str1 ptr, regB, val
43 uao_user_alternative 9998f, str, sttr, \ptr, \regB, \val
46 .macro ldp1 ptr, regB, regC, val
47 ldp \ptr, \regB, [\regC], \val
50 .macro stp1 ptr, regB, regC, val
51 uao_stp 9998f, \ptr, \regB, \regC, \val
55 ENTRY(__arch_copy_to_user)
56 uaccess_enable_not_uao x3, x4, x5
58 #include "copy_template.S"
59 uaccess_disable_not_uao x3, x4
62 ENDPROC(__arch_copy_to_user)
63 EXPORT_SYMBOL(__arch_copy_to_user)
67 9998: sub x0, end, dst // bytes not copied