blob: a9b9e2287a096af7ce249d2d0d9f7a6589ebd4eb [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/lib/memcpy.S
3 *
Nicolas Pitre75494232005-11-01 19:52:23 +00004 * Author: Nicolas Pitre
5 * Created: Sep 28, 2005
6 * Copyright: MontaVista Software, Inc.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
Nicolas Pitre75494232005-11-01 19:52:23 +00008 * 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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
Nicolas Pitre75494232005-11-01 19:52:23 +000012
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/linkage.h>
14#include <asm/assembler.h>
15
Catalin Marinas8b592782009-07-24 12:32:57 +010016#define LDR1W_SHIFT 0
17#define STR1W_SHIFT 0
18
Nicolas Pitre75494232005-11-01 19:52:23 +000019 .macro ldr1w ptr reg abort
Catalin Marinas8b592782009-07-24 12:32:57 +010020 W(ldr) \reg, [\ptr], #4
Nicolas Pitre75494232005-11-01 19:52:23 +000021 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Nicolas Pitre75494232005-11-01 19:52:23 +000023 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
24 ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
25 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Nicolas Pitre75494232005-11-01 19:52:23 +000027 .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
28 ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
29 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
Nicolas Pitre75494232005-11-01 19:52:23 +000031 .macro ldr1b ptr reg cond=al abort
32 ldr\cond\()b \reg, [\ptr], #1
33 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
Nicolas Pitre75494232005-11-01 19:52:23 +000035 .macro str1w ptr reg abort
Catalin Marinas8b592782009-07-24 12:32:57 +010036 W(str) \reg, [\ptr], #4
Nicolas Pitre75494232005-11-01 19:52:23 +000037 .endm
38
39 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
40 stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
41 .endm
42
43 .macro str1b ptr reg cond=al abort
44 str\cond\()b \reg, [\ptr], #1
45 .endm
46
47 .macro enter reg1 reg2
48 stmdb sp!, {r0, \reg1, \reg2}
49 .endm
50
51 .macro exit reg1 reg2
52 ldmfd sp!, {r0, \reg1, \reg2}
53 .endm
54
55 .text
56
57/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
58
Linus Torvalds1da177e2005-04-16 15:20:36 -070059ENTRY(memcpy)
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Nicolas Pitre75494232005-11-01 19:52:23 +000061#include "copy_template.S"
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
Catalin Marinas93ed3972008-08-28 11:22:32 +010063ENDPROC(memcpy)