blob: 64111bd4440b1aa3702c469ce349b303a0244ebd [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>
Lin Yongting279f487e2014-11-26 14:38:33 +010015#include <asm/unwind.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Catalin Marinas8b592782009-07-24 12:32:57 +010017#define LDR1W_SHIFT 0
18#define STR1W_SHIFT 0
19
Nicolas Pitre75494232005-11-01 19:52:23 +000020 .macro ldr1w ptr reg abort
Catalin Marinas8b592782009-07-24 12:32:57 +010021 W(ldr) \reg, [\ptr], #4
Nicolas Pitre75494232005-11-01 19:52:23 +000022 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Nicolas Pitre75494232005-11-01 19:52:23 +000024 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
25 ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
26 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Nicolas Pitre75494232005-11-01 19:52:23 +000028 .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
29 ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
30 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Nicolas Pitre75494232005-11-01 19:52:23 +000032 .macro ldr1b ptr reg cond=al abort
33 ldr\cond\()b \reg, [\ptr], #1
34 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Nicolas Pitre75494232005-11-01 19:52:23 +000036 .macro str1w ptr reg abort
Catalin Marinas8b592782009-07-24 12:32:57 +010037 W(str) \reg, [\ptr], #4
Nicolas Pitre75494232005-11-01 19:52:23 +000038 .endm
39
40 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
41 stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
42 .endm
43
44 .macro str1b ptr reg cond=al abort
45 str\cond\()b \reg, [\ptr], #1
46 .endm
47
48 .macro enter reg1 reg2
49 stmdb sp!, {r0, \reg1, \reg2}
50 .endm
51
Lin Yongting279f487e2014-11-26 14:38:33 +010052 .macro usave reg1 reg2
53 UNWIND( .save {r0, \reg1, \reg2} )
54 .endm
55
Nicolas Pitre75494232005-11-01 19:52:23 +000056 .macro exit reg1 reg2
57 ldmfd sp!, {r0, \reg1, \reg2}
58 .endm
59
60 .text
61
62/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
63
Russell King1bd46782015-07-03 15:22:54 +010064ENTRY(mmiocpy)
Linus Torvalds1da177e2005-04-16 15:20:36 -070065ENTRY(memcpy)
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
Nicolas Pitre75494232005-11-01 19:52:23 +000067#include "copy_template.S"
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
Catalin Marinas93ed3972008-08-28 11:22:32 +010069ENDPROC(memcpy)
Russell King1bd46782015-07-03 15:22:54 +010070ENDPROC(mmiocpy)