GNU Linux-libre 5.4.274-gnu1
[releases.git] / arch / arm64 / lib / copy_in_user.S
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copy from user space to user space
4  *
5  * Copyright (C) 2012 ARM Ltd.
6  */
7
8 #include <linux/linkage.h>
9
10 #include <asm/asm-uaccess.h>
11 #include <asm/assembler.h>
12 #include <asm/cache.h>
13
14 /*
15  * Copy from user space to user space (alignment handled by the hardware)
16  *
17  * Parameters:
18  *      x0 - to
19  *      x1 - from
20  *      x2 - n
21  * Returns:
22  *      x0 - bytes not copied
23  */
24         .macro ldrb1 ptr, regB, val
25         uao_user_alternative 9998f, ldrb, ldtrb, \ptr, \regB, \val
26         .endm
27
28         .macro strb1 ptr, regB, val
29         uao_user_alternative 9998f, strb, sttrb, \ptr, \regB, \val
30         .endm
31
32         .macro ldrh1 ptr, regB, val
33         uao_user_alternative 9998f, ldrh, ldtrh, \ptr, \regB, \val
34         .endm
35
36         .macro strh1 ptr, regB, val
37         uao_user_alternative 9998f, strh, sttrh, \ptr, \regB, \val
38         .endm
39
40         .macro ldr1 ptr, regB, val
41         uao_user_alternative 9998f, ldr, ldtr, \ptr, \regB, \val
42         .endm
43
44         .macro str1 ptr, regB, val
45         uao_user_alternative 9998f, str, sttr, \ptr, \regB, \val
46         .endm
47
48         .macro ldp1 ptr, regB, regC, val
49         uao_ldp 9998f, \ptr, \regB, \regC, \val
50         .endm
51
52         .macro stp1 ptr, regB, regC, val
53         uao_stp 9998f, \ptr, \regB, \regC, \val
54         .endm
55
56 end     .req    x5
57
58 SYM_FUNC_START(__arch_copy_in_user)
59         add     end, x0, x2
60 #include "copy_template.S"
61         mov     x0, #0
62         ret
63 SYM_FUNC_END(__arch_copy_in_user)
64 EXPORT_SYMBOL(__arch_copy_in_user)
65
66         .section .fixup,"ax"
67         .align  2
68 9998:   sub     x0, end, dst                    // bytes not copied
69         ret
70         .previous