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
9lbi.bi	\dst, [\addr], \adj
10.endm
11
12.macro 	sbi1 src, addr, adj
13USER( sbi.bi, \src, [\addr], \adj)
14.endm
15
16.macro	lmw1 start_reg, addr, end_reg
17lmw.bim \start_reg, [\addr], \end_reg
18.endm
19
20.macro	smw1 start_reg, addr, end_reg
21USER( smw.bim, \start_reg, [\addr], \end_reg)
22.endm
23
24
25/* Prototype: int __arch_copy_to_user(void *to, const char *from, size_t n)
26 * Purpose  : copy a block to user memory from kernel memory
27 * Params   : to   - user memory
28 *          : from - kernel memory
29 *          : n    - number of bytes to copy
30 * Returns  : Number of bytes NOT copied.
31 */
32
33.text
34ENTRY(__arch_copy_to_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_to_user)
46