2 * linux/arch/unicore32/lib/copy_from_user.S
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/linkage.h>
14 #include <asm/assembler.h>
19 * size_t __copy_from_user(void *to, const void *from, size_t n)
23 * copy a block to kernel memory from user memory
29 * n = number of bytes to copy
33 * Number of bytes NOT copied.
36 .macro ldr1w ptr reg abort
37 ldrusr \reg, \ptr, 4, abort=\abort
40 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
41 100: ldm.w (\reg1, \reg2, \reg3, \reg4), [\ptr]+
42 .pushsection __ex_table, "a"
48 .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
49 100: ldm.w (\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8), [\ptr]+
50 .pushsection __ex_table, "a"
56 .macro ldr1b ptr reg cond=al abort
57 ldrusr \reg, \ptr, 1, \cond, abort=\abort
60 .macro str1w ptr reg abort
61 stw.w \reg, [\ptr]+, #4
64 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
65 stm.w (\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8), [\ptr]+
68 .macro str1b ptr reg cond=al abort
73 201: stb.w \reg, [\ptr]+, #1
79 stm.w (r0, r2, r3), [sp-]
90 ENTRY(__copy_from_user)
92 #include "copy_template.S"
94 ENDPROC(__copy_from_user)
96 .pushsection .fixup,"ax"