Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[linux-2.6-microblaze.git] / arch / nds32 / lib / copy_from_user.S
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2005-2017 Andes Technology Corporation
3
4 #include <linux/linkage.h>
5 #include <asm/assembler.h>
6 #include <asm/errno.h>
7
8 .macro  lbi1 dst, addr, adj
9 USER( lbi.bi, \dst, [\addr], \adj)
10 .endm
11
12 .macro  sbi1 src, addr, adj
13 sbi.bi  \src, [\addr], \adj
14 .endm
15
16 .macro  lmw1 start_reg, addr, end_reg
17 USER( lmw.bim, \start_reg, [\addr], \end_reg)
18 .endm
19
20 .macro  smw1 start_reg, addr, end_reg
21 smw.bim \start_reg, [\addr], \end_reg
22 .endm
23
24
25 /* Prototype: int __arch_copy_from_user(void *to, const char *from, size_t n)
26  * Purpose  : copy a block from user memory to kernel memory
27  * Params   : to   - kernel memory
28  *          : from - user memory
29  *          : n    - number of bytes to copy
30  * Returns  : Number of bytes NOT copied.
31  */
32
33 .text
34 ENTRY(__arch_copy_from_user)
35         add     $r5, $r0, $r2
36 #include "copy_template.S"
37         move    $r0, $r2
38         ret
39 .section .fixup,"ax"
40 .align  2
41 9001:
42         sub     $r0, $r5, $r0
43         ret
44 .previous
45 ENDPROC(__arch_copy_from_user)