summaryrefslogtreecommitdiff
path: root/firmware/asm/arm/memcpy.S
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2014-08-06 04:26:52 -0400
committerMichael Sevakis <jethead71@rockbox.org>2014-08-29 22:06:57 -0400
commit77b3625763ae4d5aa6aaa9d44fbc1bfec6b29335 (patch)
tree74b12e2669da8653932f48f1ca3816eef4bf6324 /firmware/asm/arm/memcpy.S
parent7d1a47cf13726c95ac46027156cc12dd9da5b855 (diff)
downloadrockbox-77b3625763ae4d5aa6aaa9d44fbc1bfec6b29335.tar.gz
rockbox-77b3625763ae4d5aa6aaa9d44fbc1bfec6b29335.zip
Add mempcpy implementation
A GNU extension that returns dst + size instead of dst. It's a nice shortcut when copying strings with a known size or back-to-back blocks and you have to do it often. May of course be called directly or alternately through __builtin_mempcpy in some compiler versions. For ASM on native targets, it is implemented as an alternate entrypoint to memcpy which adds minimal code and overhead. Change-Id: I4cbb3483f6df3c1007247fe0a95fd7078737462b
Diffstat (limited to 'firmware/asm/arm/memcpy.S')
-rw-r--r--firmware/asm/arm/memcpy.S10
1 files changed, 9 insertions, 1 deletions
diff --git a/firmware/asm/arm/memcpy.S b/firmware/asm/arm/memcpy.S
index 2a55fb5656..83d43293e6 100644
--- a/firmware/asm/arm/memcpy.S
+++ b/firmware/asm/arm/memcpy.S
@@ -36,17 +36,25 @@
36#endif 36#endif
37 37
38/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */ 38/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
39/* Prototype: void *mempcpy(void *dest, const void *src, size_t n); */
39 40
40 .section .icode,"ax",%progbits 41 .section .icode,"ax",%progbits
41 42
42 .align 2 43 .align 2
43 .global memcpy 44 .global memcpy
44 .type memcpy,%function 45 .type memcpy,%function
46 .global mempcpy
47 .type mempcpy,%function
48
49mempcpy:
50 add r3, r0, r2
51 stmfd sp!, {r3, r4, lr}
52 b 0f
45 53
46memcpy: 54memcpy:
47 stmfd sp!, {r0, r4, lr} 55 stmfd sp!, {r0, r4, lr}
48 56
49 subs r2, r2, #4 570: subs r2, r2, #4
50 blt 8f 58 blt 8f
51 ands ip, r0, #3 59 ands ip, r0, #3
52 bne 9f 60 bne 9f