18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci// Copyright (C) 2005-2017 Andes Technology Corporation
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#include <linux/linkage.h>
58c2ecf20Sopenharmony_ci#include <asm/assembler.h>
68c2ecf20Sopenharmony_ci#include <asm/errno.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci.macro 	lbi1 dst, addr, adj
98c2ecf20Sopenharmony_ciUSER( lbi.bi, \dst, [\addr], \adj)
108c2ecf20Sopenharmony_ci.endm
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci.macro 	sbi1 src, addr, adj
138c2ecf20Sopenharmony_cisbi.bi	\src, [\addr], \adj
148c2ecf20Sopenharmony_ci.endm
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci.macro	lmw1 start_reg, addr, end_reg
178c2ecf20Sopenharmony_ciUSER( lmw.bim, \start_reg, [\addr], \end_reg)
188c2ecf20Sopenharmony_ci.endm
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci.macro	smw1 start_reg, addr, end_reg
218c2ecf20Sopenharmony_cismw.bim \start_reg, [\addr], \end_reg
228c2ecf20Sopenharmony_ci.endm
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Prototype: int __arch_copy_from_user(void *to, const char *from, size_t n)
268c2ecf20Sopenharmony_ci * Purpose  : copy a block from user memory to kernel memory
278c2ecf20Sopenharmony_ci * Params   : to   - kernel memory
288c2ecf20Sopenharmony_ci *          : from - user memory
298c2ecf20Sopenharmony_ci *          : n    - number of bytes to copy
308c2ecf20Sopenharmony_ci * Returns  : Number of bytes NOT copied.
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci.text
348c2ecf20Sopenharmony_ciENTRY(__arch_copy_from_user)
358c2ecf20Sopenharmony_ci	add	$r5, $r0, $r2
368c2ecf20Sopenharmony_ci#include "copy_template.S"
378c2ecf20Sopenharmony_ci	move	$r0, $r2
388c2ecf20Sopenharmony_ci	ret
398c2ecf20Sopenharmony_ci.section .fixup,"ax"
408c2ecf20Sopenharmony_ci.align  2
418c2ecf20Sopenharmony_ci9001:
428c2ecf20Sopenharmony_ci	sub	$r0, $r5, $r0
438c2ecf20Sopenharmony_ci	ret
448c2ecf20Sopenharmony_ci.previous
458c2ecf20Sopenharmony_ciENDPROC(__arch_copy_from_user)
46