blob: ad1857b20067a84e3cc15dd897b0da80db7d065f [file] [log] [blame]
Greentime Huace02e22017-10-25 14:27:22 +08001// 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
9USER( lbi.bi, \dst, [\addr], \adj)
10.endm
11
12.macro sbi1 src, addr, adj
13sbi.bi \src, [\addr], \adj
14.endm
15
16.macro lmw1 start_reg, addr, end_reg
17USER( lmw.bim, \start_reg, [\addr], \end_reg)
18.endm
19
20.macro smw1 start_reg, addr, end_reg
21smw.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
34ENTRY(__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
419001:
42 sub $r0, $r5, $r0
43 ret
44.previous
45ENDPROC(__arch_copy_from_user)