2 * linux/arch/arm/lib/copy_from_user.S
4 * Author: Nicolas Pitre
5 * Created: Sep 29, 2005
6 * Copyright: MontaVista Software, Inc.
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>
15 #include <asm/unwind.h>
20 * size_t arm_copy_from_user(void *to, const void *from, size_t n)
24 * copy a block to kernel memory from user memory
30 * n = number of bytes to copy
34 * Number of bytes NOT copied.
37 #ifndef CONFIG_THUMB2_KERNEL
44 .macro ldr1w ptr reg abort
45 ldrusr \reg, \ptr, 4, abort=\abort
48 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
49 ldr1w \ptr, \reg1, \abort
50 ldr1w \ptr, \reg2, \abort
51 ldr1w \ptr, \reg3, \abort
52 ldr1w \ptr, \reg4, \abort
55 .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
56 ldr4w \ptr, \reg1, \reg2, \reg3, \reg4, \abort
57 ldr4w \ptr, \reg5, \reg6, \reg7, \reg8, \abort
60 .macro ldr1b ptr reg cond=al abort
61 ldrusr \reg, \ptr, 1, \cond, abort=\abort
64 .macro str1w ptr reg abort
65 W(str) \reg, [\ptr], #4
68 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
69 stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
72 .macro str1b ptr reg cond=al abort
73 str\cond\()b \reg, [\ptr], #1
76 .macro enter reg1 reg2
78 stmdb sp!, {r0, r2, r3, \reg1, \reg2}
81 .macro usave reg1 reg2
82 UNWIND( .save {r0, r2, r3, \reg1, \reg2} )
87 ldmfd sp!, {r0, \reg1, \reg2}
92 ENTRY(arm_copy_from_user)
94 #include "copy_template.S"
96 ENDPROC(arm_copy_from_user)
98 .pushsection .fixup,"ax"