1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/unicore32/lib/copy_to_user.S
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Copyright (C) 2001-2010 GUAN Xue-tao
10 #include <linux/linkage.h>
11 #include <asm/assembler.h>
16 * size_t raw_copy_to_user(void *to, const void *from, size_t n)
20 * copy a block to user memory from kernel memory
25 * from = kernel memory
26 * n = number of bytes to copy
30 * Number of bytes NOT copied.
33 .macro ldr1w ptr reg abort
34 ldw.w \reg, [\ptr]+, #4
37 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
38 ldm.w (\reg1, \reg2, \reg3, \reg4), [\ptr]+
41 .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
42 ldm.w (\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8), [\ptr]+
45 .macro ldr1b ptr reg cond=al abort
47 ldb.w \reg, [\ptr]+, #1
50 .macro str1w ptr reg abort
51 strusr \reg, \ptr, 4, abort=\abort
54 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
55 100: stm.w (\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8), [\ptr]+
57 .pushsection __ex_table, "a"
62 .macro str1b ptr reg cond=al abort
63 strusr \reg, \ptr, 1, \cond, abort=\abort
68 stm.w (r0, r2, r3), [sp-]
79 WEAK(raw_copy_to_user)
81 #include "copy_template.S"
83 ENDPROC(raw_copy_to_user)
85 .pushsection .fixup,"ax"
88 ldm.w (r1, r2, r3), [sp]+