Loading...
1/*
2 * linux/arch/arm/lib/memcpy.S
3 *
4 * Author: Nicolas Pitre
5 * Created: Sep 28, 2005
6 * Copyright: MontaVista Software, Inc.
7 *
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.
11 */
12
13#include <linux/linkage.h>
14#include <asm/assembler.h>
15#include <asm/unwind.h>
16
17#define LDR1W_SHIFT 0
18#define STR1W_SHIFT 0
19
20 .macro ldr1w ptr reg abort
21 W(ldr) \reg, [\ptr], #4
22 .endm
23
24 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
25 ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
26 .endm
27
28 .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
31
32 .macro ldr1b ptr reg cond=al abort
33 ldr\cond\()b \reg, [\ptr], #1
34 .endm
35
36 .macro str1w ptr reg abort
37 W(str) \reg, [\ptr], #4
38 .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
52 .macro usave reg1 reg2
53 UNWIND( .save {r0, \reg1, \reg2} )
54 .endm
55
56 .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
64ENTRY(mmiocpy)
65ENTRY(memcpy)
66
67#include "copy_template.S"
68
69ENDPROC(memcpy)
70ENDPROC(mmiocpy)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * linux/arch/arm/lib/memcpy.S
4 *
5 * Author: Nicolas Pitre
6 * Created: Sep 28, 2005
7 * Copyright: MontaVista Software, Inc.
8 */
9
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/unwind.h>
13
14#define LDR1W_SHIFT 0
15#define STR1W_SHIFT 0
16
17 .macro ldr1w ptr reg abort
18 W(ldr) \reg, [\ptr], #4
19 .endm
20
21 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
22 ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
23 .endm
24
25 .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
26 ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
27 .endm
28
29 .macro ldr1b ptr reg cond=al abort
30 ldrb\cond \reg, [\ptr], #1
31 .endm
32
33 .macro str1w ptr reg abort
34 W(str) \reg, [\ptr], #4
35 .endm
36
37 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
38 stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
39 .endm
40
41 .macro str1b ptr reg cond=al abort
42 strb\cond \reg, [\ptr], #1
43 .endm
44
45 .macro enter regs:vararg
46UNWIND( .save {r0, \regs} )
47 stmdb sp!, {r0, \regs}
48 .endm
49
50 .macro exit regs:vararg
51 ldmfd sp!, {r0, \regs}
52 .endm
53
54 .text
55
56/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
57
58ENTRY(__memcpy)
59ENTRY(mmiocpy)
60WEAK(memcpy)
61
62#include "copy_template.S"
63
64ENDPROC(memcpy)
65ENDPROC(mmiocpy)
66ENDPROC(__memcpy)