forked from bobbl/libaeabi-cortexm0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemcpy.S
62 lines (55 loc) · 1.55 KB
/
memcpy.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Runtime ABI for the ARM Cortex-M0
* memcpy.S: copy memory region
*
* Copyright (c) 2014-2017 Mario Werner <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
.syntax unified
.text
.thumb
.cpu cortex-m0
@ void __aeabi_memcpy8(void *r0, const void *r1, size_t r2)
@
@ Copy r2 bytes from *r1 to *r0.
@ r0 and r1 must be 8-byte-aligned
@
.thumb_func
.global __aeabi_memcpy8
__aeabi_memcpy8:
@ void __aeabi_memcpy4(void *r0, const void *r1, size_t r2)
@
@ Copy r2 bytes from *r1 to *r0.
@ r0 and r1 must be 4-byte-aligned
@
.thumb_func
.global __aeabi_memcpy4
__aeabi_memcpy4:
@ void __aeabi_memcpy(void *r0, const void *r1, size_t r2)
@
@ Copy r2 bytes from *r1 to *r0.
@
.thumb_func
.global __aeabi_memcpy
__aeabi_memcpy:
L_head:
cmp r2, #0
beq L_return
ldrb r3, [r1]
strb r3, [r0]
adds r0, #1
adds r1, #1
subs r2, #1
b L_head
L_return:
bx lr