summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/memcpy.S25
-rw-r--r--firmware/common/memset.S24
2 files changed, 49 insertions, 0 deletions
diff --git a/firmware/common/memcpy.S b/firmware/common/memcpy.S
index 2fb9f6a5a7..e129b99442 100644
--- a/firmware/common/memcpy.S
+++ b/firmware/common/memcpy.S
@@ -16,9 +16,11 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "config.h"
19 20
20 .section .icode,"ax",@progbits 21 .section .icode,"ax",@progbits
21 22
23#if CONFIG_CPU == SH7034
22 .align 2 24 .align 2
23 .global _memcpy 25 .global _memcpy
24 .type _memcpy,@function 26 .type _memcpy,@function
@@ -168,4 +170,27 @@ _memcpy:
168 mov r7,r0 /* return dest start address */ 170 mov r7,r0 /* return dest start address */
169.end: 171.end:
170 .size _memcpy,.end-_memcpy 172 .size _memcpy,.end-_memcpy
173#elif CONFIG_CPU == MCF5249
174 .align 2
175 .global memcpy
176 .type memcpy,@function
171 177
178/* Copies <length> bytes of data in memory from <source> to <dest>
179 * This version is not optimized at all
180 */
181memcpy:
182 move.l (4,%sp),%a1 /* Destination */
183 move.l (8,%sp),%a0 /* Source */
184 move.l (12,%sp),%d1 /* Length */
185
186 cmp.l #0,%d1
187 bra.b .byteloopend
188
189.byteloop:
190 move.b (%a0)+,(%a1)+
191 subq.l #1,%d1
192.byteloopend:
193 bne.b .byteloop
194
195 rts
196#endif
diff --git a/firmware/common/memset.S b/firmware/common/memset.S
index 038915c475..bce8936089 100644
--- a/firmware/common/memset.S
+++ b/firmware/common/memset.S
@@ -16,10 +16,12 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "config.h"
19 20
20 .section .icode,"ax",@progbits 21 .section .icode,"ax",@progbits
21 22
22 .align 2 23 .align 2
24#if CONFIG_CPU == SH7034
23 .global _memset 25 .global _memset
24 .type _memset,@function 26 .type _memset,@function
25 27
@@ -105,4 +107,26 @@ _memset:
105 107
106.end: 108.end:
107 .size _memset,.end-_memset 109 .size _memset,.end-_memset
110#elif CONFIG_CPU == MCF5249
111 .global memset
112 .type memset,@function
108 113
114/* Fills a memory region with specified byte value
115 * This version is not optimized at all
116 */
117memset:
118 move.l (4,%sp),%a0 /* Start address */
119 move.l (8,%sp),%d0 /* Value */
120 move.l (12,%sp),%d1 /* Length */
121 lea.l (%d1,%a0),%a1 /* a1 = a0+d1 */
122
123 bra.b .byteloopend
124
125.byteloop:
126 move.b %d0,(%a0)+
127.byteloopend:
128 cmp.l %a0,%a1
129 bne.b .byteloop
130
131 rts
132#endif